Context handling

Hi,
I have a scenario where I am sending an XML file and I have to map it to standard matmas IDoc and post it to ECC.
In the target IDoc structure, we have one segment E1MLGNM for warehouse number and it has one child E1MLGTM for storage type for that warehouse with multiple instances.
But In the source structure, It is NOT coming as parent and child, They are in the same level with multiple instances. The warehouse number will be the key in both the segment to create a parent child relationship.
I can use SplitByValue to create target warehouse segments E1MLGNM for Each value of the source warehouse structure.
Now to map StorageType, I need to create it at the child level of the E1MLGNM instance with the same wharehouse number which is there in the source storagetype segment.
Do you have any idea how that can be acheived without using ABAP/Java mapping?
<b>Source</b>
<Warehouse Segment>     -
n instance
  <Warehouse Number>
  <Other Fields>
</Warehouse Segment>
<Storage segment>       -
n instance
  <Warehouse Number>
  <Storage Type>
  <Other Fields>
</Storage segment>
<b>Target</b>
<Warehouse Segment>     -
n instance
  <Warehouse Number>
  <Other Fields>
  <Storage segment>       -
n instance
      <Storage Type>
      <Other Fields>
  </Storage segment>
</Warehouse Segment>
Thanks,
Vijay

Hi Guys,
Any idea on this?
null

