Message Mapping concepts and introduction to Queues

By Nisheeta Naidu

Mapping is nothing but a set of rules, which are used to transform the source XML to target XML, based on the business requirements.

To understand the mapping concepts let me first explain the basics taking a simple example: 

A simple mapping in the graphical editor looks as below. The Age XML tag in the target structure is created for each Age tag in the source structure. 

Example 1

 

The color indicators for the XML messages has a specific meaning:

1.Green color indicates that we can map these XML tags according to our requirements

2.Red color indicates that these tags are mandatory and should not be left unmapped. 

Example 2

 

In Example 2 we can see that Age is an Element. Element is nothing but a simple XML tag. MT_Target is a Node. Node is a collection of XML tags.

What is Occurrence: Occurrence is nothing but the number of times a given xml tag appears in the xml document. Occurrences are defined in the datatype editor and a minimum and maximum occurrence is specified for each field.

Referring to Example 1 the occurrence of the source Age field should be similar to the occurrence of target Age field. Occurrence 1:1 indicates a minimum and a maximum occurrence of 1 i.e it should be present once.

For Address field the occurrence is 1: unbounded which means minimum occurrence should be once but maximum can be n number of times. 

Context and Context Handling: 

Context is nothing but the level or the hierarchy at which an XML tag is present in the xml document with respect to its parent node.

Context Handling can be achieved using Node functions like RemoveContexts and SplitByValue.

Context Changing can be done to shift the level of the xml tag during runtime. Example 3 shows this below. 

Initially by default the element first was under the node name and can be seen by right click and context.

 

The same can be seen in the text view as well 

 

Now I would like to change the context of the first tag to the root MT_first as shown: 

 

And the text view can be seen as : 

 

Queues In Message Mapping: 

 Message mapping works internally using Queues. Queues can be viewed at any step and can be used for debugging purposes at mapping level.

To see how Queues work let us consider the example below: 

XML Payload                                                 

-----------------                                                    

<MT_String>                                              
 <Start 1>
    <item> A </item>
    <item> B </item>
 </Start 1>
 <Start 2>
    <item> C </item>
    <item> D </item>
 </Start2>
</MT_String> 

Corresponding Queue Representation

The Queue gets filled as and when the values in the message arrive. If at any particular level there are no further elements present then a Context Change is inserted. 

The following Scenario explains in depth: 

 

 

 

 

The process flow for the above Fig is given below:

When we use the Display Queue for each of the step we can see that the element Name is filled by values Aditi and Binoy. It is compared with the constant and the condition is true only for value Binoy. Accordingly the FullAddress element will show only Delhi.
 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image