cancel
Showing results for 
Search instead for 
Did you mean: 

FILENAMING CONVENTION

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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,

Former Member
0 Kudos

Hi All

Thanks for your answers.

Regards

Ajay

Former Member
0 Kudos

Hi Ajay,

Also refer the below blog:

/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Thanks,

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

You can use Variable Substitution on the receiver file communication channel.

You have to first enable "Variable substitution", then in the row, mention a variable name and the value from the payload.

Use the same variable in the file name scheme.

Thanks,

Sidhartha

Former Member
0 Kudos

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> &quot;&quot;;