Hierarchical structure message mapping in PI

Hello All,
I have a source and target structure in graphical message mapping
<?xml version="1.0" encoding="UTF-8"?>
<Material_MT>
   <row>    0..unbounded
      <MATERIAL_ID>1234</MATERIAL_ID>
      <DEL_FLAG>
     </row>
  <row>    0..unbounded
      <MATERIAL_ID>1234</MATERIAL_ID>
      <DEL_FLAG>Y</DEL_FLAG>
     </row>
  <row>  
      <MATERIAL_ID>4567</MATERIAL_ID>
      <DEL_FLAG>N</DEL_FLAG>
     </row>
<row>  
      <MATERIAL_ID>1234</MATERIAL_ID>   
      <DEL_FLAG>N</DEL_FLAG>
     </row>
</Material_MT
Materials can repeat in the source structure but their flags could be different
Target structure
<Mat>  1..1
<Mat_update> 0..unbounded
   <Matid>
           <Matreg>
                 <Matcomplete/>
                 <tuple>
                      <id/>
                  </tuple>    
           </Matreg>
     </Matid>
     <recordind>
            <id>
      </recordind>
</Mat_update>
Now, the requirement is
1) For each <MATERIAL_ID>  in the source, map its corresponding flag <DEL_FLAG> value <Matcomplete/ field in the target ,
2) For each  <MATERIAL_ID> in the source, take its corresponding value and make a soap  lookup call in mdm to get tuple ids (mutiple value per material possible) and map each to <id> (under <tuple>)
3) For each <MATERIAL_ID> in the source, take its corresponding value and make a soap lookup call in mdm to get <recordind> (single value per material) and map to <id> under <recordind>
Now, I have done soap lookup for 2)  and getting multiple tupleIDs for a single material
For 3) also, I am doing a lookup and getting a single ID back 
Both 2)   and 3) are achieved using  udf soap lookup  - 2) will return a resultlist and 3 a single string value
My main question is how to do message mapping for achieving step1, 2 and 3. Pls help...its needed badly
Thanks
mike

Hi Mike,
Below is the logic as per my understanding.
1- Direct mapping from DEL_FLAG> value <Matcomplete/ field in the target
2- After lookup Map multiple Tuple Id's to Tuble node.
3-After lookup Map  recordind to Id .
If you want it in detail let me know the sample output structure with values.
Regards,
Sudha

