Skip to Content
0

SAP PI mapping issue SAP ORDERS IDOC

Apr 06 at 06:08 AM

69

avatar image

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

same-level.jpg (23.1 kB)
coupon-items.jpg (27.7 kB)
line-level.jpg (70.4 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Peter Karg Apr 11 at 01:57 PM
0

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.

Show 1 Share
10 |10000 characters needed characters left 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.

Thanks,

Christian

0
Peter Karg Apr 12 at 12:57 PM
0

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


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Peter,

we don't have the license for the B2B addon... :-(

Regards

Christian

0
Ambrish Mishra Apr 12 at 08:41 PM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Ambrish,

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

Thanks

Christian

0

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

0