cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue with useOneAsMany Function

former_member182412
Active Contributor
0 Kudos

Hi Experts,

1) The target node DATA must be repeat as many times as YT3M in source side, if YT3M not exist it must fill with empty node.

2) the target field "P" must reapeat as many times as YT3M in source side and P value from source side repeat same value for all YT3M occurance under M1M node, if M1M node not exist fill with empty.

Can anyone help me about this.

Sorce structure is look like this.

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

<ns0:mt1 xmlns:ns0="urn:sap.shoprite.co.za:ecc:md">

<a1m>

<m1m>

<po>100</po>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>2</m>

</yt3m>

</m1m>

</a1m>

<a1m>

<m1m>

<po>101</po>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>2</m>

</yt3m>

</m1m>

</a1m>

<a1m/>

<a1m>

<m1m>

<po>100</po>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>1</m>

</yt3m>

</m1m>

<m1m>

<po>103</po>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>1</m>

</yt3m>

</m1m>

</a1m>

<a1m>

<m1m>

<po>101</po>

<yt3m>

<m>1</m>

</yt3m>

<yt3m>

<m>2</m>

</yt3m>

</m1m>

</a1m>

</ns0:mt1>

Target Structure is look like this.

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

<ns0:mt2 xmlns:ns0="urn:sap.shoprite.co.za:ecc:md">

<data>

<po>100</po>

<m>1</m>

</data>

<data>

<po>100</po>

<m>2</m>

</data>

<data>

<po>101</po>

<m>1</m>

</data>

<data>

<po>101</po>

<m>1</m>

</data>

<data>

<po>101</po>

<m>2</m>

</data>

<data>

<po/>

<m>1</m>

</data>

<data>

<po>100</po>

<m>1</m>

</data>

<data>

<po>100</po>

<m>1</m>

</data>

<data>

<po>103</po>

<m>1</m>

</data>

<data>

<po>103</po>

<m>1</m>

</data>

<data>

<po>101</po>

<m>2</m>

</data>

<data>

<po>101</po>

</data>

</ns0:mt2>

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I tested your mapping with below structure.

Source Structure


<?xml version="1.0" encoding="UTF-8"?>
<ns0:test xmlns:ns0="http://PurchaseRequest_Info">
   <M1M>
      <PO>100</PO>
      <YT3M>
         <M>1</M>
      </YT3M>
      <YT3M>
         <M>2</M>
      </YT3M>
   </M1M>
   <M1M>
      <PO>101</PO>
      <YT3M>
         <M>1</M>
      </YT3M>
      <YT3M>
         <M>1</M>
      </YT3M>
      <YT3M>
         <M>2</M>
      </YT3M>
   </M1M>
</ns0:test>

Output:


<?xml version="1.0" encoding="UTF-8"?>
<ns0:target xmlns:ns0="http://PurchaseRequest_Info">
<Data> 
 <PO>100</PO>
<M>1</M>
</Data>
<Data>
<PO>100</PO>
<M>2</M>
</Data>
<Data>
<PO>101</PO>
<M>1</M>
</Data>
<Data>
<PO>101</PO>
<M>1</M>
</Data>
<Data>
<PO>101</PO>
<M>2</M>
</Data>
</ns0:target>

Mapping Used:

Data Node: Y3TM- Context on Test Node.

PO Node: Pass output of One as many to PO. first input to one as many will be Source PO field and other two inputs will be Node Y3TM.

Map source M field as it is to Target M field.

-Gouri

former_member182412
Active Contributor
0 Kudos

Thanks for the reply it is working for me like this, the problem is if M1M does not exist but A1M exist always, so that situation we need to create target node with empty values, i also achieve changing the context change to A1M and map with default. my mapping is look like this.

PO(Context change to A1M)--


>mapWithDefault--


>

YT3M(Context Change to A1M)----->mapWithDefault--


> useOneAsMany

YT3M(Context Change to A1M)----->mapWithDefault


>SplitByValue--


>

This aslo working if M1M exist only one time for all A1M, but the problem is if one perticular A1M node got two M1M nodes and if first M1M got 3 nodes of YT3M, second M1M got 4 YT3M, for this situation in the first queue having two PO numbers for two M1M nodes without context change because i changed the context change to A1M for to get the null values for M1M (does not exist), even second queue also having 7 values without context change (3 for first M1M and 4 for second M1M).

so for this situation how can i add context change in first queue and second queue (splitting 7 values into 3 and 4).

Former Member
0 Kudos

Try this mapping for Data Node.

1. Take If then else.

2. If Y3TM Exists (Context on A1M)

3. then pass YT3M (Context on A1M)

4. Else pass A1M map with default

Lets consider output of above is "A".

Take Use One as many.

1. First input to One as many. "A1M Exists"

2. 2nd & 3rd Input to One as many will be value "A" which we obtained above.

Lets consider out of this as "B".

Now take if without else.

If condition will be "B".

Then condition will be A-Exsits

Output of If without else to remove context to data node.

I have tried this and its giving required output. Please check and let me know.

-Gouri

Former Member
0 Kudos

Hi.Praven

Try with this.

yt3m->mapwithdefault> removeContext--->data.

for target node po.

po-> mapwithdefualt--->

yt3m >mapwithdefault-> useOneAsMany--->po

yt3m---->