cancel
Showing results for 
Search instead for 
Did you mean: 

Idoc number as file name

Former Member
0 Kudos

Hi

I am working on idoc - file scenario. I need to get the idoc number as file name in the receiver side? How could it be done ?

Accepted Solutions (0)

Answers (6)

Answers (6)

0 Kudos

Hi, Sekhar!

Check this forum thread, it might be useful to you

Stanislav.

Former Member
0 Kudos

hi sekhar,

As per my knowledge that is very simple by using u201CVariable Substitution conceptu201D

You requiremet is target file will be created on header info(idoc number )

Please refer below links:

For ex:

Step3 in below link

http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot

and

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6a316af5a23672e10000000a114a6b/frameset.htm

thanks,

Former Member
0 Kudos

Hi Sekhar,

Use the below code :



public String putDynamicConfiguration(String docnum, Container container) throws StreamTransformationException{
try
{
	DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
	DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
	String filename = "Prefix_" + docnum + ".txt";
	conf.put(key, filename);
	return docnum;
}
catch (Exception e)
{
	return docnum;
}

Former Member
0 Kudos

Hi,

You may go for any one of the following approaches:

1. Enable variable substitution in the File receiver channel. Search SDN for details.

2. Use Dynamic Substitution to set the file name via Message Mapping and then use ASMA (Adapter Specific Message Attributes) to set the receiver file name accordingly in the FIle receiver channel. Search on SDN for details.

Hope this helps.

Regards, Gaurav

former_member184681
Active Contributor
0 Kudos

Hi,

You need to use Dynamic Configuration to set the file name dynamically in your mapping. In your receiver Communication Channel, on the Advanced tab, mark the Use Adapter-Specific Message Attributes and File Name checkboxes. Please refer to this help if you need further information about it:

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6830e67f2a6d12e10000000a1553f6/content.htm

Then create a user-defined function in your graphical message mapping, with the following code:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = a;
return  SourceFileName;

The "a" here is the importing parameter of the user-defined function. Map IDoc number to this function to have the parameter set.

Hope this solves your problem,

Grzegorz

Former Member
0 Kudos