Skip to Content

Introduction

During my work in AIF development I sometimes get questions from customers asking how different functionalities are working or what the best way is to solve a specific requirement with SAP Application Interface Framework. From time-to-time I like to describe the solutions to the most common problems in How-To-Guides.

Problem Description

You want to use a value mapping for a specific field. This value mapping should only be executed if a qualifier field contains a certain value. If the qualifier does not contain this value the field should be mapped directly from source to destination field without executing the value mapping.

How does it work?

You need to perform the following steps to be able to execute the mapping correctly:

  1. Create a field mapping. Map source to destination field
  2. Create a conditional mapping for the field mapping
  3. Select Alternative Value Mapping / Field Name as Condition Type
  4. Add your value mapping
  5. Add the check and enter the to be checked field in Field Name 1
  6. Save!

The following example will describe step-by-step how to setup the field mapping for this scenario.

Example

This example uses the SAP flight booking example. We receive bookings from several travel agencies. Most agencies send the flight bookings with the correct mapped values for field class (B or P). One of the agencies (ID 1) always sends X for private flights in there bookings. For most of the cases a 1:1 mapping of field CLASS would be perfectly fine. For the agency with ID 1 this will not work. We need a value mapping for field CLASS for all bookings send by agency ID 1 instead of the 1:1 mapping of the field.

1. Create the field mapping

In the AIF customizing open your interface in the define structure mapping activity and navigate to the structure containing the field you want to map. Create the 1:1 mapping for this field. Select the field in the destination structure and select the field from the source structure in field Field Name 1.

2. Create condition

Create a condition for the newly created field mapping. Double click on define condition in the menu on the left hand side and create a new entry. In case our condition is applicable we like to execute an value mapping as alternative. Therefor the condition type is set to Alternative Value Mapping / Field Name.

3. Add value mapping

In field Namespace / Alternative Value Mapping enter your value mapping (or create a new one).

4. Add Check

In field Namespace / Check enter your check (or create a new one). Within the check we do not want to check the value of field CLASS instead we want to check the value of field AGENCYNUM. To be able to execute the check with the correct field AGENCYNUM has to be selected in field Field Name 1.

Do not forget so save your changes!

Check the result: send a new message and verify if the value mapping / mapping is executed correctly.

To test the mapping is used the AIF test tool.

Mapping result for test file executed with TRAVEL_AGENCY = 00000001:

Mapping result for test file executed with TRAVEL_AGENCY = 00000002:

This is one possibility to achieve such a mapping.

Summary

This blog post gave an introduction on how to use a conditional mapping combined with a check and a value mapping. By using a check to determine if the value of the field should be mapped directly or via a value mapping the value of the field can be determined depending on the field value. For instance, this can be used to map values for specific org units differently.

 

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply