Mapping Structure and Field Mappings

Objective

After completing this lesson, you will be able to effectively understand and configure Structure and Field Mapping.

Source and Destination Structure and Field Mappings

Interface development flow diagram with con for each stage, the mappings icon is highlighted to indicate that we are covering this step.

Mapping is one of the central parts of SAP Application Interface Framework. It happens quite seldom that a partner can deliver data in the way the SAP system needs, or SAP can deliver it in a way the partner needs it. So, often, we have mappings.

The first step is always to tell which field in the source structure shall be used for which target field. This is called the structure mapping.

If the relevant field is found, it might be usable directly. But it's also possible that we have to convert it, for example, $ to USD or 10.05.2019 to 20191005. This conversion is called value mapping. If a source structure can not provide a field at all, we might have to set fixed values or look it up in a table.

Additionally, SAP Application Interface Framework gives us the possibility to use conditions and have different mappings depending on those conditions. This makes it possible to use a special field if a fit exists, and use a more global field if not.

Structure mapping is done via Define Structure Mappings in SAP Application Interface Framework Customizing. The structure mapping activity contains different steps. These steps are described in a subprocess.

Structure mapping steps as outlined in the steps 1-8 below

The source and destination structure of an interface usually differ. Therefore, structure mapping is needed. The structure mapping defines how the data from the source structure should be passed to the destination structure. To achieve this, some other SAP Application Interface Framework objects (for example, checks, value mappings, or fix values) are needed for structure mapping.

  1. Source Structure: Select the source structure.
  2. Destination Structure: Assign the destination structure corresponding to the source structure.
  3. Field Mappings: Map matching fields from source to destination structure.
  4. Checks: Create checks.
  5. Value Mappings: Derive a value from other values.
  6. Fix Values: Assign a fix value to a field.
  7. Conditions: Create a condition.
  8. Actions: Create an action to be executed during the processing of the interface.

Source Structure

Structure mapping Steps with source structure highlighted.

To map structures, you need to select the source structure.

The source structure can be the root structure or any substructure or subtable of the root structure.

Depending on whether the processed interface is inbound or outbound, the source structure is:

  • The raw data structure or a substructure/-table of it if the interface is an inbound interface
  • The SAP data structure or a substructure/-table of it if the interface is an outbound interface

Destination Structure

Structure mapping Steps with destination structure highlighted.

The destination structure can be the root structure or any substructure or subtable of the root structure. It needs to be the counterpart of the previously selected source structure.

If the mapped structures are identical, you can map the fields of the structure via the Move Corresponding Fields functionality. Separate field mappings are not required in this case but can be added if needed.

If you select the Move Corresponding Fields checkbox, the complete structure including the substructure and subtables are mapped.

If you select the Copy Fields only checkbox, in addition to the Move Corresponding Fields checkbox, only the fields are mapped.

Field Mappings

Structure mapping Steps with field mapping highlighted.

If the structures are not identical, field mappings are required to map the different fields from the source structure to their counterparts in the destination structure.

A field in the destination structure can be build out of up to five fields of the source structure.

Field mapping diagram to supplement explaination below.

You have to map the fields of the source structure to the fields of the destination structure. You do this via field mappings.

To create a field mapping, at least the field in the destination structure and the field name of the source field is required. All other options are not mandatory.

In a field mapping, you can maintain the following information:

  • Field in Destination Structure: Defines a field in the destination structure to where the data is mapped.
  • Source Fields: You can insert up to five fields as source fields in the field name. The fields contain the name of a field in the source structure. These fields can also contain the field names of a destination structure field. In case a destination structure field was selected, an @ sign must prepend the field name. The defined fields are available as parameters and can be used in value mappings or checks. An offset and a length can be defined, as well as a separator string. The contents of the field name fields are split by this character or symbol in the destination structure. If multiple field names are maintained and no further settings are made, the values of the fields are concatenated into the destination field.
  • Offset and Field Length: Specify the offset and field length of the data that should be passed into the destination field.
  • Field Name for Data Link: If multiple fields are maintained in field name 1 to field name 5, this field indicates to which field an error should be linked in Monitoring and Error Handling if an error occurs during field mapping. If only field name 1 is maintained, this field is used automatically to create the link.
  • Value Mapping Function: Maintain a function module for a value mapping.
  • Value Mapping: The fields defined in field names 1 to 5 are available as parameters for the value mapping. To make use of the parameter, you have to insert '$<Fieldname number>' in an appropriate field in the value mapping. At runtime, '$<Fieldname number>’ is replaced by the current value of the field. They can be used in a "where" condition or in a value mapping function defined in this value mapping. If an error message was defined in the value mapping, the fields can be used to replace placeholders in the error message as well. Furthermore, they can be used as external values for a single or multiple value mapping table. If you enter a name of a value mapping that does not exist, the system offers you the opportunity to create the value mapping.
  • Data Element for Conversion/Conversion Routine/Direction of Conversion Exit: Enter the conversion routine (for example, ALPHA) in the Conversion Routine field. Maintain the direction of the conversion in the Direction of Conversion field. Instead of entering a conversion routine, you can also insert a Data Element for Conversion (for example DATS).
  • Namespace / Check: You can enter the namespace and name of a check here. The check is executed during field mapping. If the check fails, the field mapping will also fail. Per default, the data in field in Destination Structure will be checked. Select the Check Before Mapping checkbox to check the source data.

You can enter a fix value directly in the Field Name field. If a fix value should be entered in one of the source fields, you require a % followed by the value. For example, if the fix value for the field is 5, the field input has to be %5.