Similar Messages

  • Context handling in message mapping  for an IDoc to File Scenario

    Hi,
    Can somebody help me with this issue. I have an Idoc to file scenario. heres my idoc structure. Its a custom Idoc
    Header (1..1)
    Detail (0..Unbounded)
             DependentDetail (0...Unbounded)              Note: This dependentdetail is a subelement of Detail
    Trailer(1...1)
    I  created my target structrure the same way as the Idoc structure.
    My output is a simple text file. I need the output in this format
    Header
    Detail1
       Dependentdetail1
       DependentDetail2
       DependentDetail3
    Detail2
       DependentDetail1
       Dependentdetail2
    Detail3
    Detail4
    Trailer
    Since the Detail and Dependent Detail records are unbounded .
    But right now i m getting my output like this:
    Header
    Detail1
    Detail2
    Detail3
    Detail4
    Trailer
    But the DependentDetail record in not showing up in the output file. I didnot do any context change in my mapping. So do I need to do any context handling??...If so can somebody explain me with this.
    Thanks,
    Adam
    Edited by: hymanroth on Apr 29, 2011 11:11 PM

    Thanks Kenneth foryour quick reply,
    Yes, I see the payload for Dependent detail in SXMB_MONI. So as you said earlier there's a problem with my content conversion.
    my content conversion is as follows:
    Header.fieldNames                             
    Header.fieldFixedLengths                
    Header.endSeparator                        
    Detail.fieldNames                               
    Detail.fieldFixedLengths                    
    Detail.endSeparator
    DependentDetail.fieldNames
    DependentDetail.fieldFixedLengths                   
    DependentDetail.endSeparator
    Trailer.fieldNames                             
    Trailer.fieldFixedLengths                
    Trailer.endSeparator  
    So As I told  earlier. With the above content conversion. I am not able to get the Dependent detail record in my output file. So If there is a change in my content conversion can u check it and tell me where I went wrong.
    Thanks,
    Harsh
    Edited by: hymanroth on May 2, 2011 7:03 PM

  • Context handling during message mapping

    Hi,
    I'm working on a mapping and it almost works. There is just 1 thing to solve. I use the fixvalues funtion with as input a field A in a segment of my Idoc. This function is used to map a field B in another segment. However as this segment has multiple occurences, I have problems with the context handling: the first timle works ok but then it fails (as the filed A is in another segment/context). How could I fix this?  I would like to avoid UDF as I don't know much java.
    Kind regards,
    Ulrich

    Hi Ulrich,
    <b>Mapping A_source-Fixvalue-B_target</b>
    In the above case What are the elements exist in A_Source same thing will be transfered to B_target . If it is not find any value in Fixvalue table then it will pass the default value. So provde the default value.
    If there is not element in context then it won't create b_target not at all for that context. So use the Mapwithdefault() nodefunction before passing the value B_target. so in that case it will generate the empty value instead of none.
    Warm Regards,
    Vijay

  • Can anybody suggest a site which gives me example for context handling ?

    Can anybody suggest a site which gives me example for context handling ? and also some exersices for handson?

    Hi Anil,
    check the follwing links:
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    /people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/frameset.htm)
    http://help.sap.com/saphelp_nw70/helpdata/en/bd/ca1105c81c6742a0f8c8d49f8834bf/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/40/7b8e40496f6f1de10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/35/fb8c4057d5701de10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/42/f7293b2dbe1a71e10000000a422035/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/79/2835b7848c458bb42cf8de0bcc1ace/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    Thanks,
    Soumya.

  • Context Handling functions

    Hi,
       Can someone point me to a blog or article which shows real life scenarios for Context handling functions as I want to practice what I have read. I have already read some articles on these functions(removecontext, usoneasmany etc) and I understand contexts and also context change etc

    Hi Sonia,
    Check out this blog and SAP contribution files on Context Handling:
    /people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd
    Regards,
    Subhasha Ranjan

  • Context Handling problem

    Hi all,
    I have a problem with a context handling requirement. I think UDF is needed in this case but I don't know where to start. Please see below for the scenario:
    I have an input structure like this:
    segment1
         field1
    segment2
         field2
    segment3
         field3
    node2
         field2
    node3
         field3
    node3
         field3
    the fields will corelate the segment and the node. so for this structure, segment2 and node2 are corelated. Actually, node2 is under segment2.
    here's my desired output to make things clearer:
    segment1
         field1
    segment2
         field2
         node2
              field2
    segment3
         field3
         node3
              field3
         node3
              field3
    field1 sample value. ex. 0000000001
    all field2 have the same value. Value from both segment2 and node2 of field2 is the same. ex. 0000000002
    all field3 have the same value. Value from both segment3 and the 2 node3s of field3 is the same. ex. 0000000003
    In my current mapping, I'm getting this erroneous output:
    segment1
         field1
         node2
              field2
    segment2
         field2
         node3
              field3
    segment3
         field3
         node3
              field3
    The nodes are not in their correct segments. node2 is one level higher because there was no node1.
    Occurrence of segments are 1..unbounded. nodes are 0..unbounded.
    Thanks all.
    Regards,
    SAPenthusiast

    Hello,
    You need to use UDF for this:
    UDF type is Context
    Arguments:
    input1
    input2
    HashMap map = new HashMap();
    for(int a=0;a<input2.length;a++){
         if(!map.containsKey(input2[a])){
              map.put(input2[a],"");
    for(int a=0;a<input1.length;a++){
         if(map.containsKey(input1[a])){
              result.addValue("true");
         else{
              result.addValue("false");
    mapping is something like this:
    input1 -> removeContext -> UDF -> target
    input2 -> removeContext -> /
    Hope this helps,
    Mark

  • Context handling problem in output message

    Hi Experts,
    I have an issue where the context is not properly handled:
    <Material_Master>
    <Material>
    <LongText> -
    >exists--->createif--->E1MTXHM Segment
    <Language_Code>ES</Language_Code>
    <Description>EF VEW CHANGED TEXT: GAS</Description> >mapwithdefault>Splitbyvalue(Each Value)>UDF>E1MTXLM Segment
                                             |->mapwithdefault>Splitbyvalue(Each Value)>UDF>Split by value---> TDLINE Element     
    </LongText>                                   
      <Language_Code>ES</Language_Code>
    >No "Description" Field comes,but i get the next descriptionfield value(EF VE) into this context in the output idoc
    </LongText>
      </Material>
    <Material>
    <LongText>
    <Language_Code>ES</Language_Code>
    <Description>EF VEW CHANGED TEXT: GAS</Description>
    </LongText>
      <Language_Code>ES</Language_Code>
    <Description>EF VEW CHANGED TEXT: GAS</Description>
    </LongText>
      </Material>
      </Material_Master>
      The UDF used here takes the length of the input string and divides into multiple of 5 and the remainder into the last E1MTXLM Segment.
      Similar logic is implemented in "TDLINE" element
      Output IDoc Format:
      <E1MTXHM>  Segment
        <E1MTXLM> Segment
        <TDLINE> Element
        </TDLINE>
        </E1MTXLM>
      </E1MTXHM>
      Thanks,
      Sudhansu
    Edited by: Sudhansukumar Behera on Aug 15, 2009 10:54 AM
    Edited by: Sudhansukumar Behera on Aug 15, 2009 10:55 AM

    Hello,
    You need to use UDF for this:
    UDF type is Context
    Arguments:
    input1
    input2
    HashMap map = new HashMap();
    for(int a=0;a<input2.length;a++){
         if(!map.containsKey(input2[a])){
              map.put(input2[a],"");
    for(int a=0;a<input1.length;a++){
         if(map.containsKey(input1[a])){
              result.addValue("true");
         else{
              result.addValue("false");
    mapping is something like this:
    input1 -> removeContext -> UDF -> target
    input2 -> removeContext -> /
    Hope this helps,
    Mark

  • Idoc Segment - Context Handling.

    Hi All,
    Can anyone suggest me a solution as  how to handle the below idoc context problem.. its a file to idoc scenario
    I have an Debmas idoc, in which It is possible for a customer to have more than one E1KNBKM segment, so we only want to map the first segment for that customer and then also we only want the information from the /GLB/XGT_EXTRA_17 segments that are child segments of E1KNBKM.
    -Anu

    What Ravi suggested was:
    SourceNode --> Index -->
                                --> equalS --> ifWithoutElse (Then SourceNode) --> TargetNode
    Constant(1) -->
    Index is similar to Count function (just that it is more reliabel when counting multiple node occurences)...the above will check if the occurence of SourceNode isthe first or not.
    Regards,
    Abhishek.

  • Mapping problem in context handling

    Hi experts,
                   I am doing a file to file scenario in which i have to change the queue context is it possible? for simple context change we use ResultList.CC in advance UDF but what to do if we want to add a queue cahnge .To dig more deep into the problem i am explaining my scenario.
    my output structure is <GROUP> .....(1 to unbounded)           
                                        <Records>....(1 to unbounded)
                                           field1
                                           field2
                                             field13 
       In one group there can be many records and there will be multiple Groups.Suppose in my udf i want to add a queue change to add some field in other group then how will i achive it ? please guide me with ur inputs 
    Regards,
    Saurabh

    Hi,
    context object is a generic term used to make a reference to message heder fileds in the XML file (also vth XPATH). 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.
    Check this links for more info:
    /people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
    /people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
    /people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi
    http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htm
    /people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes
    Reward points if this helps
    Regards
    Pragathi.

  • Doubt on Mapping, Context handling/Node functions

    Hi Experts...
    This is the structure of a sample message that we get from Agile. BOM1 and BOM2 are two BOMs (basically a material) having BOM Items A,B,Cu2026. (basically Material components)
    PARTS and DOCUMENTS have the material related information.
    Apart from that we have certain segments inside each BOM, called REDLINES, REDLINE BOM CURRENT, REDLINE BOM PREVIOUS (not depicted below) which contains information whether the material item has been added, changed, deleted or unchanged and some more information.
    ROOT
         R1
              R2
                   BOM1                              
                   B-Item A
                   B-Item B
                    R2
                            BOM2
                   B-Item C
                   B-Item D
                      B-Item F
           PARTS
                 BOM1
           PARTS
                 B-Item B
           PARTS
                 B-Item D
           DOCUMENT
                 B-Item A
           DOCUMENT
                 BOM2
           DOCUMENT
                 B-Item C
           DOCUMENT
                    B-Item F
    The target structure has 4 different tables. One of them is a table structure called MATERIALS where we should have 7 records in this case.
    For BOM1 and BOM2 we need to pass details from inside the same node + additional info from Parts/Docs
    Same applies for B-Items.
    Qn:1
    How do I link Parts/Doc/R2 nodes  MATERIAL so that I can get 7 records?
    When I link ROOT I get one record
    When I link R2; I get 2 records (I tried changing the context to ROOT; dint work!)
    When I link Parts I get 3 records
    When I link Docs I get 4 records
    Is there a way to link PARTS nodes + DOCS nodes to MATERIAL?
    Qn2:
    Do you think that for this case we need to split the entire document to 1: n as shown below? Is there a way without splitting? Coz I have a BPM calling a sync abap proxy to post, process and return data (ya we using BPM + a Sync call!!!!)
    ROOT
    BOM1                              
         B-Item A
         B-Item B
    PARTS
         BOM1
    PARTS
         B-Item B
    DOCUMENT
         B-Item A
    BOM2
         B-Item C
         B-Item D
         B-Item F
    PARTS
         B-Item D
    DOCUMENT
         BOM2
    DOCUMENT
         B-Item C
    DOCUMENT
            B-Item F
    Qn3.
    I read from somewhere that when we use sync call; the BPM as to get a response back within 30 s, else it will fail.. is that true?
    Please help!!!!
    Thank you.
    Regards,
    Smitha
    Edited by: Smitha Madhavan on Jul 23, 2008 9:35 PM
    Edited by: Smitha Madhavan on Jul 23, 2008 9:40 PM
    Edited by: Mike Pokraka on Jul 24, 2008 1:42 PM
    Edited by: Smitha Madhavan on Jul 24, 2008 6:41 PM
    Read the "Rules of Engagement"
    Edited by: Juan Reyes on Jul 25, 2008 8:44 AM

    Thanks Kishore.
    The sample file is very very big and data is distributed and difficult to understand. The one I have provided is therefore a simplified  model of the file. Let me narrow down to one step further:
    How can we perform: if A_NUM = B_NUM; pass NAME
    to the target field from the below structure:
    ROOT
                NODE1
                            NODE2
                                        A_NUM
                NODE3
                            B_NUM
                            NAME
                NODE4
                            B_NUM
                            NAME
    Thanks in advance!

  • File to IDOC scenario : Error with mapping due to Context handling

    Hi Experts.
    I have a file to IDOC scenario which need your advice.
    Source File structure as follows:
    Control_Header     <1:1>
    Invoice_Header     <1:unbounded)
    Invoice_Line          <1:unbounded)
    Trailer                    <1:1>
    Payload as follows capture from SXMB_MONI
    - <Control_Header>
            <Key>999</Key>
            <TransactionID>RCTV</TransactionID>
      </Control_Header>
    - <Invoice_Header>
        <Key>000</Key>
        <BusinessUnit>HDB05</BusinessUnit>
        <InvoiceNo>64471</InvoiceNo>  
    </Invoice_Header>
    - <Invoice_Line>
          <Key>001</Key>
          <UnitPrice>7.00000</UnitPrice>
          <Quantity>1.0000</Quantity>
          <GSTAmount>0.49</GSTAmount>
          <GSTRate>0.07</GSTRate>
      </Invoice_Line>
    - <Invoice_Line>
          <Key>001</Key>
          <UnitPrice>8.00000</UnitPrice>
          <Quantity>1.0000</Quantity>
          <GSTAmount>0.56</GSTAmount>
          <GSTRate>0.07</GSTRate>  
    </Invoice_Line>
    - <Invoice_Header>
          <Key>000</Key>
         <BusinessUnit>HDB21</BusinessUnit>
         <InvoiceNo>6Y0575</InvoiceNo>
    </Invoice_Header>
    - <Invoice_Line>
        <Key>001</Key>
        <UnitPrice>49.50000</UnitPrice>
        <Quantity>1.0000</Quantity>
        <GSTAmount>3.47</GSTAmount>
        <GSTRate>0.07</GSTRate>
    </Invoice_Line>
    - <Trailer>
         <Key>TRL</Key>
         <TransactionID>RCTV</TransactionID>
         <TotalFeedLine>96</TotalFeedLine>
         <HashTotalValue>212.00</HashTotalValue>
    </Trailer>
      </ns:MT_EINVOICE>
    Mapping as follow:
                                                   IDOC
    <Control_Header>   ->    <Control_Header>
    <Invoice_Header>   -->  <Header_Invoice>
    <Invoice_Line>      --->        removeContext  -->  <Line_Invoice>       this is the child node of <Header_Invoice>
    <Trailer>               -
    >    <Trailer>
    The result of the using the above Payload get the following result which not wht I seek
    <Control_Header>
    <Header_Invoice>
          <Line_Invoice>
          <Line_Invoice>
         <Line_Invoice>   *** This belong to the Invoice_Line of the second <Header_Invoice> at the payload
    <Header_Invoice>
         <Line_Invoice>   *** THis segment is empty
    <Trailer>
    I required the Line_Invoice to belong to the child of the second <Header_Invoice>, I have tried using
    removecontext with splitVaue and collaspeContext but to no avail.
    May I know what is my mistake on the mapping of the Invoice_Line to Line_Invoice>
    Rgds
    FNG

    Hello,
    There should be something that could correlate the Invoice_Header/Key and Invoice_Line/Key. In your example, both are the same for the first and data set. If the sample looks like the one below, it is possible to sort things by correlating the Invoice_Header key and Invoice_Line key
    <Invoice_Header>
      <Key>000<Key>
    </Invoice_Header>
    <Invoice_Line>
      <Key>000<Key>
    </Invoice_Line>
    <Invoice_Line>
      <Key>000<Key>
    </Invoice_Line>
    <Invoice_Header>
      <Key>001<Key>
    </Invoice_Header>
    <Invoice_Line>
      <Key>001<Key>
    </Invoice_Line>
    An example mapping could look like this
    For Header
    Invoice_Header --> Header_Invoice
    For Line
    /InvoiceLine/Key --> removeContext --> splitByValue:valueChanged --> Invoice_Line
    The subfields of the invoice line would also follow a similar logic, you just need to use formatByExample --> splitByValue:eachValue so that the context levels are the same.
    Hope this helps,
    Mark

  • Query on Context Handling ( File to IDOC mapping )

    Hi All,
       I've a scenario from file to IDOC. The structure of file is as follows.
    Struct ( occurs unbounded times )
    |
    - Name
    Str. of IDOC
    Node
    |
    - name1
    - name2
    - name3
    - name4
    The problem is that the name in file can occur many times.
    So if say name occurs 2 times in the file then it has to be mapped to name1 and name2 in IDOC.
    If Name in file occurs 3 times it'll be mapped to name1, name2 and name3 in IDOC.
    Am looking for some help.
    Thanks,
    Joe.

    Hi Joe,
    For every name in the file, you will have to map the value to the name field in the IDoc. Use SplitByValue node function available in the graphical editor. You will be able to achieve this mapping. For more about the usage, here's the documenation and a blog(where an example has been given):-
    http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/frameset.htm
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    Regards,
    Sushumna

  • Advanced User Defined Functions - Handling Contexts

    Hi All,
    Are there any blogs on Advanced User Defined functions? I would like to get some information on how the queue is accessed, manipulation of the ResultList object etc.
    Many Thanks,
    Sandeep

    Hi,
    This blog talks about context handling
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    This is will give you a clear idea and will be hwlpful for sure
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6c257
    Thanks
    Prakash

  • How do you confirm the validity of a Env or SvcCtx Handle

    I have a fairly large legecy system using mostly ProC. However, we have found some use for OCI in some specific instances. So we have used the SQLEnvGet and SqlSvcCtxGet to get an Environment and Service Context handle of an existing ProC Session to allow us to use OCI without opening a second Db connection.
    However, for some strange, but legitimate reason there will be a ProC Connect Release, and shortly after a new Connect which invalidates my handles.
    The problem is, in the area where I use these handles, I know of no way of determining if this disconnect/connect event has occured and using these invalid handles causes some largely undesired results includeing core dumps.
    Is there tools available that would allow me to check the validity of these handles before I attempt to use them?

    PSB Mktg wrote:
    ...If I did define my PMS Spot Channel then I did it by accident
    You can tell if you have defined it by looking at your Channels palette. I would wager that it is not there based on your description.
    http://www.planetphotoshop.com/working-with-spot-color-channels.html
    As you have the suite, you might look at using Illustrator for logos. Photoshop is rarely used for logos.

  • Context change explicitly

    How to apply context change explicitly?

    Hi,
    Refer the section context handling page No 19: Explicit Context selection.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
    Also u can achieve it by writing the code in UDF.Already provided by experts
    Thnx
    Chirag

Maybe you are looking for

  • BP type not seen in CRM 7.0 WEBUI..

    Hi SAP Gurus, I used to select Person or Organization or both while creating the Mapping format in 5.0, against the marketing attributes in GUI. I am not able to see this field at all in CRM 7.0. Can anybody help me out? Does this exist or removed? T

  • Acrobat 9 print problem

    I recently upgraded my Mac Pro from Tiger and Acrobat 8 Pro to Leopard and Acrobat 9 Pro (I know, I'm a little late to the upgrade party - apologies but it's hard to find free time to keep up with the software maintenance; Acrobat X and Snow Leopard

  • Changing column names in a local query

    I have several underlying queries in my IR bqy(11.1.2.1). I need to be able to change column names in my final query(as the requirements keep changing constantly). Is there a way to do this without modifying the names in the original query(I don't wa

  • Creating ringtones from you tube videos-How.

    How do I create a ringtone on my Macbook Pro in Itunes from a youtube video?

  • Why does my bounding box not align on a centred path anymore?

    Typically I would be able to use the bounding box of a rectangle with a path style set to centred (not in or outside the path) in order to snap several objects paths to one another. Illustrator now sets the bounding box to the outside edge of a path