none
SAP IDOC REPEATING NODE MAPPING RRS feed

  • Question

  • Hello people,

    I am stuck with a mapping  scenario where in need to map fields from multiple repeating nodes in source schema to IDOC destination schema. Below is sample of it.

    Source file :

    <Root>

    <Price> -- occurs just one node per file

    <isbn>123</isbn>

    <Edition>XYZ</Edition>

    </Price>

    <Payment> -- repeating node can be more than 1 payments in single file

    <Id>1</Id>

    <Date></Date>

    </Payment>

    <Payment>

    <Id>2</Id>

    <Date></Date>

    </Payment> ..... so can repeat

    </Root> 

    IDOC Schema sample : standard idoc

    <E1EDP19>

    <QUALF>1<QUALF>

    <ID></ID>

    <DATE></DATE>

    </E1EDP19>

    So the scenario is when QUALF=2 need to map <isbn> from source file  into <ID> in idoc E1EDP segment  and when QUALF=1 then map <Edition> to <ID> filed. So issue is mappings from different nodes in source schema are mapped into same single segment in destination E1EDP19 for each of the <Payment> node the <Price> node mappings are getting repeated in IDOC which is not expected.  I would need to get the output as below :

    <Send>

    <idocdata>

    <E1EDP19>

    <QUALF>1<QUALF>

    <ID>XYZ</ID>

    </E1EDP19>

    <E1EDP19>

    <QUALF>2</QUALF>

    <ID>123</ID>

    <DATE></DATE>

    <PAYID>1</PAYID>

    </E1EDP19>

    <E1EDP19>

    <QUALF>2</QUALF>

    <ID>123</ID>

    <PAYID>2</PAYID>

    <DATE></DATE>

    </E1EDP19>

    </idocdata>

    </Send>

    Can anyone please suggest as how can I achieve this scenario?  Because the QUALF values are to be hardcoded and not coming from source file its getting bit tricky to achieve this scenario. I tried using Scripting functoid  but with that code the QUALF=1 mapping for <Edition> filed  is repeating for each of the Payment mappings.

    Could anyone please suggest if this can be achieved with functoids mappings?

    Look forward for your suggestions. Thank you.

    Sunday, March 5, 2017 10:48 PM

Answers

  • Hi Yashod

    This scenario is best implemented with custom XSLT scripting functoid. The generation of all the <E1EDP19> nodes would be done by the XSLT scripting functoid, something like the below-

    <E1EDP19>
    <QUALF>1<QUALF>
    <ID>
    <xsl:value-of select="/Root/Price/Edition" /> 
    </ID>
    </E1EDP19>
    <xsl:for-each select="//Payment">
    <E1EDP19>
    <QUALF>2</QUALF>
    <ID>
    <xsl:value-of select="/Root/Price/isbn" />
    </ID>
    <DATE></DATE>
    <PAYID>
    <xsl:value-of select="./Id" /> 
    </PAYID>
    </E1EDP19>
    </xsl:for-each>


    Thanks Arindam

    • Proposed as answer by SMSVikasK Wednesday, March 15, 2017 8:27 AM
    • Marked as answer by Lathaa Friday, February 2, 2018 3:20 PM
    Wednesday, March 8, 2017 6:55 AM
    Moderator