Similar Messages

  • Fill blanks in target structure - Message Mapping

    my scenario is idoc>xi>flat file
    I want to fill blanks in the target file in the places that the idoc doesn't have values so the file will contain spaces ( field fixed lengths)
    can I do this with content conversion or should I map empty values to target message type in message maping?
    thx
    Frank

    Hi,
    Use the node function mapWithDefault.
    Source -
    > mapWithDefault -
    > Target.
    >>so the file will contain spaces
    Set the default value of the mapWithDefault function to a space' '.
    Thanks
    SaNv...

  • Mapping Query: Flat Structure to Hierarchical Structure.

    I have a scenario which uses the sender file adapter. Therefore my source message has a flat structure. The requirement is that the target message will have a hierarchical structure as shown below.
    Source Message Type
    MT_Acc_Out    1..1
    …fileHeader   1..1
    …docHeader    1..unbounded
    …docItem      1..unbounded
    …fileTrailer  1..1
    Target Message Type
    MT_Acc_In     1..1
    …batchHeader  1..1
    …docHeader    1..unbounded
    ……docItem     1..unbounded
    …fileTrailer  1..1
    The source structures docHeader and docItem both contain a field called seqNo which is used to link the items to the header.
    The requirement is that in the target message the docItems are children of the corresponding docHeader.
    I am having difficulty mapping the target docItem node. Does this require a user defined function or can it be achieved using standard functions?
    Any assistance would be appreciated.

    You can use standard or user-defined functions, see this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/59/f6ae42e0fac911e10000000a1550b0/frameset.htm
    see the part of flat structure_2_nested tables part.

  • Error while forming Structur in Message Mapping.

    Hi ,
    I have taken source payload from Moni and tried to test the Message mapping.
    When i paste the Pay load in Test tab,under XML, my structure is getting well formed., But 3 feilds from structure is showing in Red color.
    Please advice
    Regards
    Dinesh

    Hi Dinesh,
    Please cross check with filling the values into the test tab and display it in source xml format and copy in notepad and compare with the payload data there must be some tag problem.
    Thanks!
    Edited by: Sudhir Tiwari on Nov 25, 2008 2:20 PM

  • Message Mapping of Recursive Source Structure?

    Hello,
    a mapping needs to be implemented from a custom source structure to an IDoc. An XSD has been provided for the source structures which contains recursive elements --> an element of a specific type contains another element with the same type.
    If I import the XSD then the type of the recursive element is displayed in "red", but I still can expand it. If I want to use the source structure in the message mapping I cannot expand the recursive elements anymore. Does anyone of you have an idea how to handle this? I want to avoid XSLT if possible.
    Thank you!

    Hi again Florian,
    please have a look at [Structure Overview in Message Mappings on SAP help|http://help.sap.com/saphelp_nwpi71/helpdata/en/e3/92be7c6cd34fd485c967144e302fb6/content.htm]. There is a paragraph on Recursive Structures:
    ...It is possible to map these elements in the mapping editor in a rudimentary fashion by using the context menu to expand a specific number of subnodes and then use them in target-field mappings...
    That works for both source and target message.

  • Message Mapping RFC structure to deep XML structure

    Hello,
    I have a message mapping I am struggling with. The outbound interface is an RFC with structure like this:
    RFC_send_material
    -material (1..unbounded)
    --matnr
    --meins
    --brgew
    -description (1..unbounded)
    --matnr
    --vkorg
    --text
    The inbound interface should look like this:
    Materials_from_SAP
    -material (1..unbounded)
    --matnr
    --meins
    --brgew
    --description (0..unbounded)
    ---vkorg
    ---text
    My problem is to get all the description connected to the matnr together.
    Examples with data:
    Outbound rfc:
    <RFC_send_material>
       <material>
          <matnr>100</matnr>
          <meins>c1</code1>
          <brgew>c2</code2>
       </material>
       <material>
          <matnr>101</matnr>
          <meins>c1a</code1>
          <brgew>c2a</code2>
       </material>
       <material>
          <matnr>102</matnr>
          <meins>bv102</code1>
          <brgew>addd102</code2>
       </material>
       <description>
          <matnr>100</matnr>
          <vkorg>NO10</sales_org>
          <text>testing100</text>
       </description>
       <description>
          <matnr>102</matnr>
          <vkorg>SE10</sales_org>
          <text>testing102</text>
       </description>
       <description>
          <matnr>102</matnr>
          <vkorg>DK10</sales_org>
          <text>testing103</text>
       </description>
    </RFC_send_material>
    The inbound file structure should then look like this:
    <Materials_from_SAP>
       <material>
          <matnr>100</matnr>
          <meins>c1</meins>
          <brgew>c2</brgew>
          <description>
             <vkorg>NO10</vkorg>
             <text>testing100</text>
          </description>
       </material>
       <material>
          <matnr>101</matnr>
          <meins>c1a</meins>
          <brgew>c2a</brgew>
       </material>
       <material>
          <matnr>102</matnr>
          <meins>bv102</meins>
          <brgew>addd102</brgew>
          <description>
             <vkorg>SE10</vkorg>
             <text>testing102</text>
          </description>
          <description>
             <vkorg>DK10</sales_org>
             <text>testing103</text>
          </description>
       </material>
    </Materials_from_SAP>
    So as you see, my problem is to get the correct description belonging to the material. Hope anybody can help with doing this in Message Mapping.
    Regards,
    Per

    Hi PRW,
    As Michal said correctly, it is hard to describe in words, so here are some pictures which I think is the solution of your problem.
    Description mapping  : http://www.flickr.com/photos/23639237@N02/3220030016/sizes/o/
    VKORG mapping      : http://www.flickr.com/photos/23639237@N02/3219181675/sizes/o/
    Text  mapping           : http://www.flickr.com/photos/23639237@N02/3219182919/sizes/o/
    UDF  CODE             : http://www.flickr.com/photos/23639237@N02/3219184005/sizes/o/
    And the Final Reslut : http://www.flickr.com/photos/23639237@N02/3220035356/sizes/o/
    Regards,
    Sarvesh

  • Message Mapping from flat XML to a Record structure

    Hi All,
    We have a scenario in which the input message is a PDF document. we are following below the blog to convert PDF to XML format which uses <b>PDF box utitlity</b>.
    /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
    We are able to convert the PDF doc to a flat XML file.
    Now we have the following queries...
    what are the different ways to map the flat XML to our record structure?
    Do we have any utitlity in PDF box to do that?
    Regards,
    Rakesh.

    Hi Rakesh,
    You have Graphical mapping, Java mapping, ABAP mapping and XSLT mapping. The choice depends on the scenario and what target result you require.
    <b>Message mapping using graphical mapping editor:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
    <b>XSLT mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    <b>Java Mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    <b>ABAP mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/frameset.htm
    As said earlier, graphical mapping is the simplest and quite a few built in options are available with it, explore it and see which is suitable for your scenario.
    Regards,
    Chandra

  • Message Mapping - same structure

    I have the Source and Target Structures are the SAME XML format.
    Should I need a Message Mapping?
    Should I need an Interface Mapping?
    Please help me.
    Thanks.

    Bhavesh, to be precise the Source and Target Structures are cXML(We are doing this for a testing purpose). The cXML has been imported into the External Definitions.
    >> Rohini, if your idea is just to sent the same file to the target system, i guess your solution is the same as the approach i have followed in this weblog.
    it doesnt even mattter if you have imported your XSD, any dummy type created will do.
    Ref:
    /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp

  • 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.

    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>

  • Message Mapping: button "map fields of same structure" is inactive

    Hi!
    Can some one please explain why the option within message mapping "map the same structure..." is inactive in my case?
    Is that a bug?
    I am on SAP NetWeaver 7.0 SP 14 .
    Thank you!

    Hi,
    It is because your JAVA jdk version.
    Install jdk 1.4.17.
    Carlos

  • Message mapping---1 source structure and n target structures

    I would like to know how many message mappings we need if we are mapping one source structure to 3 different target structures of a single receiver. I am assuming its just one message mapping.
    Depending on the above answer how many interface mappings do we need.

    Kalyan,
    you need multi-mapping that maps one source structure to multiple target structures. Just search multi mapping in SDN and you will find many good posts.
    Basically, in MM editor, go to signature tab and in the target messages add additional message types. Simple.  --> Only one MM and one IM
    Jayson

  • Need user define function for the message  mapping structure

    Hi All
    I am new to XI.I need the java code for Udf for the following structure.
    i have two input and one out put as error.
    order_nos----
    user define function-------error message
    order_details----
    num of orders---- i.e. 10
    order_details------ i.e. whole order records details
    1.i have to compare the 1st  input with 2nd one means if the ist input contain 10 means there are 10 orders in 2nd input.if not then i have to give error message .
    2.then i have to check the fields in 2nd input has no null values.if no values the output will be error message.
    Edited by: Rohit Kumar on Dec 18, 2008 4:43 PM

    Hi Sudhir
    thanks for your continues help.i need some help so that i can fulfill my requirmrnt
    this is my message mapping xml.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:methodCall_MT xmlns:ns0="http://www.dfdsf">
      <num_orders>10</num_orders>
      <test_mode />
    - <order_x>                        ( which is order details)
      <order_id>t78tyu8t</order_id>
      <order_date />
      <mfg_id />
      <catalog_id />
      <first_name />
      <last_name />
      <recipient />
      <message />
      <address1 />
      <address2 />
      <address3 />
      <city />
      <state />
      <zip />
      <country />
      <country_code />
      <phone />
      <subtotal />
      <tax />
      <shipping />
      <total />
      <shopatron_total />
      <fulfiller_total />
      <shipment_id />
    - <additional_info>
      <in_store_pickup />
    - <express_shipping>
      <express_shipping_flag />
      <express_shipping_text />
      <express_shipping_arrival />
      </express_shipping>
      </additional_info>
    - <discount>
      <discount_description />
      <discount_percentage />
      <discount_total />
      </discount>
      <lang_id />
      <currency_id />
      <packing_list />
      <num_items />
    - <items>
      <item_id />
      <quantity />
      <price />
      <part_number />
      <fulfiller_total />
      <shopatron_total />
    - <options>
      <option_x />
      </options>
      </items>
      </order_x>
      </ns0:methodCall_MT>
    this my mapping where under one element number elements are there.when i am excuting the code to check the null value its always giving the there is null val but i have filled evrything.its due to first its checking the order_x and which will be always null.uder this all data will be filled.please suggest what to change in the udf.the code  given by u is working fine but its failing in this scenario because it getting the parent filed is null.

  • How to modify Source XML Structure as it is getting Fail in message Mapping

    From Client , I am Gettin Such XML Structure in XML File ...But it is getting failed in Message Mapping ,.,,
    <?xml version="1.0"?>
    <invoice>
       <Header>
          <DOCID>0001</DOCID>
          <DOCNO>0001</DOCNO>
          <INVAMT>1000</INVAMT>
       </Header>
    </invoice>
    I tried to find out few things ...
    On test of mesage mapping
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:invoice xmlns:ns0="urn:sample.com:file:file">
       <Header>
          <DOCID>0001</DOCID>
          <DOCNO>0001</DOCNO>
          <INVAMT>1000</INVAMT>
       </Header>
    </ns0:invoice>
    This mapping is getting successful.
    So Problem I found Is difference in Sender File Structure from autogenrated Source Structure in Test tab :  
    </invoice>
    and
    <ns0:invoice xmlns:ns0="urn:sample.com.com:Invoice:DB">
    Please Suggest : What to do ?
    How to add this ns0: before INVOICE and :ns0="urn:sample.com.com:Invoice:DB" after INVOICE in Source Structure.
    I am using PI 7.0
    regards
    Prabhat

    Hi Prabhat,
    the easiest way is to make the field XML Namespace of the source Message Type blank.
    Regards,
    Udo

  • PI 7.11: IDoc Message mapping

    Hi there,
    I'm currently working on a graphical message mapping using IDoc HRMD_A06 as source structure (HR master data transferred via PFAL).
    In my result structure I have to fill a field CostCenter with the following logic:
    If field KOSTL (cost center) is filled in node E1P0315, map this field to CostCenter in result structure, otherwise take KOSTL of node E1P0001.
    The end date (ENDDA) has to be '99991231' in each case.
    This is how the result structure looks like:
    <e>                       [1...1]
      <CostCenter>            [1...1]
    </e>
    This is the simplified source structure:
    <E1PLOGI SEGMENT="1">
      <E1PITYP SEGMENT="1">                        [0...n]
         <E1P0001 SEGMENT="1">                     [0...n]
           <INFTY>0001</INFTY>                     [0...1]
           <ENDDA>99991231</ENDDA>                 [0...1]
           <KOSTL>0000012345</KOSTL>               [0...1]
        </E1P0001>
      </E1PITYP>
      <E1PITYP SEGMENT="1">                        [0...n]
        <E1P0315 SEGMENT="1">                      [0...n]
          <INFTY>0315</INFTY>                      [0...1]
          <ENDDA>99991231</ENDDA>                  [0...1]
          <KOSTL>0000024001</KOSTL>                [0...1]
        </E1P0315>
      </E1PITYP>
    </E1PLOGI>
    How can I do the check if field KOSTL of node E1P0315 is null?
    I've tried an existence check for the whole node (E1P0315->exists), but then it fails, because all E1PITYP nodes are processed.
    I hope my problem is clear to you.
    Would it be better to use another mapping type?
    As I'm an ABAP developer, I would of course prefer some lines of code to this graphical drag&drop thing.
    Thanks in advance!

    Cheers, guys!
    I did it now like that:
    http://www.abload.de/image.php?img=mappingflknz.jpg
    Click on the image to enlarge it!
    The logic is as following (ABAP Pseudo-code ):
    IF 0315_KOSTL and 0315_ENDDA are populated.
      IF 0315_ENDDA equals '99991231'.
        map 0315_KOSTL to Cost_Center.
      ENDIF.
    ELSE.
      IF 0001_KOSTL and 0001_ENDDA are populated.
        IF 0001_ENDDA equals '99991231'.
          map 0001_KOSTL to Cost_Center.
        ENDIF.
      ENDIF.
    ENDIF.
    Is that a good way to do that mapping?
    Do I also have to use the removeContexts function or is it ok like that?
    Could I also do that with an ABAP mapping program?
    Thanks in advance!

  • Additional message mapping in the operation mapping-use

    Hi Friends,
       I could find the option for adding more than one message mappings in the operation mapping(Interface mapping). What is the actual purpose of it. when it is used. If there is any blogs regarding the same. refer any link for the same.
    Regards
    Prem

    Hi Prem
    Refer the blog provided by Sarvesh
    What is the actual purpose of it. when it is used. If there is any blogs regarding the same
    You can use more than one mapping programs for requirement where your message mapping cannot generate the desired structure you want or you want to do some transformations in a sequence for meeting your requirement.
    Example: You want to generate a excel sheet as a mail attachment but you have to read a flat file. What you can do here is you can read the Flat file in a single string variable itself. Use XSLT mapping1. Now in a sequence using XSLT Map2/Java mapping program to convert to excel and send as attachment over email
    Thanks
    Gaurav

Maybe you are looking for