Hierarchical structure to Flat Structure mapping in Message mapping

Hi Experts,
   I need to map the below hierarchical segments of SHPMNT03 IDOC XML to  repitative stucture G_SHL of 857 EDI XML.
Segments from IDoc.
E1EDT20(Shipment)
E1EDL20(Delivery)
E1EDL24(Delivery Line Item)
E1EDL44(IDoc: Handling Unit Item Delivery) for Pack)
Required Target Segment:
SHIPMENT HL (BOL)
DELIVERY HL (PO NUMBER 1)
ITEM HL (PART A)                       
PACK HL (1ST BUNDLE)
PACK HL (2ND BUNDLE) 
ITEM HL (PART B)
PACK HL (1ST BUNDLE)
DELIVERY HL (PO NUMBER 2)
ITEM HL (PART A)
PACK HL (1ST BUNDLE)
PACT HL (2ND BUNDLE)
PACK HL (3RD BUNDLE)
Please let me know how to achive this.
I tried to achive this by changing the context of the target field, but in that case I am loosing the sequence. I get all delivery together, all Item together..like this.Please tell me how to retain the sequence.
Please reply ASAP.
Thanks in advance,
Shweta.

Hi Sushama,
Could you be bit more elaborative on the problem. What exactly is the error ?? what is the source/target structure ? with this information one would be able diagnose the scenario assist you!!!
Regards
Manju

