cancel
Showing results for 
Search instead for 
Did you mean: 

How to rename a XML file using the file/FTP adapter

Former Member
0 Kudos

Hi all

I currently trying to figure out how to rename a XML file using the file/FTP adapter..?? The receiver would like to receive the file in the following format '<regnr>_<date>_<serial number>.exi'. Exampel:

12345678_20060130_00001.exi

The online help mentioned something about 'File Name Schema' but that doesn't make much sense to me..

Please advice - thanxx - Peter

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Peter,

To create a file name Dynamically on the basis of the payload in the receiver fileadapter, youwill have to use VARIABLE NAME SUBSTITUTION.

In your case, the file name will have 3 variables. In the filename field, give the name of the file as %var1%_%var2%_%var3%.exi

Anything between the % sign is treated as a variable by XI. Now , under the Variable Name Substitution, you will have to define how the value has to be determined by XI from the payload.

Consider this case,

<root>

<f1>

<regnr>111</regnr>

<date>20060101</date>

<serialno>111</serialno>

</f1>

f1>

<regnr>222</regnr>

<date>20060101</date>

<serialno>222</serialno>

</f1>

</root>

To create a file of name 111_20060101_222.exi,

var1-->payload:root,1,f1,1,regnr,1

var2-->payload:root,1,f1,1,date,1

var3-->payload:root,1,f1,2,serialno,1

Just check the topic VARIABLE NAME SUBSTITUTION under this link,

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Do let me know if you have any clarifications,

regards,

bhavesh

Former Member
0 Kudos

Hi,

Did you have a look at

/people/sriram.vasudevan3/blog/2005/11/21/effective-xsl-for-multimapping-getting-source-filenames-in-legacy-legacy-scenarios

Please see the 3rd point where the author talks about file name from payload, you also need to use variable substitution here,

Regards,

Anirban.

Former Member
0 Kudos

Hi Bhavesh - thank you for your answer. I'll try to implement your solution and hopefully it will work.

Thanks - Peter

Former Member
0 Kudos

Hi Bhavesh,

I am using your idea, but I have an another XML structure:

Your Structure:

<root>

<f1>

<regnr>111</regnr>

<date>20060101</date>

<serialno>111</serialno>

</f1>

f1>

<regnr>222</regnr>

<date>20060101</date>

<serialno>222</serialno>

</f1>

</root>

My structure:

<ns1:MSg xmlns:ns1="http://www.mycomp.inf.br/msr">

<ns1:MSgVal type="A" Id="188549">

<ns1:cab>

<ns1:PO>4500000000</ns1:cPO>

<ns1:BI>90000000011</ns1:cBI>

</ns1:cab>

</ns1:MSgVal>

</ns1:MSg>

How do I do to get the value 188549 from the field Id that is into the tag MSgVal?

Regards,

Fernando