cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name creation

Former Member
0 Kudos

Hi All,

I have this scenario: IDoc --> XI --> File (FTP)

I need to create a file with a variable name: AAAA_nnnn.xml ; where AAAA_ is the constant part,

while nnnn is the variable part(it is a counter). The counter value could be included in the IDoc.

I cannot use the variable substitution because I cannot modify the XML of the target message.

Is there a method to pass the full filename to the file Adapter?

Thanks in advance

REgards

Emiliano

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Emiliano,

If you want to pass the entire filename dynamically from messagemapping - you might choose to pass the value in adapter specific message attributes in the XI message header and in the file channel set the indicator Use Adapter Specific Message Attributes and then FileName.

In the message mapping you need to write a UDF to write the value in the FileName adapter specific message attribute of the XI message header.

Thanks,

Suddha

S0003991129
Explorer
0 Kudos

Thanks Suddha. That's the way I was walking...Another doubt:

The File Name Scheme is a mandatory field of the adapter parameters, if I put I value, It will be

replaced by the Adapter Specific Parameter File name at runtime?

Thanks

Emiliano

Former Member
0 Kudos

Hi Emiliano,

yes, I recommend you use the following format for the file name scheme :

<Constant Part>_<Counter>.xml

This will help to understand the place holders for the filename.

Regards,

Suddha

Answers (4)

Answers (4)

former_member182455
Active Contributor
0 Kudos
Former Member
0 Kudos

Create a UDF in mapping taking counter from IDoc as input parameter

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String totalFilename = "AAAA_" + counter;

conf.put(key,totalFilename);

return totalFilename;

Map output of this UDF to Top node at target.

you will not be able to see the result in test tab of mapping but it works end to end

Select Adapter Specific Message Attributes in receiver file adapter..here select filename checkbox

JaganMohan
Participant
0 Kudos

Dear Emiliano,

Please refer this thread. Hope this clarify your problem.

Regards,

Jagan.

Former Member
0 Kudos