cancel
Showing results for 
Search instead for 
Did you mean: 

Change Filename using XSLT mapping without variable subtitution

Former Member
0 Kudos

Hi,

My scenario is IDOC to file...i am using XSLT mapping, i want to change the filename format to OUT_<Purchase Number>_<DDMMYYYYhhmmss>_KKKK.txt, i cannot use UDF function as i do XSLT mapping i also i cannot use variable substitution as the target structure doesn't have PO and timestamp as tag elements. Can i acheive using writing a adapter module? I appreciate if anyone could help me with this..

Many thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

With out dynamic configuration you cannot use the file name for the receiver file adapter...

one option is to either include the java code in the XSLT for handling the file name itself...

other option is to use message mapping just for file name generation for the receiver adapter...

for this you need to include the message mapping first and then XSLT mapping as XSLT output which will not have required parameters for generating file name...

HTH

Rajesh

Former Member
0 Kudos

Hi,

If i go with Option1: what changes i need to do in the file adapter to tell the adapter to pick the filename from XSLT ?

If i go with Option2: To which element to the target structure should i map the filename using UDF ? do i have to add additional element to the target structure? what changes i need to do in the file adapter to tell the adapter to pick the filename from Message mapping ?

Many thanks

Former Member
0 Kudos

>

> Hi,

> If i go with Option1: what changes i need to do in the file adapter to tell the adapter to pick the filename from XSLT ?

> If i go with Option2: To which element to the target structure should i map the filename using UDF ? do i have to add additional element to the target structure? what changes i need to do in the file adapter to tell the adapter to pick the filename from Message mapping ?

>

> Many thanks

Hi,

in both cases you need to enable file adapter specific properties and enable the file name...

for this you need to use the dynamic configuration properties for the same...

usage of this option using udf in message mapping is rather easy than to use in XSLT...for this you dont need to change the structure in the message mapping...message mapping is just needed for execution of the udf.. thats it..

HTH

Rajesh

Former Member
0 Kudos

As we do not need Message mapping if we use XSLT so now i need to define the message mapping and then call this in Message Interface and then the XSLT mapping in the Message program. I hope when i try this the adapter does not throw the runtime error .....??

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Ravi,

In you requirement there is no message mapping only XSLT Mapping means,you can chnage the file name using XSLT Mapping it self,we can add java coding in XSLT Mapping,even dynamic configuration wil work it out in XSLT Mapping.But my advice to you create one dummy message mapping to chnage file name use dynamic configuration,and call this message mapping after execution of XSLT MAPPING.

This is the good design,becaus if you add any java code in XSLT ,you have to be proficient in debugging XSLT and its not a advisable to use java function in XSLT.

if you add one messge mapping its very easy to debug if there is any problem ,use source and tager for message mapping is target message structure.

you wont get any rumtime errors,but if you are use dynamic configuration you need run interface end to end,other wise you will error.

Even we can achineve this using JAVA Mapping.

Regards,

Raj

Former Member
0 Kudos
If i go with Option2: To which element to the target structure should i map the filename using UDF ? do i have to add additional element to the target structure? what changes i need to do in the file adapter to tell the adapter to pick the filename from Message mapping ?

Please check this blog.It will help.

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID0636361550DB10497027772649855284End...

Specifically check the 3rd case under 'Code the Dynamic Configuration'

Former Member
0 Kudos

I had included the java code in the XSLT for handling the file name, the problem is resolved..

Many thanks..

Answers (1)

Answers (1)

ravi_raman2
Active Contributor
0 Kudos

You have one more alternative.

Run scenario as always.

1) create java pgm that parses ur final output file and gets the fields you need to create your file name from and change the file name from the OS command.

Invoke this java pgm from a batch file, on the reciever comm channel.

Regards

Ravi Raman

Former Member
0 Kudos

Hi Ravi Raman,

Can i have any examples or can you explain the steps to Invoke this java pgm from a batch file, on the reciever communication channel and change the filename in OS command, i know we have to use place holders but i am not sure how to do that.. I am not so good at these things..

Many thanks..