on 11-08-2010 10:45 AM
Hi All
I have a one requirement the requirement is like this
Suppose if we received the file with name ABC.txt we have to send the same file (the content should be same) with different filename depend on the field value in the file ABC.txt
For ex: we have received the filename ABC.txt and in the filed 10, the content is "111"(This value should vary from file to file) we have to append this content to the target filename while sending . So the target filename should be ABC_111.txt.
Could you please advice on the same.
Regards
Ajay
Hi Ajay,
The requirement specified can be achieved in two different ways:
Option 1. Using ASMA properties.
Enable Adapter Specific Message Attributes, enable Filename and Filetype. Use the below UDF and map to the root node.
public String myFileName(String a,Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String myFileName = "ABC" a "inputvalue.txt";
conf.put(key, myFileName);
return "";
}
Option 2:
You can do Variable substitution in your receiver coomunication channel. For this, you need to Enable the option for Variable substitution (Target Directory/File Name Scheme) and enter the variable name and Reference(Path).
Then in the Target File Name scheme keep as ABC_Variable.txt
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you have a mapping then this can be done via dynamic configuration (using adapter specific message attributes).
Here file name can be derived with in the mapping. Check this blog for details.
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
regards,
francis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For this you have to create a UDF as mentioned below and then set the ASMA (Adapter Specific Message Attributes) in your Sender and Receiver CC under Advance tab.
Note: While creating the UDF just declare one input argurment. let say "inputvalue" and map the value from your input field to the UDF.
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String source_file = conf.get(key);
//Below line of code will add the input field value to the file name.
String target_file = source_file + "_" + inutvalue.
conf.put(key, target_file);
<b>return</b> "";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.