cancel
Showing results for 
Search instead for 
Did you mean: 

About context change

Former Member
0 Kudos

We can do the context change in the mapping, how to know us we change the context to that particular segment.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

To know to which level you have to change the context depends on the source structure and input.

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.

All the nodes and elements that belong to the same parent node are said to be in the same context.

http://help.sap.com/saphelp_nw70/helpdata/en/bd/ca1105c81c6742a0f8c8d49f8834bf/content.htm

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.

Cheers

Sunil

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks

justin_santhanam
Active Contributor
0 Kudos

Venkat,

I will give u an example, to understand the concept of context change.

Source

<MT_Source>

<Records>

---<Dealer>

-


<Number>10001</Number>

-


<Products>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>10</Qty>

-


<Pur_Date>020208</Pur_Date>

-


<Qty>20</Qty>

-


</Products>

-


<Products>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>30</Qty>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>10</Qty>

-


</Products>

---</Dealer>

---<Dealer>

-


<Number>10002</Number>

-


<Products>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>10</Qty>

-


</Products>

-


<Products>

-


<Pur_Date>020208</Pur_Date>

-


<Qty>20</Qty>

-


</Products>

---</Dealer>

---<Dealer>

-


<Number>10003</Number>

-


<Products>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>30</Qty>

-


<Pur_Date>020108</Pur_Date>

-


<Qty>10</Qty>

-


</Products>

---</Dealer>

</Records>

</MT_Source>

Target

<MT_Target>

<Records>

<Dealer>

<Number>10001</Number>

<Total_Qty>70</Total_Qty>

</Dealer>

<Dealer>

<Number>10002</Number>

<Total_Qty>30</Total_Qty>

</Dealer>

<Dealer>

<Number>10003</Number>

<Total_Qty>40</Total_Qty>

</Dealer>

See the source and target. My reqmt is source has dealer number and the quantity purchased in all the dates. My target needs Dealer number and total quantity for the particular Dealer.

Here's the logic.

What we need to do? We need to sum all the quantity for the particular Dealer, isn't it.

See the Qty field, now check what's the context- obviously it's immediate parent Products. If you obeserve the source one Dealer can have multiple Products segment.So we can't keep the context for Qty field as Products itself - the reason is we can't sum all the Qty for particular Dealer. Now check for the next Parent element, it is Dealer. If you set the context of Qty to Dealer then u can sum all the Qty for the particular Dealer.

Hence u can apply the logic as

Qty(Change context to Dealer)-SUM-Total_Qty

Now you may have a doubt why can't I go to one more upper level , I mean Records Context. If you change the context of Qty to Records then it will sum all the Qty fields from the whole source. But our logic is to sum only at Dealer level.

Thatz it!! The changing of context is completely dependant on ur requirement.

I hope it clears u little bit. I'm sorry if I made u to understand little bit complex!!

raj.

Former Member
0 Kudos

Hi,

Check out this elearning on Message Mapping...you will get complete idea about Context change..Also how to insert manual context change using User defined function.

/people/sap.india5/blog/2005/11/03/xi-software-logistics-1-sld-preparation

Hope this will help.

Nilesh

former_member214364
Active Contributor
0 Kudos

Hi Venkataramesh,

Context changed segment name will be in italic in Data flow editor.

Ex:

[Segment Name] -> [Target SegName]

Cheers,

Jag