A multi-mapping is a mapping program that is not restricted to the transformation of one source message to one target message. You have the following options:
● You can use a multi-mapping in the transformation step of an integration process. In this case, the mapping runtime supports 1:n, n:1, and n:m transformations. You can map any number of source messages to any number of target messages.
● You can use a multi-mapping to map a message to multiple different (and generally smaller) messages during logical routing. Only a 1:n transformation is possible in this case.
As is the case for all mapping programs, to be able to configure the mapping programs for source and target operations, you need to assign a multi-mapping program to an operation mapping that you will use later in the Integration Directory.
Multi-mappings reference multiple message structures. To map these structures to one another, the mapping runtime gathers all the source messages of one multi-mapping in one source structure and all the target messages of one multi-mapping in one target structure. This means that instead of trying to map multiple messages to each other, you only have a source structure being mapped to a target structure.
You can generally implement a multi-mapping with all types of mapping programs. For simplicity, the following section assumes that you want to implement a multi-mapping as a message mapping.
Imagine the following are message types that you want to map to each other:
Message Types for the Source Structure
Message Type (Source Structure)
Message Type (Target Structure)
You can specify these message types on the Messages tab page in the mapping editor. You can also specify an occurrence rate for each message type. If the source or target structure can comprise multiple messages, the mapping editor creates a sub-structure for both the source and the target structure in which the source and target messages are stored. The root element is always <Messages> in a case like this. The mapping editor inserts an element <MessageN> for each source or target message, where N is the position of the message according to the Messages tab page. A message instance for the message specified above looks as follows:
There is a <MessageN> element for each message schema (for each message type here). The message type <OrderItem> can occur unbounded in the message instance as a sub-element of <Message2>. The numbers specify which elements in the multi-mapping are mapped to each other.
In your mapping, always add the namespace http://sap.com/xi/XI/SplitAndMerge to the root tag.
Example of a multi-mapping:
<?xml version="1.0" encoding="UTF-8"?>
At runtime, the message instances are collected in an integration process and then put in a structure. Once the mapping program has been executed, they are transferred to various message instances again.
By using an Operation-Mapping you can perform several mapping programs for the transformation of a request or response message in a series (for example, to reduce the number of required mapping programs in a system landscape). In these cases, an operation mapping consists of several steps. The steps are executed in the sequence specified (from top to bottom). The result of the mapping program from the previous step is forwarded to the mapping program of the subsequent step. Each step can reference a mapping program that executes a 1:1, 1:n, n:1, or an m:n transformation.
The following is important for multi-mappings (1:n , n:1, or m:n-transformations):
● The preceding step must produce as many message as the following steps expects.
● Multi-mappings, as shown above, use one envelope to put all messages in one structure. If one of the steps references a multi-mapping program, all subsequent steps must use the same envelope.
The mapping for a request message comprises two message-mapping programs: one 1:1 transformation and one 1:n transformation. Since the latter message mapping uses the multi-mapping envelope for both the target message and the source message, the message mapping for the 1:1 transformation must also create a transformation result with a multi-mapping envelope.
If you specify multiple source or target messages in the mapping editor, the mapping editor immediately displays the source or target structure described above in the structure overview. The mapping editor supports the following message schemata for multi-mappings:
● IDocs, RFCs (request-, response, or fault messages), see Importing IDocs and RFCs
● Message structures from external definitions
You can also develop multi-mappings as external mapping programs by exporting the message schema of the request message from an operation mapping.