cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file and variable substitution

Former Member
0 Kudos

Hi Experts,

I am working on a scenario where filename is reading from payload.based on header value ,i am creating file along with item records.I did variable substitution also.whenever header value changes ,a new file shud be created.

I placed two records in my input message...

<ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">

<Source>

<b> <FName>XYZ</FName>

<FType>F</FType>

<Input>Item1</Input></b> </Source>

<Source>

<b> <FName>ABC</FName>

<FType>F</FType>

<Input>Item2</Input></b>

</Source>

</ns1:MT_DC_Send>

but only one file is getting created with name XYZ.txt(I used cont conversion)

.

output fiile data is

<b>

Item1

Item2</b>

Regards,

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Srini,

Are u splitting the messages into multiple messages based on the input file?

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

Didn't get ur point. In Interface maaping , i gave o/p message type Occurence as '0...to unbounde' and in configuration,interface determination mention as 'extended' and in rec CC ,did all settings for variable substituion.

Where i have to split the message? pls give me idea?

I tried multimapping,but for second target message, it is asking reciver agrmt,after giving that ,it is trying to create file and getting failed at variable subst where i did setting for only target message type1.

Regards,

srinivas

Former Member
0 Kudos

Hi Raj,

From source , i am not considering filed 'FType'.Only i did mapping 'Fname' to 'Filename' and 'input' to 'Output'.and also source node to target node.

Here is my both stc and trgt stru.

<ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">

<Source>

<FName/>

<FType/>

<Input/>

</Source>

</ns1:MT_DC_Send>

<ns1:MT_DC_Recr xmlns:ns1="http://urn:psr/ff/DC">

<Target>

<Output>I</Output>

</Target>

<Record>

<Filename>F</Filename>

</Record>

</ns1:MT_DC_Recr>

Regds,

Srinivas

santhosh_kumarv
Active Contributor
0 Kudos

Hi

Map the filename of the source structure to the Record and Filename of the target structure.

So for every file name occurrance a seperate Record will be created in the target and seperate file will be created.

Regards

Santhosh

Former Member
0 Kudos

Hi santhosh,

Same result.

Item1

item2 are coming in one file only.

i am not using multimapping as here i am creating file whenevr header value changes.but multimapping is useful where u want create header in one file and items in one file like that....correct me if i am wrong..

i tried with multimapping too with two target messages at target say target1 and target2. for target1-filename field is used in the variable substituion and getting created files coreectly but sec target is too try to create the file and giving error

"Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: sri:

Filescheme :%sri%.txt

Regards,

srinivas

justin_santhanam
Active Contributor
0 Kudos

Srini

Can u confirm onething, U will get only two Items or it can be also in the below format

ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">

<Source>

<FName>XYZ</FName>

<FType>F</FType>

<b><Input>Item1</Input></b>

</Source>

<Source>

<FName>ABC</FName>

<FType>F</FType>

<b><Input>Item2</Input></b>

</Source>

<Source>

<FName>FGH</FName>

<FType>F</FType>

<b><Input>Item3</Input></b>

</Source>

<Source>

<FName>GHJ</FName>

<FType>F</FType>

<b><Input>Item1</Input></b>

</Source>

</ns1:MT_DC_Send>

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

If i give input as per you post , i will get output file in the below format with out header i.e filename as i am suppressing them in cont conv.

Item1

Item2

Item3

Item1

name of the o/p filename is XYZ.txt

regards,

Srinivas

Former Member
0 Kudos

Hi Raj,

any input from you?

Regards,

Srinivas

Former Member
0 Kudos

Hi Experts,

any idea on the above scenario.I need to get multiple dynamic files from single input XML file .

Regards,

Srinivas

Former Member
0 Kudos

Hi Raj,

any input from you? I'm waiting for your input......

Regards,

Srinivas

justin_santhanam
Active Contributor
0 Kudos

Srini,

Good Morning!!Sorry for late reply.Give me some time , once I reached the office , I'll try to solve and post back ASAP. In the meantime our friends will try to solve it.

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

Thanks for your reply.

Pls find the link below for message mapping pic.

