Skip to Content
author's profile photo Former Member
Former Member

Message Mapping Problem

I have an interface which creates an IDoc in XI based on the contents of a file. The file has a header and detail record. And the IDoc has various nested segments.

The header record in the input file is linked to a top-level segment in the Idoc, and the detail record in the input file is linked to a segment within the top-level segment (at the level below).

The problem is that I need to populate some fields in the 'detail IDoc segment' using data from the header of the input file. As the header occurs only once, and the detail segment in the IDoc can occur multiple times, this causes the fields to only be transferred for the first detail segment. In all the other detail segments in the IDoc these fields are blank.

If I define the header record in the in the input file to be 'occurs 0-unbounded', and edit the XML message in the mapping test tool to have X headers, then there is no problem as long as there is no more then X detail records/detail segments.

I have also found a work around, which store the values in a global container and retrieves it in a second user defined function, but this would not be very good if there were many fields required from the header record in the input file.

This seems like a major problem with the XI mapping tool. Has anyone else experienced this, and/or found a solution?


Jason Hartley

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 16, 2003 at 06:56 PM


    Use the "Copy Value" function (under the Constants section) when mapping the header fields to fields in a repeating group. This function essentially turns the value from the header into a constant that is reused each time the group repeats.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I did try what you suggest before I posted my message, as I thought it might do what you say (it sounds like it from the function name). However, this didn't work, and after looking at the documentation, it seems that this is not the purpose of the function.

      The function is used if you have a field which has a max occurs > 0, and wish to transfer the various occurences to different fields in your target structure (see 'SAP Exchange Infrastructure: Designing Mappings' document for more info).


  • author's profile photo Former Member
    Former Member
    Posted on Jul 14, 2004 at 05:51 PM

    Hello Jason,

    I am having problems mapping an input file to be 'occurs 0-unbounded' to an IDOC. Could you please provide me with a sample of Java mapping which it seems you used for mapping? Or any other sample.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 15, 2004 at 07:31 AM

    Hall Jason,

    I suppose you have the a source structure like the following:

    <xsd:element name="Items" type="Items"></xsd:element>

    <xsd:complexType name="Items">


    <xsd:element name="Header" ></xsd:element>

    <xsd:element name="Detail" maxOccurs="unbounded"></xsd:element>



    and as target structure

    <xsd:element name="ItemsFlat" type="ItemsFlat"></xsd:element>

    <xsd:complexType name="ItemsFlat">


    <xsd:element name="Item" type="FlatStructureType" maxOccurs="unbounded"></xsd:element>



    <xsd:complexType name="FlatStructureType">


    <xsd:element name="Value1"></xsd:element>

    <xsd:element name="Value2"></xsd:element>



    You want to map the hierarchical source structure to a flat

    target structure. Simply speaking you want to map Header to Value1 and Detail to Value2.

    This is possible. Here is the textual representation of the Message Mapping definition:




    /ns1:ItemsFlat/Item/Value2=SplitByValue[type=Each value](/ns1:Items/Detail)

    This means you have to map the unbounded element Detail to the unbounded element Item,

    the Heder element to Value1 using the CopyValue function,

    and the Detail element with the SplitByValue function to the Value2 element.

    The SplitByValue function is necessary to add addtional contexts. A context insert does always mean produce a super element.

    Regards Franz

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.