It was initially very hard for me to understand the message mapping when we are trained on SAP XI.I browsed help.sap.com and ended up getting more confused. After working with SAP XI for some time however the intuition is changed. I will try to simplify the message mapping by elucidating the concepts in the nutshell. Blog does not cover the message mapping in detail but just gives the basic understanding for any new XI developers. Part 1 of the blog provides a base for conceptual understanding of message mapping with suitable examples.
As we know XI produces the XML documents at the inbound/outbound of the integration pipeline, there is a need for us to map the source XML doc to the target XML doc. Message Mapping editor is a built in feature, which helps to map the source and target XML messages graphically.
In this blog we discuss various terms related to it.
Definition: Message Mapping
Firstly, let me define the message mapping in the way I look at it:
“Message Mapping is nothing but a set of rules for producing target XML from the source XML.These rules are nothing but relations between the source XML tags and target XML tags”.
These rules keep varying according to the business requirements on the source and target XML documents.
Sample Rule :
Illustration of Mapping Error:
Before we proceed further it is better if we have a clear understanding of the 3 terms:
: Simple XML tag.
: Property of XML tag.
: Logical grouping of set of XML tags.
In XI it is represented as shown below:
XML representation in XI:
Additionally there is color indicator for the target XML messages:
indicates that target nodes/elements/attributes are mandatory and has to be definetly mapped.
Green Color with a red circle
at the bottom indicates that there is a minimum occurrence specified for the tag which has to be met in the mapping.
indicates that we can map the nodes/elements/attributes according to the requirements.
Color Indication in the Mapping Editor:
Contexts in Message Mapping:
Once the above concepts are clear we can proceed to the most confusing part of message mapping called “Context Handling”.
Initially when I was browsing through the training materials and mapping patterns it was really hard for me to exactly figure out what the term “Context” means. (Forget about context handling and context changing).
After working out few examples I figured out that: “Context of an element is nothing but just the level (with reference to its parent node) where the XML tag appears in the given XML document”.
Level of any element is set to the immediate parent node by default.
Definition: Context Changing
Once the definition of context is very clear the rest of the terms are automatically clarified.“Context Changing is just changing the level of XML tag (element level in the XSD) in the XML document or It is just the flexibility provided by XI for changing the XSD of the XML document at the runtime”. Example given below might make you to understand it better. I added a
element in the source data type and one
element in the target data type.
The context of the
tag is automatically set to the
by default in XI which means that always
XML tag occurs under
XML tag as shown below.
Source XML message interpretation by the Mapping runtime before context change:
I changed the context of the
tag to the root
XML tag as shown below.
Source XML message interpretation by the Mapping runtime after context change:
Definition: Context Handling
Contexts in XI can be handled by various ways like
node functions, advanced functions
, which will be, illustrated more in detail in the next blog. We also have queuing mechanisms for handling complex Context Changing in advanced user functions.
Once the above concepts are clear , working with the message mapping and trouble shooting any errors that occurred became relatively very easy for me. Part II will provide some more good examples for playing around with message mapping feature
provided by XI.