http://www.flickr.com/photos/10737457@N06/950848946/

Occurences: for source - 1,

Target - 0-unbounded

Regards,

Srinivas

justin_santhanam
Active Contributor
0 Kudos

Srini,

Thanks for the patience. The link which u sent is not working.

Please find the total scenario in the below URL's, if u find any discrepancies , please let me know.

<b>Structures defined</b>:http://www.flickr.com/photo_zoom.gne?id=956871756&size=o

Create corresponding message types & Interfaces(Outbound:OB/Inbound:IB)

<b>Mapping Logic:</b>

First change the message occurrence:

http://www.flickr.com/photo_zoom.gne?id=956027877&size=o

Part1 :http://www.flickr.com/photo_zoom.gne?id=956871778&size=o

Part2 :http://www.flickr.com/photo_zoom.gne?id=956871880&size=o

Part3 :http://www.flickr.com/photo_zoom.gne?id=956871906&size=o

UDF used in Part3 mapping:

Test_Function[Cache:Queue, Input:FName, data]

String local ="";

for(int j=0;j<FName.length;j++)

{

if(j==0)

{

result.addValue(""data[j]"");

local =FName[j];

}

else

{

if(FName[j].equals(local))

{

result.addValue(""data[j]"");

local =FName[j];

}

else

{

result.addContextChange();

result.addValue(""data[j]"");

local =FName[j];

}

}

}

Message Mapping results:http://www.flickr.com/photo_zoom.gne?id=956027763&size=o

<b>Interface Mapping:</b>

http://www.flickr.com/photo_zoom.gne?id=956027893&size=o

<b>Interface Determination:</b>

http://www.flickr.com/photo_zoom.gne?id=956027913&size=o

<b>Check your ID Objects:</b>

http://www.flickr.com/photo_zoom.gne?id=956888454&size=o

<b>Receiver Comm.Channel:</b>

http://www.flickr.com/photo_zoom.gne?id=956027857&size=o

Thats it!!!

Now run the scenario. I used the same data which I used in the above URL's

<b>SXMB_MONI</b>:http://www.flickr.com/photo_zoom.gne?id=956871938&size=o

<b>Outputs</b>:http://www.flickr.com/photo_zoom.gne?id=956027957&size=o

In the output file the first line which u see in the csv files are Item tag as per ur input. The second line is the filename , I don't know how to suppress the filename element in the output file. <b><i>Our friends has to help it out</i></b>.

<b>Note:</b> While copying the test data from Mapping editor don't forget to remove the Messages element from the source.

I hope it helps you!!!!!

Best regards,

raj.

Former Member
0 Kudos

Hi Raj,

Thank you very much for your inputs.

Regards,

srinivas

Answers (2)

Answers (2)

Former Member
0 Kudos

juz rechecking

<ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">

<Source>

<FName>XYZ</FName>

<FType>F</FType>

<Input>Item1</Input> </Source>

<Source>

<FName>ABC</FName>

<FType>F</FType>

<Input>Item2</Input>

</Source>

</ns1:MT_DC_Send>

I suppose it has to be

<ns1:MT_DC_Send xmlns:ns1="http://urn:psr/ff/DC">

<Source>

<FName>XYZ</FName>

<FType>F</FType>

<Input>Item1</Input> </Source>

<b></Source></b> missing ?

<Source>

<FName>ABC</FName>

<FType>F</FType>

<Input>Item2</Input>

</Source>

</ns1:MT_DC_Send>

Cheers

*RAJ*

*REWARD POINT IF FOUND USEFULL*

Former Member
0 Kudos

Hi Rajesh,

</source> is there.

Regards,

srinivas

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

U should split the input messages to two files.

Go they this Blog for multi-mapping.

<a href="/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure of Multi-Mapping and Message Split using BPM</a> by Sudharshan Aravamudan

can u provide the mapping that u r doing.

Regards

Santhosh

<a href=" to set the thread to solved when you have received a solution</a>

Former Member
0 Kudos

have look

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i --> Dynamic File Name using XI 3.0 SP12 Part – I

/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii --> Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II

Thanks