on 04-13-2012 9:05 AM
Hi all,
I need to set the name of the file I generate in my integration scenario dinamically. I am using a Java mapping.
I have search in forum and I have seent that in graphical mapping I can use a UDF like:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); | ||||
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName"); | ||||
String SourceFileName = "nameoffile.txt"; | ||||
String TargetFileName = SourceFileName; | ||||
conf.put(key, TargetFileName); |
I have tried this in my java mapping but I get a compilation error on container.
getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
Does anyone know how to do this inside in a java mapping?
Thanks.
Hi,
The code to be used inside the Java mapping is a little bit different. Use the following:
DynamicConfiguration conf = input.getDynamicConfiguration();
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String filename = "some_file_name.txt"; //use your own name here
conf.put(key, filename);
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This input variable should be of type TransformationInput. See a complete example here, maybe this will help you: http://pastebin.com/F82wRPcf
Regards,
Greg
thanks greg. This java code is very usefull.
I have implemented, but now I get this error on my communication FTP channel:
Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error occurred while connecting to the FTP server "192.168.40.83:21": java.lang.Exception: Exception in XML Parser (format problem?):'org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.'
I have configured the Receiver FTP channel in Advanced-->Adapter-Specific Message Atrributes and I have checked:
- Use Adapter-Specific message attributes
- Fail if adapter-specific attribute is missing
- File Name
Any idea?
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.