Dynamic Configuration with different value in case of Mutli Mapping - SFTP Adapter
Dynamic Configuration with different value in case of Mutli Mapping - SFTP Adapter
MutliMapping, Dynamic Configuration, SFTP
SAP Integration | Anupam Chakraborty | Jan 26 2015 01:57 PM
Problem:
There has always been a problem of handling file name for multiple files created using a Multi Mapping, because one map can have only one value of the SOAP Dynamic Configuration Variable "FileName". The same problem can be easily resolved in case of SFTP Adpater.
Requirement:
You have one Sender Interface and two Receiver Interface. You have a Message Mapping with the Signature as
Source Message | Target Message |
MT_Source | MT_Target_1 |
MT_Target_2 |
You want the two files to have different names. Something like FileHeader.<date>.txt and FileDetail.<date>.txt. One can say that you would not need to use dynamic configuration in this case, but if the requirement is to have <DATE> and not <DATETIMESTAMP>, you cannot use the standard process of addTimeStamp in the file.
Solution:
This can be achieved by a simple UDF:
And then you have to use the new functionality that is given in the SFTP Channel Dynamic Configuration:
Adapter Specific Message Attribute:
Use Adapter Specific Message Attribute:
Namespace: http://sap.com/xi/XI/System/File
Filename Attribute Name: HdrFileName
Code
String strHdrFileName ="FileHeader."+date+".txt"; String strDtlFileName ="FileDetail."+date+".txt"; DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey keyHdrFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","HdrFileName"); DynamicConfigurationKey keyDtlFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","DtlFileName"); if(conf != null) { conf.put(keyHdrFile,strHdrFileName); conf.put(keyDtlFile,strDtlFileName); } return "";
Comments:
Leave a Comment:
Please login to post comment into this page.