Structure Mapping in SAP AIF
Almost all integration scenarios require some sort of mapping to be performed. SAP AIF offers a flexible tool called Structure Mapping to handle that. It’s based on general concept of traversing the source structure from the root and drilling down to substructures and their fields. However it has certain limitations. One is that if in the source message at certain same level we have multiple structures, we can’t indicate in what order SAP AIF should process them. To be more specific, they are always mapped in alphabetical sequence.
Mapping in SAP AIF step by step
However there is a certain trick to specify for SAP AIF structures that should be processed ignoring the alphabetical order, at the very beginning. For that we use a mapping between dummy (blank) source and destination structures (marked in the picture below).
In this particular example for DEBMAS IDoc we would like to map fields of EDIDC structure before E1KNA1M and E1KNB1M so they can be used when mapping those two structures. Unfortunately standard processing will map it at the very end. Below is the dummy mapping that we’ll use to address that.
Then in Define Field Mappings we specify any structures we would like to be processed before the rest. In our case this is EDIDC structure.
Don’t forget to provide Sub-Table relevant to the mapped structure. In our case it is EDIDC.
Finally we can define our actual mapping for EDIDC structure (as Indirect Mapping) and for its fields.
As a result of this setting we make SAP AIF process the EDIDC structure at the very begging, before other structures. Now we can be sure that when we process the remaining structures they can use the already mapped fields of EDIDC.