Screenshot of the /AIF/IFTEST transaction.

The SAP Application Interface Framework provides a tool to test interfaces. The tool can be started via the /AIF/IFTEST transaction. Create a test file for your interface. Test transformation from source to destination structure. Process test data.

How to Create and Test Structure Mapping

Watch this demo to learn about creating and testing mappings for a sales agent structure using simple mapping techniques. Explore how to efficiently move data between interfaces and validate the mappings using the SAP Application Interface Framework test tool. Follow along to enhance your understanding of mapping functionality and testing processes.

How to Create Field Mappings

Watch this demo to discover the process of creating and testing mappings for different data structures. Explore the mapping of customer fields with a 1:1 approach and test the mappings using the SAP Application Interface Framework Interface test tool. Learn about various testing methods to validate data transfer accuracy and monitor errors effectively.

Checks

Structure mapping Steps with checks highlighted.

Checks are used to verify that the content of a specific field is true or false for the given input, to identify if a specified condition is true or false for the given input values. Checks can influence the processing in SAP Application Interface Framework.

You can assign checks in different places, for example, to conditionally skip a specific mapping step, to conditionally execute a specific function of an action, or to identify application error situations in which the processing should be stopped immediately.

In the SAP Application Interface Framework, a check has a well-defined input (up to five field values) and a well-defined output (a success checkbox indicating the result of the check), and they remain independent of the context in which they are used. As a result, checks can easily be reused by several interfaces in the SAP Application Interface Framework.

You can create a reusable check in SAP Application Interface Framework Customizing via the Define Checks Customizing activity. There are some simple field checks that are already predefined, for example:

  • Check if the field has only numeric values, is not empty, contains only capitals, and so on.
  • Check for allowed characters.
  • Define an operator together with a pattern for the field check.
  • To check the data from a database table, you have to fill the Table Name and Where Condition for Select Statement fields. In the case of a database check, you have two options:
    • Verify the existence of an entry in the database.
    • Verify that a field in the entry found on the database has a specific value.
  • If a function module should be used to check the data, it must have the same signature as the /AIF/FILE_TEMPL_CHECK template function module provided.
  • One reusable check can consist of multiple single checks. These single checks are concatenated with "OR", which means that if one of the single checks is successful, the complete check is regarded as successful.

Define specific error and success messages for checks in SAP Application Interface Framework to provide detailed feedback. Error messages can be customized during check creation by defining the message class, number, and variables. Success messages can also be tailored per check by specifying a message class, number, and variables.

Which Level Can a Check Be Used On?

Flow diagran showing how structure level checks can be set up on two levels. The details of the checks are outlined below.

Structure Level Check:

  • Define checks in SAP Application Interface Framework Customizing under the Assign Checks activity.
  • Specify the data structure to be checked (raw or SAP) and error behavior (ignore data or treat as error).
  • Choose between using existing checks or creating new ones.

Field Level Check:

  • Define checks in Define Field Mappings Customizing activity.
  • Use existing checks, or create new ones.
  • Specify whether the check should be executed before or after mapping.
  • If you want to include a constant value, use "%<value>" in the fields.

There Are Two Possibilities:

Ignore data if check is not successful. If the check fails, the current line is ignored and processing continues. An information message is added to the application log (depends on the trace level).

Treat as error if check is not successful. If the check fails, processing is stopped at the current line. An error message is posted to the application log.

How to Create a Check Without Error Messages

Embark on this demo to create various checks and adjust values based on the outcomes from these checks. Discover how to prevent duplication of sales agent data by implementing field checks and ensuring data integrity. Follow the steps to set up checks effectively and test your configurations using the SAP Application Interface Framework test tool for reliable results.

How to Create a Check with Error Messages

Watch this demo to explore the process of validating data existence through checks and implementing user-specific error messages. Discover how to ensure data accuracy by verifying the presence of entities like travel agencies and handling errors effectively. Follow along to set up checks, configure error messages, and test the mapping process using sample data.

Fix Values

Structure mapping Steps with fix values highlighted.

In SAP Application Interface Framework, fix values are used in structure and value mappings to assign a constant value to a field in the destination structure. Additionally, they can also be used in checks to refer to a constant value.

A fix value can be defined:

  • On namespace level
  • In the structure mapping
  • In the field mapping

Fixed value defined on namespace level can be used in different interfaces. You can use fix values out of a different namespace in an interface.

You can assign a reusable fix value, which is defined on namespace level, and assign it to the structure mapping. Alternatively, you can define a fix value directly in the structure mapping of an interface. If you do both the reusable fix value will be taken.

Reusable fix value on namespace level and assign it to the structure mapping. This has the advantage that, once the value has to be changed, there's only one place that has to be adapted.

You can specify a fixed value via SAP Application Interface Framework Customizing in the Define Fix Values activity. You have to define a name, description, and the value.

Example

You have several interfaces where customer data (orders, flight bookings, and so on) is processed. Currently, every customer gets a discount of 10%. Therefore, a corresponding reusable fix value is assigned to the interfaces. The discount is then changed so that the customers only get a 5% discount. Since you have defined the fix value as a reusable fix value, you can simply change this fix value in one place and all your interfaces use the correct discount.

How to Create a Fix Value Mapping

Watch this demo to witness the creation of a fixed value mapping for customer discounts, ensuring data consistency and accuracy. Follow the steps to set up the fixed value, test the mapping using the SAP Application Interface Framework test tool, and, optionally, process the data to observe the results in the Interface Monitor.

Log in to track your progress & complete quizzes