Skip to Content
avatar image
Former Member

About context change

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 06, 2008 at 07:15 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 06, 2008 at 10:50 PM

    Hi Venkataramesh,

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

    Ex:

    [Segment Name] -> [Target SegName]

    Cheers,

    Jag

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 06, 2008 at 11:00 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 06, 2008 at 11:15 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 07, 2008 at 05:51 PM

    Thanks

    Add comment
    10|10000 characters needed characters exceeded