Similar Messages

  • Conversion of hierarchy structure to flat structure

    Hi Gurus,
    I am mapping a multi node XML structure to flat structure to create the JDBC statements to Oracle database. I think JDBC DML statement can have only flat structure.
    Now how to convert the incoming multi node xml file to several flat structures?
    Can I map the multi node XML structure to jdbc structure?
    Please help me this is critical.
    Thanks
    Kalyan

    Chilla,
    Thanks for the post. My source structure is as below. I have to map this one to flat structure for JDBC. For each customer_num, drop_point there are many customer brands. Now with the customer number and drop point, we have to create the flat structure for each customer brand.
    <?xml version="1.0" encoding="UTF-8" ?>
    <record>
    <CUSTOMER_NUM>00140084000</CUSTOMER_NUM>
    <DROP_POINT>00140084000</DROP_POINT>
    <CUSTOMER_BRANDS>
           <BRAND_CODE>23258</BRAND_CODE>
           <BRAND_EFF_DATE>20060617</BRAND_EFF_DATE>
           <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
           <FREIGHT_CODE>2</FREIGHT_CODE>
           <BRAND_STATUS>00</BRAND_STATUS>
           <INVOICE_UOM />
           <CREATION_DATE />
          <TRANS_LOCATION_CD>272</TRANS_LOCATION_CD>
          <TRANS_FAC_TYPE_CD>058</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>23265</BRAND_CODE>
    <BRAND_EFF_DATE>20060617</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>2</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM />
    <CREATION_DATE />
    <TRANS_LOCATION_CD>272</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>058</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>23365</BRAND_CODE>
    <BRAND_EFF_DATE>20010901</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>2</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM />
    <CREATION_DATE />
    <TRANS_LOCATION_CD>272</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>058</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>23531</BRAND_CODE>
    <BRAND_EFF_DATE>20050210</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>2</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM />
    <CREATION_DATE />
    <TRANS_LOCATION_CD>272</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>058</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>97335</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>420</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>99448</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>4</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>97337</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>4</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>99471</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>12</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>97234</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>11</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <CUSTOMER_BRANDS>
    <BRAND_CODE>94771</BRAND_CODE>
    <BRAND_EFF_DATE>20070217</BRAND_EFF_DATE>
    <BRAND_CAN_DATE>99991231</BRAND_CAN_DATE>
    <FREIGHT_CODE>3</FREIGHT_CODE>
    <BRAND_STATUS>00</BRAND_STATUS>
    <INVOICE_UOM>01</INVOICE_UOM>
    <CREATION_DATE />
    <TRANS_LOCATION_CD>120</TRANS_LOCATION_CD>
    <TRANS_FAC_TYPE_CD>New</TRANS_FAC_TYPE_CD>
    </CUSTOMER_BRANDS>
    <SALES_TERMS_CODE />
    <ACTION />
    <REC_STATUS />
    </record>

  • Exchanging data between interface mapping and message mapping possible?

    Hi,
    please have a look at my interface mapping:
    source message -
    >
    mapping programs
    1. Java mapping
    2. XSL mapping
    3. message mapping
    > target message
    in my scenario a Java Class (1) is called for the interface mapping. There, some information ist read from the xml structure. Next, a xslt mapping (2) takes place that strips some information. The remaining data is passed to the message mapping (3)
    The reason for this is that the source message consists of a xml message inside an xml message.
    I am looking for a way to access the informationen gained in step 1 (Java class) in the message mapping (step 3). I was hoping that the global container (used by user-defined function within message mapping) is accessible from the java mapping, but I could not find out how.
    Anybody with some ideas how to pass information from step 1 to step 3? I cannot put the Information in the xml that is passed to the message mapping, because the schema of the inner xml cannot be changed.
    Thanks very much, best regards,
    Wolfgang

    Hi Wolfgang!
    I have used the "Dynamic Configuration" section in the XI Message header for this issue. You could write something into the Dynamic Configuration Section in step 1 (Java-Mapping) and read it out again in steps 2 or 3. You could use a section for a adapter you are not using in your interface for the real receiver. So if you have a File-Receiver Adapter at the "end" you could use some section of the e.g. SOAP adapter not to interfere with your receiver-adapter when using Dynamic Configuration Settings there ...
    See also: http://help.sap.com/saphelp_nw04/helpdata/de/43/09b16006526e72e10000000a422035/content.htm
    or
    http://help.sap.com/saphelp_nw04/helpdata/de/43/0a7d1be4e622f3e10000000a1553f7/content.htm
    Best regards,
    Andi

  • Hi , friends pls explain abap mapping and message mapping

    1) pls explain abap mapping and message mapping
       send me screen shorts also.

    Hi
    Mapping Techniques
    XI provides 3 standard ways of interface mapping between source and target.
    Graphical mapping
    Java Mapping
    XSLT Mapping
    Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
    ABAP mapping
    XSLT mapping with ABAP Extensions
    Graphical Mapping
    Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
    ABAP Mapping
    A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
    Java Mapping
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    XSLT Mapping
    One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
    A few example cases in which an XSLT mapping can be used:-
    When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
    When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    When data is to be filtered based on certain fields (considering File as source)
    When data is to be sorted based on certain field (considering File as source)
    When data is to be grouped based on certain field (considering File as source)\
    Advantages of using XSLT mapping
    XSLT program itself defines its own target structure.
    XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    File content conversion at receiver side can be avoided in case of text or html output.
    Multiple occurrences of node within tree (source XML) can be handled easily.
    XSLT can be used in combination with graphical mapping.
    Multi-mapping is also possible using xslt.
    XSLT can be used with ABAP and JAVA Extensions.
    Disadvantages of using XSLT mapping
    Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
    Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
    XSLT mapping requires more memory than mapping classes generated in Java.
    XSLT program become lengthier as source structure fields grows in numbers.
    XSLT program sometimes become complex to meet desired functionality.
    Some XSL functions are dependent on version of browser.
    Different types of Mappings
    MAPPING SUPPORTED BY XI
    Message Mapping -> Graphical Design and testing environment. Default Provided By XI. Queue based modelling allow handling or large documents. Extensible via user defined functions
    XSLT Mapping - > Based on openstandard, Portable across application platform, Extensible using user defined functions kewl but disadvantage is Memory overload while handling large documents.
    SAX -> Simple Api For XML. -> Allows you to parse through a XML document. Doesn't consume any memory. But the message can be parsed only once from top to bottom. It Has evolved by contributions made by group of ppl itz a open architecture.
    DOM -> Document Object Model -> Itz designed by W3C. Consumes Memory as the message will be loaded. Allows parsing of document in both way top down and bottom up.
    Send me your email id.Shall send you very good docs for both ABAP Mapping and message mapping.
    Thanks

  • Can we call a Java Map in Message  Map

    Hello,
    Can we call a Java Map in Message  Map
    Thanks and Regards
    Hemant

    Hello Vijay,
    I think this is your code:
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import java.util.Map;
    import java.io.*;
    public class PayloadToXMLField1 implements StreamTransformation {
        String strXML = new String();
       //Declare the XML tag for your XML message
       String StartXMLTag = "<DocumentBody>";
       String EndXMLTag = "</DocumentBody>";
       //String StartXMLTag1 = "<Code>";
       //String EndXMLTag1 = "</Code>";
        AbstractTrace trace;
        private Map param = null;
        public void setParameter(Map param) {
            this.param = param;
        public void execute(InputStream in, OutputStream out) {
            trace =
                (AbstractTrace) param.get(
                    StreamTransformationConstants.MAPPING_TRACE);
            trace.addInfo("Process Started");
            try {
                StringBuffer strbuffer = new StringBuffer();
                byte[] b = new byte[4096];
                for (int n;(n = in.read(b)) != -1;) {
                    strbuffer.append(new String(b, 0, n));
                strXML = strbuffer.toString();
            } catch (Exception e) {
                System.out.println("Exception Occurred");
            String outputPayload =
                StartXMLTag
             + "<![CDATA["
             + strXML
             + "]]>"
             + EndXMLTag;
            try {
                out.write(outputPayload.getBytes());
             trace.addInfo("Process Completed");;
            } catch (Exception e) {
                trace.addInfo("Process Terminated: Error in writing out payload");;
    I need this code to be converted in UDF if Java map cannot be called in Message Map.
    Can anyone help me how to write UDF for the same java map.
    Thanks and Regards
    Hemant

  • XI 7.0 passing attributes between java mapping and message mapping

    Hi all,
    Here's a newbie question. There is a scenario where an interface mapping has several stages of java mapping and message mapping
    I would like to know how to set attributes in the java mapping so that it can be accessed in a message map (or vice versa). What I intend to do is pass some information from one mapping to the other so that action can be taken based on the values passed.
    Thank you!

    Another option is storing the values in the message header in the same way as the Adapter-Specific Message Attributes:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm
    Just use your own name/namespace combination, which is not used in any adapter.
    If possible use the way that Sandro proposed and add the information which you need to additional tags in the payload.
    Regards
    Stefan

  • Interface Mapping VS Message Mapping

    What is the meaning of Interface mapping and Message mapping in real business?
    I think it is something like the difference between the class and object. object is an instance of class.
    While talking about the mapping, there are the source interface and target interface. Can two source intefaces map to only one interface, and what about the vs verse? And how about the message mapping?
    Thanks a lot

    Hi -
    First, an Interface Mapping is not only linked with "Message Mappings" (which is the XI term for a mapping created with the XI graphical tool), but any other XI supported mapping type (e.g. XSLT, Java, or ABAP).  So basically, an Interface Mapping is used to link a source interface to a target interface via a mapping (of any of the supported types).  At runtime, you can't have an interface mapping without a mapping and a mapping without an interface mapping - they need each other.
    <i>>>>Can two source intefaces map to only one interface, and what about the vs verse? And how about the message mapping?</i>
    Yes, the ratio of source to target interfaces are n:m.  In those multiple cases, Multi-Mappings are typically involved as mentioned in the previous post.
    Also, remember that in one interface mapping, you are not limited to one mapping.  More than one mapping (of any type) can execute in the sequence you have set up in the Interface Mapping.  However, watch out for performance in these back-to-back(to-back) mappings.
    Regards,
    Jin

  • Nested structure to flat structure in the PI mapping

    Dear friends,
    I've a issue regarding message mapping within PI 7.0
    This is how my source structure looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <stop>
       <stopreference/>
       <action>
          <actionreference>1</actionreference>
          <shipment>
             <shipmentreference>11</shipmentreference>
             <goods>
                <goodsreference>111</goodsreference>
             </goods>
             <goods>
                <goodsreference>111</goodsreference>
             </goods>
          </shipment>
       </action>
       <action>
          <actionreference>2</actionreference>
          <shipment>
             <shipmentreference>22</shipmentreference>
             <goods>
                <goodsreference>222</goodsreference>
             </goods>
          </shipment>
       </action>
    </stop>
    The target structure looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Test>
       <STOPDETAILS>
          <item>
             <EXTERNAL_STOP/>
             <EXTERNAL_ACTION/>
             <EXTERNAL_SHIP/>
              <EXTERNAL_GOOD/>
            </item>
       </STOPDETAILS>
    </Test>
    In the source message the stop is the header and within a stop there can be 0 or more actions, within action there can be 0 or more shipments and within a shipment there can be 0 or more goods...
    My target message is a flat XML structure...
    The customer wants to see an Item target structure for every goods, the shipment, the action and the stop. If the there are no goods, they wants just to see the shipment, the action and the stop...and so on...
    So its look like this:
    stop 1 - action 1 - shipment 1 - good 1
    stop 1 - action 1 - shipment 1 - good 2
    stop 1 - action 1 - shipment 2 - good 1
    stop 1 - action 1 - shipment 2 - good 2
    stop 1 - action 2 - shipment 1 - good 1
    stop 1 - action 2 - shipment 1 - good 2
    And so on...
    I've to solve this issue in the Graphical Mapping...
    Do you have a suggestion how to do that?
    Kind regards,
    Kamran

    <?xml version="1.0" encoding="UTF-8"?>
       <STOPDETAILS>
          <ITEM>
             <MANDT/>
             <EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
             <ADRNZ>0026858089</ADRNZ>
             <TIMESTAMP>20090721121900 </TIMESTAMP>
             <TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
             <TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
             <ID_STOP>40</ID_STOP>
             <DESCR_STOP>Done</DESCR_STOP>
             <EXTERNAL_ACTION>0080004483</EXTERNAL_ACTION>
             <TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
             <ID_ACTION>30</ID_ACTION>
             <DESCR_ACTION>Partly Done</DESCR_ACTION>
             <EXTERNAL_SHIP/>
             <ID_SHIPM/>
             <DESC_SHIPTYPE/>
             <EXTERNAL_GOOD/>
             <ID_GOOD/>
             <DESCR_GOOD/>
          </ITEM>
          <ITEM>
             <MANDT/>
             <EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
             <ADRNZ>0026858089</ADRNZ>
             <TIMESTAMP>20090721121900 </TIMESTAMP>
             <TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
             <TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
             <ID_STOP>40</ID_STOP>
             <DESCR_STOP>Done</DESCR_STOP>
             <EXTERNAL_ACTION>0080004484</EXTERNAL_ACTION>
             <TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
             <ID_ACTION>deelbewerking</ID_ACTION>
             <DESCR_ACTION>Done</DESCR_ACTION>
             <EXTERNAL_SHIP>0080004484</EXTERNAL_SHIP>
             <ID_SHIPM>20</ID_SHIPM>
             <DESC_SHIPTYPE>Planned</DESC_SHIPTYPE>
             <EXTERNAL_GOOD>0080004484_0001</EXTERNAL_GOOD>
             <ID_GOOD>40</ID_GOOD>
             <DESCR_GOOD/>
          </ITEM>
          <ITEM>
             <MANDT/>
             <EXTERNAL_STOP>0010000020_0006</EXTERNAL_STOP>
             <ADRNZ>0026858089</ADRNZ>
             <TIMESTAMP>20090721121900 </TIMESTAMP>
             <TIMESTAMPSTART>20090721121600 </TIMESTAMPSTART>
             <TIMESTAMPSTOP>20090721121700 </TIMESTAMPSTOP>
             <ID_STOP>40</ID_STOP>
             <DESCR_STOP>Done</DESCR_STOP>
             <EXTERNAL_ACTION>0080004484</EXTERNAL_ACTION>
             <TIMESTAMP_ACTION>20090721121900 </TIMESTAMP_ACTION>
             <ID_ACTION>40</ID_ACTION>
             <DESCR_ACTION>Done</DESCR_ACTION>
             <EXTERNAL_SHIP>0080004484</EXTERNAL_SHIP>
             <ID_SHIPM>20</ID_SHIPM>
             <DESC_SHIPTYPE>Planned</DESC_SHIPTYPE>
             <EXTERNAL_GOOD>0080004484_0002</EXTERNAL_GOOD>
             <ID_GOOD>40</ID_GOOD>
             <DESCR_GOOD/>
          </ITEM>
       </STOPDETAILS>

  • Problem Mapping Deep Structure to Flat Structure

    Hello,
    I hope someone can help me.  My scenario is idoc to file.  I am collecting many idocs with a bpm and writing them out to one file.  My bpm is working great, but my mapping program is not working properly.  My source message is a deep structure and my target message is a flat structure. 
    See my example message formats below.
    Source message:
    zmessage (1..1)
    +zidocmessage (0..unbounded)
    ++zidoc       (1..1)
    +++zidocheader (1..1)
    ++++zidocitem  (0..unbounded)
    Target Message:
    zmessage (1..1)
    +zfilemessage   (1..1)
    ++zfilefirstrec (1..1)
    ++zfileheader (1..unbounded)
    ++zfileitem   (1..unbounded)
    I need to map zidocheader to zfileheader and zidocitem to zfileitem. 
    The Source Data:
    <zmessage>
      <zidocmessage>
        <zidoc>
          <zidocheader>
             <hfield1>hf1</hfield1>
             <hfield2>hf2</hfield2>
             <zidocitem>
               <ifield1>if1</ifield1>
               <ifield2>if2</ifield2>
             </zidocitem>
             <zidocitem>
               <ifield1>if1</ifield1>
               <ifield2>if2</ifield2>
             </zidocitem>
          </zidocheader>
        </idoc>
      <zidocmessage>
        <zidoc>
          <zidocheader>
             <hfield1>hf1</hfield1>
             <hfield2>hf2</hfield2>
             <zidocitem>
               <ifield1>if1</ifield1>
               <ifield2>if2</ifield2>
             </zidocitem>
             <zidocitem>
               <ifield1>if1</ifield1>
               <ifield2>if2</ifield2>
             </zidocitem>
          </zidocheader>
        </idoc>
    </zmessage>
    The Target Data:
    <zmessage>
      <zfilemessage>
        <zfilefirstrec>
          <firstrecfield1>ff1</firstrecfield1>
          <firstrecfield2>ff2</firstrecfield2>
        </zfilefirstrec>
        <zfileheader>
          <hfield1>hf1</hfield1>
          <hfield2>hf2</hfield2>
        </zfileheader>
        <zfileitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
        </zfileitem>
        <zfileitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
        </zfileitem>
        <zfileheader>
          <hfield1>hf1</hfield1>
          <hfield2>hf2</hfield2>
        </zfileheader>
        <zfileitem>
          <ifield1>if1</ifield1>
          <ifield2>if2</ifield2>
        </zfileitem>
        <zfileitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
        </zfileitem>
      <zfilemessage>
    </zmessage>
    Can someone advise me on how to map this correctly?
    Thank you,
    Rhonda

    Hello,
    Can someone please help me with this problem?
    I am at the point where all of the records in my source message are being written out, however, all of the header records are together and all of the line item records are together.  So, the target message is not in the proper sequence.  It should contain the header record, then item records, header record, then item records, etc. 
    Is there anyone that can help me with this issue?
    Thank you,
    Rhonda

  • Enumeration mapping in message mapping

    I have a source structure ABC that contains two fields.  This structure needs to be transformed into two records that will store the field name of the source as well as the value.  It actually creates name/value pair in the target interface.  I wonder if message mapping could possibly handle that. 
    [Source]
    ABC
    ---FIELD_A = 123
    ---FIELD_B = 456
    [Target]
    DEF[0]
    ---NAME = "FIELD_A"
    ---VALUE = "123"
    DEF[1]
    ---NAME = "FIELD_B"
    ---VALUE = "456"
    Regards
    Chong Wah

    Hi Chong Wah,
    You can use the following java code to solve your problem using java mapping.
    * Created on Sep 14, 2005
    * To change the template for this generated file go to
    * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Set;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.StreamTransformation;
    * @author AnanthBabu Chinnaraj
    * To change the template for this generated type comment go to
    * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class JavaMapping implements StreamTransformation {
         private Map map;
         private Document document;
         DOMSource domS = null;
         Document docOut = null;
         HashMap[] xmlData = null;
          * method setParamters is required, but we do not anything with it
         public void setParameter(Map param) {
              map = param;
          * method execute is called by the XI mapping program
         public void execute(InputStream in, OutputStream out) {
              HashMap[] xmlData = null;
              xmlData = parseInputXML(in);
              createOutputXML(xmlData[0], out);
         public static void main(String args[]) throws Exception {
              try {
                   JavaMapping mapObj = new JavaMapping();
                   FileInputStream in = new FileInputStream("D:/zAnanth/SDN/Src.xml");
                   FileOutputStream out =
                        new FileOutputStream("D:/zAnanth/SDN/Trgt.xml");
                   mapObj.execute(in, out);
              } catch (Exception e) {
                   e.printStackTrace();
          * method to process input xml
          * return array of HashMap for every 'ABC' tag
         public HashMap[] parseInputXML(InputStream in) {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              try {
                   String tagName = null;
                   String tagValue = null;
                   // create DOM structure from input XML
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   document = builder.parse(in);
                   // look for the tag 'ABC'
                   NodeList list = document.getElementsByTagName("ABC");
                   //Initialize array size
                   xmlData = new HashMap[list.getLength()];
                   for (int i = 0; i < list.getLength(); i++) {
                        Node node = list.item(i);
                        //Initialize hashmap
                        xmlData<i> = new HashMap();
                        //Process Child nodes
                        NodeList childList = node.getChildNodes();
                        for (int j = 0; j < childList.getLength(); j++) {
                             Node childNode = childList.item(j);
                             if (childNode != null) {
                                  if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                                       //Store tag name
                                       tagName = childNode.getNodeName();
                                       //System.out.println("Name  *:"+childNode.getNodeName());
                                       //Store tag value
                                       tagValue = processValueNode(childNode);
                                       //Store as name value pair
                                       xmlData<i>.put(tagName.toUpperCase(), tagValue);
              } catch (Exception e) {
                   e.printStackTrace();
              return xmlData;
         private String processValueNode(Node childNode) {
              String tagValue = null;
              NodeList valueNodesList = childNode.getChildNodes();
              Node valueNode = valueNodesList.item(0);
              if (valueNode != null) {
                   if (valueNode.getNodeType() == Node.TEXT_NODE) {
                        tagValue = valueNode.getNodeValue();
                        //System.out.println("Value #:"+valueNode.getNodeValue());
              return tagValue;
          * Method to create xml document from input hashmaps
          * return XML doc in InputStream
         public void createOutputXML(HashMap xmlData, OutputStream out) {
              try {
                   DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
                   TransformerFactory tf = TransformerFactory.newInstance();
                   Transformer transform = tf.newTransformer();
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   //Create the output DOM
                   docOut = builder.newDocument();
                   //Create Top most Element
                   Element topRoot = docOut.createElementNS("http://XYZ", "ns:MT_ABC");
                   docOut.appendChild(topRoot);
                   Element defNode = null;
                   Set set = xmlData.keySet();
                   String[] tagNames = new String[set.size()];
                   set.toArray(tagNames);
                   for (int i = 0; i < tagNames.length; i++) {
                        defNode = createElement("DEF", topRoot);
                        createElement("Name", defNode, tagNames<i>);
                        createElement(
                             "Value",
                             defNode,
                             (String) xmlData.get(tagNames<i>));
                   //Process XML
                   domS = new DOMSource(docOut);
                   transform.transform((domS), new StreamResult(out));
              } catch (Exception e) {
                   e.printStackTrace();
         //Create an Element and add it into Parent
         private Element createElement(String elementName, Element parent) {
              Element ele = docOut.createElement(elementName);
              parent.appendChild(ele);
              return ele;
         //Create an Element and Text node and add it into Parent
         private Element createElement(
              String elementName,
              Element parent,
              String value) {
              Element ele = docOut.createElement(elementName);
              ele.appendChild(docOut.createTextNode(value));
              parent.appendChild(ele);
              return ele;
         //Get Values from Map, if value is null pass empty string
         private String getValue(HashMap map, String tagName) {
              String value = "";
              try {
                   value = (String) map.get(tagName);
                   if (value == null) {
                        value = "";
              } catch (Exception e) {
                   e.printStackTrace();
              return value;
    Regards,
    Ananth

  • ABAP Mapping  and Message Mapping

    Hello
    I want to do the followig mapping
    File - > IDOC
    field1  ->field_idoc1
    field2  ->field_idoc2
    field3  ->field_idoc3
    field4  -> (based on an dictionary table in the R/3)
    For the first 3 fields I will use message-mapping.
    For field4 I heard about ABAP Mapping. Select with the value of field4 in an ABAP Table and response the new value to the mapping back.
    Would both mappings in one Interface-Mapping work?
    Regards
    Christoph

    Christoph, There was an article previously available in articles section, now i dont find the link.
    I have given a sample code below. You can find lot of sample JCO code provided along with the JCO library that can be downloaded from service.sap.com.
    JCO.Repository mRepository;
    JCO.Client mConnection = JCO.createClient(
                   sapClient,
                   userName,
                   password,
                   language,
                   hostName,
                   systemNumber );
    // connect to SAP
    mConnection.connect();
    // create repository
    mRepository = new JCO.Repository( "sample", mConnection );
    // Create function
    JCO.Function function = null;
    IFunctionTemplate ft = mRepository.getFunctionTemplate("Z_TEST");
    function = ft.getFunction();
    // Obtain parameter list for function
    JCO.ParameterList input = function.getImportParameterList();
    // Pass function parameters
    input.setValue( param1_value , "P_PARM1");
    input.setValue( param2_value , "P_PARM2");
    JCO.ParameterList tabInput = function.getTableParameterList();
    JCO.Table inputTable = tabInput.getTable("T_PARM3");
    inputTable.appendRow();
    inputTable.setValue("test" , "IDOC");
    mConnection.execute( function );
    String ret = function.getExportParameterList().getString( "P_GEN_NUM" );
    mConnection.disconnect();
    return ret ;
    Regds
    Saravana

  • Is it possible to copy segment mapping in message mapping??

    Hii Experts,
    I want to duplicate one segment and I want to copy all the mappings of one segment into the other in message mapping.
    Mapping Templete does not work here.
    Anyone knows any other work around ?? The segment contains hell lot of mapping rules and it is difficult to copy each and every rule.
    Thanks in advance.
    Shri

    Hi shripad
    just try one thing right click on target field which you want to copy and select option copy node ..if it is work then it may.....otherwise i donot think its possible..
    Thanks
    Kunaal

  • Difference of FixValues and Value Mapping in Message Mapping

    Hi
    I would like to know the exact difference between the "FixValues" and Value Mapping. And the Scenarios of usage.
    If i use Value Mappings, value mappings more for fixed values or can they be used for business data that will change ?
    If the flow is from "Non SAP to SAP System" then if i maintain the "Value Mapping Tables" in Message Mapping, Do i need to maintain the same Value Mapping tables on SAP System. If this is the case, it will be over head of maintaining on both sides.
    More thankful if you clarify my doudt.
    Regards
    Shailaja

    Hi,
    your question is best explained in the following link(PDF).
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    Its given in the 75th page.
    >>If the flow is from "Non SAP to SAP System" then if i maintain the "Value Mapping Tables" in Message Mapping, Do i need to maintain the same Value Mapping tables on SAP System.
    I think this is not needed.its not needed to maintain value mapping tables in SAP system.
    hope this helps.
    regards,
    P.Venkat

  • PI 7.1 Operation mapping - Multiple message mapping - one to many issue

    Dear Experts,
    I am facing this issue in PI 7.1 and I beleive i did similar one in PI 7.0 successfully.
    I have an operation mapping with two message mappings.
    The occurence of source message of operation mapping is 1
    The occurence of target message of operation mapping is 0..unbounded
    Corresponding i configured two message mappings
    For message mapping-1
    Source message occurence = 1  and Target message occurence = 1
    For message mapping-2
    Source message occurence = 1  and Target message occurence = 0...unbounded
    When i test message mappings individually they are working good. But when i test it in operation mapping, the operation mapping is not working..as it is not able to convert single occurence output of message mapping -1 to the second message mapping-2.
    Any suggestions?
    Thanks.

    The message that i get when testing in operation mapping:
    Runtime Exception when executing application mapping program com/sap/xi/tf/_MM_MessageMapping_1_; Details: com.sap.aii.mappingtool.tf7.IllegalInstanceException; Cannot create target element /ns0:MT_MessageMapping_1_TargetMessageType/RECORDSET. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD
    My question is, has somebody mapped similar scenario in your environment? If yes, can you please provide details.
    Operation mapping :  1 to 0..unbounded
    Message Mapping1: 1 to 1
    Message Mapping2: 1 to 0...unbounded

  • XSLT-Mapping oder Message Mapping (grafisches Mapping)?

    Hallo,
    which mapping type is the best? xslt oder message mapping?
    Jens

    Hi,
    In terms of perfromance , XSLT is supposed to be very bad and is to be avoided whenever possibl.e
    Graphical Mapping is the best when it comes to performance of the mapping.
    But , there are a few features, which are not possible using graphical in which case you might have to go for JAVA/ ABAP / XSLT mapping.
    Regards,
    Bhavesh

Maybe you are looking for

  • Bloqueio de campo

    Como faço para bloqueia para alteração no valor do desconto por item  no pedido de venda e também só permite desconto no valor total do documento se o cliente não tiver desconto cadastrado por item/grupo/fornecedor?

  • Airport Express problems

    i bought an airport express for my home, i have a new imac intel core duo, its my first mac ever so I'm still learning. i also have an older PC that connects to the airport express as well. the problem I'm having is that the wireless connection drops

  • A specific bug in Smart Mailbox Rules in Apple Mail on OS X Yosemite

    Steps to reproduce: - Define a Smart Mail Box rule as shown below in screenshot. - Change the value 7 to 2. So it will be 2 months. - Close the dialog box. - Right click on Smart Mailbox and select Edit Smart Mailbox. The dialog still says 7. The 2 n

  • Fetch Softworks iWeb 1.1

    Does anyone have any experience using this product to publish to a folder and than FTP over to a hosting service. The host tells me they do not have the extensions loaded to support an upload directly from iweb??? But that I can FTP my site which wil

  • Ipad mini activation error

    Hey, i m using an ipad mini. It was workinng all fine till yesterday. Today when I got up its showing up a screen "Activation Error: device is not registered as part of something". How can I fix it??