on 04-02-2015 10:58 AM
I am using following UDF for my requirement and choosing ASMA in channel, here I am using both filename as well as directory dynamically.
public String setFileName(String input1, String input2, String input3, Container container) throws StreamTransformationException{
String filename = new String("");
String directory = new String("");
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");
DynamicConfiguration conf2 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","Directory");
Date dNow = new Date( );
SimpleDateFormat ft =
new SimpleDateFormat ("yyyyMMdd_HHmmssSSS");
filename = ft.format(dNow) +"_"+input1+ "_WO_"+ input2 + "_" + input3 + ".XML";
conf1.put(key1,filename);
if(input1=="CR")
{
directory = directory1;
}
else
{
if(input1 =="UP")
{
directory = "directory2";
}
}
conf2.put(key2,directory);
return "";
}
I am getting floowing error
Transmitting the message to endpoint <local> using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.InvalidDynamicConfigurationValueException: The Adapter Message Property Directory provided in the message header has an invalid value: ''
Please Help....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for your suggestions.
Issue got resolved using variable substitution
Thanks !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vinod,
Adding to above suggestions.
Please check, if UDF is trying to add invalid characters to filename. For example \, /, :, *, ?, ", <, >, |, replace them with underscore ("_").
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinod,
here's a simple example:
public String SetTargetDirectory(String Zid_network,Container container){
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
if (Zid_network.equals("XXXX_A")) {
conf.put(key, "DMH/upload/motor/prv");
}
if (Zid_network.equals("XXXX_B")) {
conf.put(key,"DMH/upload/ricambi/prv");
}
if (Zid_network.equals("XXXX_C")) {
conf.put(key, "DMT/upload/thai/prv");
}
return "";
}
hope it helps
BR
Fabio
PS= use .equals not ==
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinod,
There is an extraordinary Amit Srivastava blog which deals with your problem. It is oriented to be used at module adapter level, from my point of view if you are going to work with characteristics near to the communication channels, it's better to add a new adapter module. Check the blog here
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>>
if(input1=="CR")
{
directory = directory1;
}
Where did you define directory 1? I believe it's a syntax error. You won't be able to activate the mapping right?
However if it is a constant path then please provide valid path "/<<dir name>>" instead of just giving the directory name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.