cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping logic required

Former Member
0 Kudos

My source data looks like below,I want to created IDoc based on OrderNum

<Order> 1..unbounded
     <CustomerID>
     <MaterialID>
     <OrderNum>
</Order>

Suppose in my source data I have OrderNum then only IDoc to be created , if I have multiple orders then I have to sort based on CustomerID, the records which have same cutomer ID to send as a one Idoc, and reaming IDoc which have different CustdID send a one more IDoc.

<Order>
    <CustomerID>234</CustomerID>
    <MaterialID>12345</MaterialID>
     <OderNum>400</OrderNum>
</Order>
<Order>
    <CustomerID>111</CustomerID>
    <MaterialID>12345</MaterialID>
 </Order>
<Order>
    <CustomerID>235</CustomerID>
    <MaterialID>12345</MaterialID>
     <OderNum>400</OrderNum>
</Order>

For aboive output I want to individual IDocu2019s.

I changed IDoc occurance to 1 to unbounded, trying different ways in mapping, but runninbg without Luck

Accepted Solutions (0)

Answers (2)

Answers (2)

sugata_bagchi2
Active Contributor
0 Kudos

Hi ,

If I understood correctly, as per your requirement you want to create one IDoc per source Order node , if the Order structure is having the order number. This can be achieved by mapping the root IDoc node with createif function .

Ordernum -> exists-- >

and -


> createif ---> IDoc

ordernum->length-> greater

constant [0]

I think you also need to use the multiple IDoc at target side as you are receiving multiple Orders in the source.

use the XSD of the IDoc by extending the occurrence as 0..unbounded. If this is the case then you have to use node function remove context first to get the total number of ordernumber in the entire message then write a UDF where you will pass the length and using a for loop

for (int p=0;p<k;p++)

{

result.addValue(str[p]);

}

here k is the length of the ordernum queue.

you can generate the target IDoc node. Remember to handle the suppress values in the input queue for Ordernumber.

after this do a sort and splitbyValue [valuechange for the customer ID]

Hope it should work.

Thanks

Sugata

RaghuVamseedhar
Active Contributor
0 Kudos

Hi,

As far as I know, sorting and filtering can be done easily using XSLT mapping than graphical mapping.

Regards,

Raghu_Vamsee

Former Member
0 Kudos

you can use the 1-unbounded feature in the message mapping . Also map the customerID to the idoc root node . Use splitbyValue ( set the property to value change) .