Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
mert_oezkan
Product and Topic Expert
Product and Topic Expert
1,103

Introduction

Hello dear SAP Integration community,

In this Blog I want to show how to use one of the powerful features in Integration Advisor - the "Pre-Transformation". This feature allows to transform the source Message Implementation Guideline (MIG) structure which significantly simplifies the logic between source and target within the Mapping Guideline (MAG). 

In this case a shipment based advanced shipping notification which is a key document in collaboration between suppliers and customers is exchanged. A SOAP message is send from SAP S/4HANA which must be transformed to UN/EDIFACT and send to the specific Trading Partner.

Please note that the scope of this blog does not describe how to create and qualify MIGs. As a starting point you can refer to this blog: Create a customized interface using MIG editor

Real world challenge

The shipment on the source side consists of multiple item segments, one with the gross details, multiple with package details and multiple with product details. They are all on the same segment level.
However, one package can contain multiple products. And that is how the target side is expecting the content.

MicrosoftTeams-image (6).png

Ideally, we should transform the source message in such a way that we group all products together which belong to one package.

Solution

Looking at the source payload, for each PRD item an additional segment <HierarchyRelationship> is created pointing to the relevant PKG:

MicrosoftTeams-image (3).png

MicrosoftTeams-image (4).png

And that is the information we need to do the Pre-Transformation.

In this case we have following relationship:

PKG IDPRD ID
10150, 200, 160, 220, 230
70170
90180
110190
130210

So 5 Packages and 9 Products whereas one of the packages contain 5 products.

Let's jump into the MAG:
MicrosoftTeams-image (5).png

What do we want to do exactly? 
We want to copy the item segments qualified with PRD into the item segment qualified with PKG where the IDs are matching.
Which can be achieved by the following:

MicrosoftTeams-image (8).png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Simulation

Let's see what the result looks like. 

MicrosoftTeams-image (9).png

MicrosoftTeams-image (10).png

Here on the right side (After Pre-Transformation) we can see that inside Item (Package) another node has been created - Item_gq_PRD_Copy. The first package with ID=10 has 5 Item_gq_PRD_Copy elements (see the yellow highlighted area). Inside the first package the first product has the ID=150. Now let's look at the second product:

MicrosoftTeams-image (11).png
Here we can see that it has the ID=200. And this matches with the table above.

Conclusion

In this blog article we showed the powerful and easy to use feature of the Pre-Transformation, where we transformed the source structure in such a way that it matches the structure of the target which expects to group all products belonging to one package. 
Especially in this case, the Pre-Transformation helps to avoid building complex mapping logics which is also an essential aspect and which will be beneficial for operations.