Mapping Multiple Messages

Objective

After completing this lesson, you will be able to map multiple messages

Multi-Mapping Configuration

You use mapping programs to create 1:1 mappings between source and target messages. However, there might be scenarios where you would need to use mapping programs to process multiple messages.

You create the actual multi-mapping in the mapping editor.

Hint

Provided the required schemas are available, you can also create a multi-mapping in Java mappings, for example, by exporting the data from ESR.

Multi-Mapping Options

  • n:1

    You can use this mapping to combine multiple messages into one message. For example, multiple purchase orders are combined to make a single purchase order.

  • 1:n

    You can use this mapping to split a large message into multiple individual messages. For example, one large purchase order is divided into individual purchase order items.

  • n:m

    You can use this mapping to transform n source messages to m target messages.

Multi-Mapping Message Structure

Multi-mappings reference multiple message structures. You place all source messages in one source structure and all target messages in one target structure. The mapping program is executed between a source structure and a target structure.

Multi-Mapping at Configuration Time

The figure, Example of an n:m Multi-Mapping, shows the concept of multi-mappings.

In the figure, the mapping program creates the values of the target message types Order and OrderInfo from the values of the source message types OrderHeader and OrderItem. Here, only an n:2 mapping is executed. On both sides, the message types are under the root element Messages (the name cannot be changed), and under the elements Message1 and Message 2. The sequence is specified by the configuration in the message editor.

Configuration of an n:m Multi-Mapping in the Mapping Editor

The figure, Configuration of an n:m Multi-Mapping in the Mapping Editor, shows the procedure for configuring an n:m mapping in the mapping editor.

Depending on the sequence in which you inserted message types in the input field on the Signature tab page, the messages are made available in the structure overview on the Definition tab page. In the next step, you define the mapping program in the data flow editor.

There are some restrictions on the source and target messages that you reference from a message mapping. The source and target messages can be in a software component version (SWCV) different from the message mapping, but both the source and target messages must originate from the same SWCV and, if applicable, underlying SWCV.

Multi-Mapping in an Integrated Configuration

You may reference a multi-mapping in an Integrated Configuration.

The operation mapping used in the Integrated Configuration must reference an 1:n multi-mapping program, which ensures that a single message is split into individual messages in a message split.

Bulk Message in an Integrated Configuration

If the mapping program contains substructures or fields with an occurrence of 0 to unbounded and one message is to be created for each instance, you can use multi-mapping to create individual messages. The mapping program bundles these individual messages into one bulk message and transfers it to the Adapter Engine. The Adapter Engine splits the bulk message into individual messages again, as shown in the figure, Bulk Message in an Integrated Configuration with Multiple Receiver Interfaces.

The mapping defines a message header with a receiver interface for both the bulk message and the individual messages. The message header may be different for each individual message.

For a mapping based message split, the same Adapter Engine must send the messages. Messages created in the message split do not contain the original message attachments.

Use Multi-Mapping

Business Scenario

You are a PI developer and you need to split a message using multi-mapping.

Create and use a multi-mapping in a message mapping named PurchaseOrder_split to split the source message type PurchaseOrder. PurchaseOrder contains the Header and Item details. Create two target message types, one each for PurchaseOrder_Header and PurchaseOrder_Item using multi-mapping.

Exercise Information

Note

In this exercise, when the values include ##, replace the character with a two-digit number (01–30).

Exercise Options

You can perform this exercise in two ways:

  1. Live Environment: choose Start Exercise, and from the entry page choose Open PDF Document. Follow the steps described in this pdf in your own system landscape.
  2. Simulation: choose Start Exercise, and from the entry page choose Start Tutorial. Watch the step-by-step instructions within the simulation.

Note

We recommend running the simulation first.

Task 1: Create and Use a Multi-Mapping

Steps

  1. Create a message mapping named PurchaseOrder_split.

    1. In the object navigator, expand SC_BIT_MAP of educationsap.comSC_BIT_MAP 1.0 of educationsap.com.

    2. Select http://educationsap.com/pi/mapping##.

    3. Choose (Create Object).

    4. In the Create Object window, choose Mapping ObjectsMessage Mapping.

    5. In the Name field, enter PurchaseOrder_split.

    6. Choose the Create button.

  2. Specify the source message type as PurchaseOrder and the target message type as PurchaseOrder_Header. These Message Types are available in the SC_BIT_BASE_COMP.

    1. On the Signature tab page, in the Source Message(s) screen area, open the input help for the Name field.

    2. In the Choose Message Type dialog box, select PurchaseOrder.

    3. Choose the Apply button.

    4. In the Target Message(s) screen area, open the input help for the Name field.

    5. In the Choose Message Type dialog box, select PurchaseOrder_Header.

    6. Choose the Apply button.

  3. Specify an additional target message type, PurchaseOrder_Item, and set the occurrence for both target message types to 0..unbounded.

    1. In the Target Message(s) screen area, choose (Insert Line Below Selection).

    2. In the new line, open the input help for the Name field.

    3. In the Choose Message Type dialog box, select PurchaseOrder_Item.

    4. Choose the Apply button.

    5. In the Occurrence field for both message types, enter 0..unbounded.

  4. Connect the source and target fields.

    1. On the Definition tab page, choose (Show/Hide Header Area).

    2. Drag the Header source structure to the PurchaseOrder_Header target structure.

    3. Drag the Item source structure to the PurchaseOrder_Item target structure.

    4. Select the Header and PurchaseOrder_Header structures and choose (Map Selected Fields and Substructures if Names are Identical).

    5. In the Apply Mass Mapping dialog box, choose the Apply button.

    6. Select the Item and PurchaseOrder_Item structures, then choose (Map Selected Fields and Substructures if Names are Identical).

    7. In the Apply Mass Mapping dialog box, choose the Apply button.

  5. Specify the Messages context for the Item source field and the PurchaseOrder_Header target field.

    1. In the data-flow editor, in the context menu of Item, choose ContextMessages.

    2. Double-click the PurchaseOrder_Header target field to load it into the data-flow editor.

    3. In the data-flow editor, in the context menu of Header, choose ContextMessages.

  6. Save the message mapping.

    1. Choose Save.

Log in to track your progress & complete quizzes