Skip to Content
avatar image
Former Member

Message mapping 2D structure

Please excuse me, this seems to be a very simple issue but being resonably new to message mapping I am having issues solving it.

Ok each field maps to a repeating structure in the target IDOC, I ahve duplicated the subtree in the Structure and mapped each of the fields.

_Source_                    _Desired_                                      _Actual_

<header>                    <header>                                          <header>            
  <line1>                     <line1>                                           <line1>
     <Field1>                    <Field1>                                           <Field1>
     <Field2>     Message        <Field2>                                           <Field2>
     <Field3>       Mapping       <Field3>                                          <Field3>
   <line2>           ------>   <line2>                                               <Field4>
     <Field4>                      <Field4>                                         <Field5>
     <Field5>                      <Field5>                                         <Field6>    
     <Field6>                      <Field6>                                     <line2>

Each lineNode has been mapped across, and the FieldNode's have been mapped to the line as well. I have had to map the lineNode to the fieldNode as well as I am duplicating the subtree for the fieldNode which is 1..N range.

My issue is all the fields are mapping into the first node and not maintaining their structure. The value in the fields is coming through correctly in the repeating structure but the node itself is misplaced.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Aug 12, 2008 at 06:31 AM

    Dear Richard,

    This is very simple as you said,

    In your message mapping change the context of the source structure to Header. you can do this externally by selecting Right Click on the Source structure --> select Context as Header.

    This should work as you desired.

    Best Regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 12, 2008 at 07:02 AM

    Thanks for the prompt response, Im not 100% understanding your reply .... but are you saying that instead of mapping each of the fieldNode's to the lineNode ... I should map the the fieldNode to the headerNode so the whole message is in context during the mapping ... even though the fields map out of each of the nodes ...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 12, 2008 at 07:14 AM

    Dear Richard,

    Sorry If I'm not clear to explain you my solution.

    Leave your mapping as it is. In the Mapping area of Message Mapping can you see soruce and target fields right.

    Right Click Source structure and select Context then select Header. By default it will be selected as Line ok.

    If you want clear explanation plz go through the presentation by Joachim Orb in E learning section of SDN.

    Here is the Direct Link:

    [Advanced Graphical Mapping|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/b9af5e71-0701-0010-d0b8-f612fb6593dd]

    Sorry Richard,

    I completely forgot to tell you that we need to use Split by value Node function for selecting the Different Context.

    Best Regards

    Praveen

    Edited by: Praveen Kurni on Aug 12, 2008 9:20 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 12, 2008 at 07:21 AM

    Hi,

    Please rectify me if I am wrong.

    As per my understanding, You have the fields <Field4>, <Field5>, <Field6> under the nodes Line1 as well as Line 2 also.

    Now the fields that have the value under Line 2 node are getting miss-placed to Line1. This have happened due to Conetxt Changes...

    Please can you just add mapWithDefault [] api while mapping

    Field 4 ---> mapWithDefault [] ---> field 4

    It will create the output structure as required.

    It may create some blanke nodes which you don't require but I doubt that will affect anything but will not allow to missplace the alignment

    Thanks

    Swarup

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 13, 2008 at 01:31 AM

    Thought it was solved ... it isnt...

    To clafiry...

    There are fields in the incoming structure that map into Nodes in the target structure ...

    So Field1 in Line1 .... will actually become Field1Node in the target. To add addition complexity the target node is a repeating node, so used the copt subtree feature but I think it is loosing context.

    So...

    <lineNode1> -


    > <lineNode1>

    <field1> -


    > <FieldNode1>

    <field1 value>

    <field1 constant> --- provided by PI

    <field2> -


    > <FieldNode2>

    and so on .... basically the fields in the originating message and creating a bunch of nodes in the user exit, With some small constants to hardcoded in PI to add context to the value in the field.

    A real example ...

    <saleLine1>                                             <saleLine1>
     <saleValue>100</saleValue>                                 <userExitGenericNode>
    </saleLine1>                                                    <Value>100</Value>
                                                                     <ID>SaleValue</ID>
                                                                </userExitGenericNode>
                                                            </saleLine1>
     
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 15, 2008 at 02:30 AM

    I found the issue, each of the mappings was dependant on the value in a given field, so I worked up a if this is equal to that not then blah blah blah type mapping.... then I copied this across each of the target fields changing which field was ultimately mapped, but I used this on the NodeDefinition which when copied ruined the context of subsequent fields.... Ie. The context was different based on (copy and paste) or drag and drop for the same field. I went through redid the mappings and updated the context where needed and it all works ... thanks guys...

    I would also recommend to anyone who happens across this .... to watch the tech ed presentation as linked by Praveen, its a little slow and rather boring ... but there are some interesting obscure points brought up that will make life a little simpler with dealing with PI ....

    thanks again

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Richard,

      Thanks for the nice comment.

      Felt really happy that you could solve the issue by the Presentation.

      Thanks for rewarding Points as well.

      Best Regards

      Praveen