Skip to Content

SAP PI mapping issue SAP ORDERS IDOC

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!


same-level.jpg (23.1 kB)
coupon-items.jpg (27.7 kB)
line-level.jpg (70.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 11, 2018 at 01:57 PM

    Just an idea if you don't want to create an UDF. For a similar request I used the concat function with key and value then I used the sort and with splitToIndex I got the value. If you do this for orderlineitem with product id and for couponitem with description and amount it could work.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Peter,

      thanks for your reply!

      Does your system offer a splitToIndex function or is this a user defined function? In my system this function is not available.



  • Apr 12, 2018 at 12:57 PM

    Hi Christian,
    there are some function libraries in the B2B Mapping KIT. And to make them avalaible in your Mapping you have to add the B2B Mapping in your Software Component Version in tab Details as Underlying Software Component Version.
    Then you can add those libraries in the message mapping in Used Functions Libraries, then save the mapping. Now you can select those functions. I don't remember if their was an extra upload for this. Regards Peter

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 12, 2018 at 08:41 PM

    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!


    Add comment
    10|10000 characters needed characters exceeded