cancel
Showing results for 
Search instead for 
Did you mean: 

File name to be generated from outbound text file data

Former Member
0 Kudos

Hi Experts,

I am collecting IDOCs and generating IDOC-XML(for IDOCS) file and sending it to PI 7.0 using sender file adapter.

This is File to File scenario.

IDOC-XML file picked by sender file adapter gets transformed using XSL mapping in to .dat(text) file.

Sample Output of .dat file (target file)

STR SE 2008-10-3011:13:00$SEQ

EIH21148862 D2008102820081127SEK000000894800000000894800000000000000 0000XYZ co Ltd KL25533781 2114886209 335592 2508867

EIL21148862 0000000000000000100000000000020081021 335592 20081010KILLL899 Operating System

Now I want output file name to be: ABC_DEF_cc_yyyymmdd_segno.dat

ABC_DEF is constant

cc - means country code, in this case it should be "SE", which is marked in bold immediately after STR.

yyyymmdd - date format

segno - which means no of records like number of lines in text file, (say three records: STR, EIH, EIL)

Please feel free for any clarifications required.

I hope I am able to explain scenario.

I would really appreciate if you can help me with your valuable inouts.

Thanks,

Divyesh

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

just put one more mapping as the last mapping in your interface mapping

it can be abap or java mapping

then as per this blog fill out Filename attribute which will set the file name

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

you can parse the whole IDOC structure in tthose mappings to get all the data you need for the filename

this is the easiest way I'd say

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michal,

Thanks for your quick response.

My XSL mapping is producing text file data not XML data.

So how java mapping will work after that to extract IDOC structure, or is it possible to extract data from text file?

Thanks,

Divyesh

prateek
Active Contributor
0 Kudos

You may place a message mapping with same source and target structure and use dynamic configuration there to set the receiver filename. It could take input as country code name as well as the occurrence of records (to find the number of record lines). Then simply proceed with your xsl mapping.

Regards,

Prateek

Shabarish_Nair
Active Contributor
0 Kudos

Yours is a file to file scenario.

Your XSL mapping will generate the output flat file.

After the XSL use a java mapping which will set the filename using dynamic configuration. Regarding the payload just get the file as an inputstream and pass it out as an outputstream.

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

Former Member
0 Kudos

Hi Shabarish,

Thanks Michal, Shabarish for your prompt replies.

It is almost done, just small query :

With Java mapping , File name is generated properly.

File name is reflected under DynamicConfiguraion under Response step on SXMB_MONI screen.

What shoulld I give File name in receiver communication channel, as it is mandatory.

Thanks,

Divyesh

Shabarish_Nair
Active Contributor
0 Kudos

check the ASMA parameter -> Filename in CC and give any dummy filename for the mandatory filename field.

Former Member
0 Kudos

Give any name in receiver file adapter, it will be over written by Dynamic configuration....at runtime

Also make sure you have checked Adapter Specific Message Attributes in receiver file adapter

Former Member
0 Kudos

Hi Michal, Shabarish, Mugdha,Prateek

Thanks.

Problem is resolved.

Actually, DynamicConfigurationKey object was not created properly, I set with filename, but it should be FileName.

Now it is working fine.

Thanks Again.

Best Regards,

Divyesh

Answers (0)