Blog > Michal’s Tips: AIF mappings explained ” #1 ” Multiple qualifiers

Michal’s Tips: AIF mappings explained ” #1 ” Multiple qualifiers

Michał Kowalczewski Int4 IFTT Product Manager, SAP Press Author
icon__calendar 2016-08-08

SAP AIF mappings

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.

SAP AIF mappings change structure

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.

SAP AIF Exchange rate

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.

SAP AIF target structure

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.

SAP AIF subtable

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).

SAP AIF indirect mappings

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.

SAP AIF real field mappings

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.

SAP AIF mappings testing

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 separate segment E1BP1093_0.

SAP AIF target structure

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

Other AIF mapping resources:

 


Michał Krawczyk – SAP integration consultant since 2004. He has been recognized by SAP included becoming an SAP Mentor in 2007 and winning the top contributor/topic leader award from SDN (SAP Developer Network portal) in SAP PO/PI eight times. Michal is the author many SAP integration related books.

Michał Kowalczewski Int4 IFTT Product Manager, SAP Press Author
SAP integration consultant & architect, team leader and project manager since 2005. Experienced in all leading SAP integration technologies (SAP PI/PO, ALE, HCI, BRF+, Enterprise Services, ABAP). Int4 IFTT Product Manager. In the past he was also involved in SD and CRM consulting. Accomplished more than 20 projects, both full cycle implementation and improvement projects. He holds a master?s degree in computer science and econometrics and is an SAP-certified solution and development consultant as well as SAP PRESS author. Business integration improvements, highly focused on the business processes, deep knowledge of ECC backend and SAP configuration (ALE, SD, MM, FI), advanced ABAP and PI/PO programming, strong leadership & management skills.

Contact us

If for any reason, the thought of reaching out to us has crossed your mind, then by all means do not hesitate to get in touch with us, as we are more than happy to put to rest all of your concerns.