cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Output File Name as One of the Field Value From Payload

Former Member
0 Kudos

Hi All,

I want to get the Output file name as one of the Field value from payload.

Example:

Source XML

<?xml version="1.0" encoding="UTF-8" ?>

- <ns0:MT_TEST xmlns:ns0="http://sample.com">

- <Header>

<NAME>Bopanna</NAME>

</Header>

</ns0:MT_TEST>

I want to get the Output file name as " Bopanna.xml"

Please suggest me on this.

Regards

Bopanna

Accepted Solutions (0)

Answers (2)

Answers (2)

Jitendra_Jeswan
Contributor
0 Kudos

In the Receiver file adapter give the file name is %name%.xml

In the variable substitution under the variable name write --> name

In the variable substitution under the reference write --->payload:MT_TEST,1,Header,1,NAME,1

This should work

Regards.

Jeet.

turmoll
Active Contributor
0 Kudos

Hi,

Go through this doc: [Dynamic File Name using XI 3.0 SP12 Part - I|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1888] [original link is broken] [original link is broken] [original link is broken];

Regards,

Jakub

Former Member
0 Kudos

Go for Variable substitution method:

/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12

/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

Thnx

ChiragReward points if it helps.

Former Member
0 Kudos

Hi,

There are couple of links already available for this. Just for info see the below details,

The Output file name could be used from the field value of payload. For this you need to use the UDF DynamicFile name with below code,

// Description: Function to create dynamic Filename

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

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

conf.put(key,a);

return "";

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

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

conf.put(key,a);

return "";

With this udf map it with the MessageType as

(File Name field from Payload) > DynamicFileConfiguration>MTReceiver

Thanks

Swarup