on 07-14-2010 10:02 AM
Hi Experts,
I have a requirement to get a processID from the source structure and that name should be the name of the output file. I have written a code.. Could anyone please check the code and tell me if any changes need to be made for the code.
Here I need to add that field in the filename. I am mapping this field to the root node of the target structure.
public String Filename(String a,Container container)
{
String b; // Target file Name
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
b = "MN1234" + a +"12345.TXT";
conf.put(keyHeader1, b);
return "";
}
Quick reply is highly appreciated......
Edited by: Hareenkumar on Jul 14, 2010 11:03 AM
looks fine.
More info at - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shabarish,
Could you please check the code given to ensure that changes I made to the code are fine..
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(u201Chttp://sap.com/xi/XI/System/Fileu201D,u201CFileNameu201D);
String name = "OU2003" + a + "OSLORR" + b ".txt;
conf.put(key, name);
When I try to test the scenario, I am getting the below error:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header
Could you please tell me what is the reason behind it...
I am able to execute the UDF and able to get the file in the Dynamic Configuration in moni. unable to process at the receiver side. The scenario is proxy to File.
My UDF is:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String name="MN1234" + a + "123456.TXT";
conf.put((keyHeader1, b);
return "";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String name="MN1234" + a + "123456.TXT";
conf.put((keyHeader1, b);
return "";
UDF is wrong ......
1) what is b?
2) why are you using b in the conf.put statement?
3) conf.put((keyHeader1, b); ......why am i seeing two start brackets?
4) Is a defined properly?
Try with the below UDF:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String name="MN1234" + a + "123456.txt";
conf.put(keyHeader1, name);
return ""
Sorry abhi, unfortunately I have sent the wrong one.
The UDF what I have used is :
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String final1;
final1 = "MN1234" + a + "123456.TXT";
conf.put(key,final1);
return "" ;
String b;
b = "MN1234" + a +"12345.TXT";
Things look fine.....instead of having two statements you could combine it into one
String b = "MN1234" + a +"12345.txt";
Do not forget to check teh ASMA attribute, FileName, in the FILE channel and test it end-to-end
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.