cancel
Showing results for 
Search instead for 
Did you mean: 

Create Filename from Data within IDOC

ChadRichardson
Participant
0 Kudos

Good afternoon, All

In PI 7.0 we are sending an IDOC to a File. The XSL mapping between the two creates a structure like the following:

<resultset>

<row>

<fieldOut>xxxxx</fieldOut>

</row>

<resultset>

Content Conversion is then used on the outbound File adapter to create a .TXT file that is picked up for further process.

I now have the requirement to NAME the resulting .TXT file based upon information within the original IDOC.

I've tried Variable Substitution but it appears that this only applies to the resulting mapped results and not the original payload.

Any help that you could give me would be greatly appreciated.

Regards,

Chad

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Chad,

One option you can try is create a graphical message mapping with the same idoc and map one to one (each field) in the idoc. This will make sure that your idoc is not changed anything. Also as mentioned in the above thread write the user defined function for getting the filename.

Now in interface mapping first you have this graphical message mapping and you add another mapping which is your xsl mapping. Then in the receiver file adapter for the reciever filename just put FileName so that your filename which ever is mapped in the message mapping will pick. Try this option as last because the first mapping we are only using for getting the filename. This may decrease your performance to a little extent, so please analyse the requirements properly.

Regards,

---Satish

Former Member
0 Kudos

Hi,

You can do this with usage of Dynamic File configuration

Please refer step by step process for it

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2161. [original link is broken] [original link is broken] [original link is broken]

IDoc-To-xml File Dynamic Configuration

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i

/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii

Use below UDF as mentioned in above links

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

//get Key of Directory File name

DynamicConfigurationKey keyF = DynamicConfigurationKey.create( URLFile, "FileName");

//get Key of Directory

DynamicConfigurationKey keyD = DynamicConfigurationKey.create( URLFile, "Directory");

//Replace value of Filename

conf.put(keyF,file);

//Replace value of Directory

conf.put(keyD,dir);

Thanks

Swarup

Edited by: Swarup Sawant on Jun 3, 2008 9:30 PM