cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI mapping issue SAP ORDERS IDOC

christian_pichler
Participant
0 Kudos

Hi everybody,

I would need your input regarding a mapping issue.

My source message looks like this:

The OrderLineItems segment is on the same hierarchy level as the CouponItems segment.The OrderLineItem segment is used to create an E1EDP01 segment for each OrderLineItem segment (in this case 2). This is the content of the OrderLineItem segment:

There may be one or more discount(s) for the each order line item. This is the content of CouponItem:

If the content of ProductId in OrderLineItem (pos. 1: 139; pos. 2: 71) matches the content of Description in CouponItem a E1EDP05 segment (child segment of E1EDP01) should be created in the corresponding line.

In my example the second discount (31.65) belongs to the first position and the first discount (8.33) belongs to the second position.

The target message should look like this:

E1EDP01 (pos. 1)

E1EDP05 (discount 31.65)

E1EDP01 (pos. 2)

E1EDP05 (discount 8.33)

Does anyone have an idea how to map it properly?

Thanks in advance!

Christian

View Entire Topic
ambrish_mishra
Active Contributor
0 Kudos

Hi Christian,

ID is the key field common to both Order and Coupon items which are at same level. I hope the source is ordered by ID. If not, use an XSLT to OrderBy source by ID.

You can continue to map E1EDP01 the same way from OrderItems however, while creating E1EDP05, you may input the ID from OrderItems and CouponItems and compare the values and create the E1EDP05 segments when they match. The fields in E1EDP05 can be mapped with the same logic but with an output of the actual source values.

Hope it helps!

Ambrish

christian_pichler
Participant
0 Kudos

Hi Ambrish,

thanks a lot for your answer. Unfortunately the source isn't ordered by ID and I never used XSLTs...

Thanks

Christian

ambrish_mishra
Active Contributor
0 Kudos

Hi Christian,

There is always a start. XSLT is ideal for this. It is 5 lines of XSLT code and it should do the trick. If you are inclined, I can send some pointers.

Cheers!

Ambrish