Skip to Content
0
Former Member
Mar 02, 2009 at 05:32 PM

Varialbe Substitution in Multimapping

16 Views

Hi,

We are trying to use variable substitution for generating multiple files at the target. Our XI Version is XI 3.0 SP 15.

My Source Structure is

P_MT_multimapping 1..1 -


>(MessageTypeName)

source 0..unbound

A 0..1

B 0..1

C 0..1

D 0..1

and

My Target Structure is

PMTmultimapping 0..unbound -


>(MessageTypeName)

Target 0..unbound

A 1..1

B 1..1

C 1..1

D 1..1

filename1 0..unbound

filename1 1..1

My Requirement is to generate a new file for each unique value of 'B' from the source and for a particualr file multiple records should be generated for each unique value of 'A' from the source. And target field 'filename1' should be incremented by 1 for each file. For example

My source payload is:

<?xml version="1.0" encoding="UTF-8"?>

http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

http://infosys.com/xi/projects/bp/n1">

<Source>

<A>1</A>

<B>KJ</B>

<C>1</C>

<D>1</D>

</Source>

<Source>

<A>1</A>

<B>KH</B>

<C>1</C>

<D>1</D>

</Source>

<Source>

<A>1</A>

<B>KK</B>

<C>1</C>

<D>1</D>

</Source>

<Source>

<A>1</A>

<B>KL</B>

<C>1</C>

<D>1</D>

</Source>

<Source>

<A>2</A>

<B>KL</B>

<C>1</C>

<D>1</D>

</Source>

<Source>

<A>2</A>

<B>KK</B>

<C>1</C>

<D>1</D>

</Source>

</ns1:P_MT_multimapping>

</ns0:Message1>

</ns0:Messages>

And generated target payload:

<?xml version="1.0" encoding="UTF-8"?>

http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

http://infosys.com/xi/projects/bp/n1">

<Target>

<A>1</A>

<B>KH</B>

<C>1</C>

<D>1</D>

</Target>

<filename1>

<filename1>1</filename1>

</filename1>

</ns1:PMTmultimapping>

http://infosys.com/xi/projects/bp/n1">

<Target>

<A>1</A>

<B>KJ</B>

<C>1</C>

<D>1</D>

</Target>

<filename1>

<filename1>2</filename1>

</filename1>

</ns1:PMTmultimapping>

http://infosys.com/xi/projects/bp/n1">

<Target>

<A>1</A>

<B>KK</B>

<C>1</C>

<D>1</D>

</Target>

<Target>

<A>2</A>

<B>KK</B>

<C>1</C>

<D>1</D>

</Target>

<filename1>

<filename1>3</filename1>

</filename1>

</ns1:PMTmultimapping>

http://infosys.com/xi/projects/bp/n1">

<Target>

<A>1</A>

<B>KL</B>

<C>1</C>

<D>1</D>

</Target>

<Target>

<A>2</A>

<B>KL</B>

<C>1</C>

<D>1</D>

</Target>

<filename1>

<filename1>4</filename1>

</filename1>

</ns1:PMTmultimapping>

</ns0:Message1>

</ns0:Messages>

I want to pick the filename from field 'filename1'. I used only single communication channel

My channel has the following variable substitution

payload:PMTmultimapping,1,filename1,1,filename1,1

the value for filename1 is set to "var"

I use NFS and write the target file as : file%var%sant.xml

This creates only one file at the target directory with the file name 'file1sant.xml'.

but I want to generate multiple files for the above.

Any pointers on How to Fix this.

Regards,

Abhishek.