In this mapping series I will try to explain how to do different types of structure mappings in AIF. AIF’s mapping engine works in a different way as SAP PO, Service/SOA Mapping Tool (SMT) and Business Connector so it would be good to understand how to use it properly in your new integration projects. In case you’d know a different way (easier/better, etc.) to solve the same requirement as shown in the article please post a comment so we will have a single source where all AIF mapping best practice is shown.

Requirement

There are situations where we need to create two or more lines from a single input line. A typical example of such a case might be when we need to map an input structure to an IDOC with multiple qualifiers. How to do this sort of mapping in AIF ?

Example

Imagine we have a table structure with two types of rates – rate type M and rate type B are available in a single row or this structure as shown on Figure below. I’m using the exchange rate example as it’s available on most of the SAP application systems.

/wp-content/uploads/2016/08/picture_1_1011062.png

We need to map this to the standard IDOC with exchange rates where each rate needs to be mapped as a single row with a rate type (M or B) as a segment qualifier.

/wp-content/uploads/2016/08/picture_2_1011064.png

This means that for each row of the input structure we need to create two rows in the IDOC struture – E1BP1093_0.

Step 1

We need to start by creating a target structure for E1EXCHANGE_RATE as shown in Figure below.

/wp-content/uploads/2016/08/picture_3_1011068.png

Step 2

In the Field mapping for this structure we need to define how many times should the E1BP1093_0 structure be created. In our case we want to create it as many times as rows in the RATES table so we need to define this in the subtable. Subtable works in such a way that for every entry in the subtable a destination structure will be created.

/wp-content/uploads/2016/08/picture_4_1011069.png

Step 3

In the next step we need to define the two indirect mappings one for each rate type (M and B). This is because we want to create twice as many times target structures E1BP1093_0 as source RATE structures (one for each rate qualifier).

/wp-content/uploads/2016/08/picture_5_1011070.png

Step 4

Now for each of the indirect mappings we need to do the „real” field mapping. For the example we will only map “rate type” and „from currency” fields. The figure below shows the mapping of rate type M but you’d need to do the same for rate type B in the second indirect mapping of E1BP1093_0.

/wp-content/uploads/2016/08/picture_6_1011067.png

Testing

After we’d done with the mapping we can use the AIF testing tool to test if the mapping works correctly. The source structure contains two rows, each with two types of rates (M and B) as shown in figure below.

Picture_7.png

The target structure contains twice as many rows as the source structure due due to the requirement which was saying that each of the rate types needs to be created as a seperate segment E1BP1093_0.

Picture_8.png

I hope the example will be useful for those starting with AIF mappings and if you’d have any comments please do let me know.

Other AIF mapping resources:

Interface builder by Nicole Goeddelmann


AIF field mapping for nested structure by Mateen Popatia


Further reading on AIF:

SAP Integration Enterprise Service Monitoring – SOA/AIF/FEH monitoring for business/module consultants

Serializing Interfaces in SAP AIF – for technical consultants/developers

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

    1. Michal Krawczyk Post author

      Hi Manik,

      Thanks for your feedback 🙂 I’m thinking the same thing, mappings are the most common and there’s a small lack of resources compared to thousands of mappings blogs in SAP PO space 🙂

      Best Regards,

      Michal Krawczyk

      (0) 
  1. Christian Wille

    Hello Michal,

    Nice example, I already made this experience, that every structure mapping inserts a new line. However, I have a case where I need it exactly the other way round: I want to update DELVRY01, and I need 2 structure mappings per item line, in order to simulate an access sequence. But awkwardly, AIF duplicates the line then! Do You have a workaround for this?

    (0) 
  2. Rahul Shrivastava

    Hi Michal,

     

    Nice example. Do we have provision in AIF mappings where we can map one destination structure fields to multiple source structure fields ?

    for example :

    we have destination structure as :RAW ROOT STRUCTURE-> DEST

    and we have source structures as: SAP ROOT STRUCTURE-> SOURCE1 and SOURCE2.

    Can we map 3 fields from SOURCE1 to 3 fields in DEST and 3 fields from SOURCE2 to 3 fields in DEST ?

    I am trying to do field mapping of SAP ROOT STRUCTURE like below.

    Field mapping 1 (as sub table): SOURCE1 ->DEST

    Field mapping 2 (as sub table): SOURCE2 ->DEST.

     

    But i am not able to do Field mapping 2. it says already DEST (as key field) exists.

    Not sure how can we map fields from multiple structures into one single structure?

     

    Can anyone please help?

     

    Thanks in advance.

    Regards,

    Rahul Shrivastava

    (0) 
  3. Venkatesh Pendekanti

    Hi,

    I configured field mapping and value mapping, to set a default value for a particular field if it is blank. But I’m not able to see the value in the Message queue generated in /AIF/ERR transaction. Please let me know the solution.

    (0) 

Leave a Reply