In message mapping, different message structures are mapped to each other. The mapping is supported by a graphical mapping editor. The editor enables you to design a structure mapping between any two XML structures.
The mapping editor generates Java source code from the graphical mapping description that is then compiled and packed in a JAR file that the PCK executes at runtime.
For examples of message mappings, see Example Message Mappings.
The mapping editor can load the following schemas to the structure overview:
● XML schema definitions (XSD) or XML files from a local file
● Schemas from another PCK
In the case of XSD files, the mapping editor generates an XML representation for both the source structure and the target structure. If the XSD file contains more than one global element, use a dialog box to select one global element as the root element.
If you want to load several XSD files that reference each other using the import and include XSD statements, you must first pack the files into a Zip file. If the file contains more than one global element, you must select one global element as the root element in this case as well.
Once you have created a message mapping the system navigates to the Definition tab page of the mapping editor. The figure below shows the screen areas of the mapping editor (the tab page was detached from the PCK beforehand):
You have the following options when defining a message mapping:
● The functions in the Object Toolbar relate to the entire mapping. For example, you can save your mapping or automatically assign fields with the same name to each other.
● When you create a new message mapping the Structure Overview in the mapping editor is initially empty. You must import an XML or XSD file for both the source structure and the target structure. The mapping editor reads the data and displays an XML representation for the mapping in the Structure Overview: In this screen area, the source structure is on the left and the target structure is on the right. Source structure fields then have to be mapped to target structure fields. You have various options for displaying the source and target structure (Tree View, Tabular Tree View, display as a text document, or display in the browser).
More information: Structure Overview
● The structure overview is closely linked to the Data-Flow Editor, which you use to describe the mapping of one or more source fields to one target field. This type of mapping is also referred to as a Target-Field Mapping. If a field in the target structure has already been mapped, you can navigate to the relevant mapping by double-clicking the corresponding target field in the structure overview.
A message mapping consists of various target-field mappings. Once you have defined a mapping for each mandatory target field, the message mapping is complete. To test your message mapping, navigate to the Testtab page.
More information: Test Environment
Function |
Use |
Select Message |
Loads schemas for source and target messages into the structure overview. |
Map Selected Fields and Substructures if Names Are Identical |
Before you execute this function, first select one node in both the source and target structures that belong to each other. You can then automatically assign sub nodes that have identical names (names are case-sensitive here). This function is particularly useful for simple mappings. |
Delete Mapping |
Deletes all target-field mappings. |
Data-Flow Editor |
Use these buttons to switch between the data-flow editor and the text preview in the lower area of the data-flow editor: ● In the data-flow editor, you edit target-field mappings. ● You use the text preview to display all target-field mappings and the functions that they use, as text. Lines in red indicate missing target-field mappings. The quick info for a green target field displays the corresponding mapping.
|
Text-Vorschau |
|
Dependencies (Display Display All Hide All) |
Use this function to display graphically which source fields are assigned to which target fields in the structure overview. These denote the following: ● Red: The source field is directly assigned to the target field. ● Green: A sub node of the source field is assigned to the target field. ● Blue: The source field is assigned to a sub node of the target field. ● Black: A sub node of the source field is assigned to a sub node of the target field. |
Function |
Use |
Import |
Imports schemas |
Export |
Exports schemas |
Delete |
Deletes the message mapping object and all receiver agreements in which the mapping object is specified |
Within the structure overview and in the data-flow editor, you can call functions in the context menu. For all fields (in the data-flow editor and in the structure overview on both the Design and Test tab pages), you can copy the path for a field to the clipboard by choosing the context menu option Copy Path.
To define a mapping between two XML structures, proceed as follows:
...
...
1. Create a message mapping in the Mapping area in the PCK.
More information: Creating Objects
2. Load a source structure and a target structure by using the search help in the mapping editor.
For messages from external definitions, note that the mapping editor does not support the entire language range of XSD. For more information, see SAP Service Marketplace at service.sap.com/xi → Media Library → Documentation: SAP XI 3.0 (SP11) – Supported XML Schema and WSDL (EN).
3. Using the structure overview and the data-flow editor, assign one or more source fields to a target field. A mapping of this type is also referred to as a target-field mapping. It is also possible to assign one source field to multiple target fields.
More information: Assigning Fields
4. If necessary, enhance the target field mapping in the data-flow editor. To do so, connect the source fields to the target fields by using the standard functions of the mapping tool. You can also create user-defined functions in Java in the mapping editor and then also use them in the data-flow editor.
More information: Data Flow Editor, User-Defined Functions, Standard Functions
5. Carry out the last two steps for all mandatory target fields at least.
The mapping is complete and ready for testing when all the fields in the target structure have either green or white icons. A yellow icon indicates that a target-field mapping is incomplete, whereas a red icon indicates that target fields are unassigned.
More information: Test Environment