Skip to Content
0

Context handling while creating IDocs and segments

Nov 16, 2017 at 07:52 AM

49

avatar image

Hi Experts,

This is regarding File to IDoc[DEBMAS06] where the input structure is external message and need to create multiple IDocs based on occurences on number of occurrences of BusinessPartner node with Address type constant equals to "CA" and E1KNBKM segments should be created under proper IDoc with number of occurrences equal of Banking node which is occuring under BusinessPartner node. Pls find the attached input sample files.

1st input:multiplebnks.txt

2nd input:newfile1.txt

Here 1st input should create 2 IDocs with 2 E1KNBKM segment occurrences under 1st IDoc and 5 E1KNBKM segment occurrences under 2nd IDoc.

Kindly help.

Thanks,

Ramu.

multiplebnks.txt (77.9 kB)
newfile1.txt (24.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Evgeniy Kolmakov Nov 16, 2017 at 10:41 AM
0

Hi Ramu!

I consider XSL transformation to be the most suitable for your requirement.

Here is an example template:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:q1="http://www.abc.com/yellowpages/businesspartner/1_1"
    exclude-result-prefixes="xs q1" version="1.0">
    <xsl:template match="/">
        <DEBMAS06>
            <xsl:apply-templates select="/q1:SyncBusinessPartner/DataArea/BusinessPartner[InternationalVersion/Address/AddressType = 'CA']"/>
        </DEBMAS06>
    </xsl:template>
    <xsl:template match="BusinessPartner">
        <IDOC BEGIN="1">
            <EDI_DC40 SEGMENT="1">
            </EDI_DC40>
            <xsl:apply-templates select="./Banking"/>
        </IDOC>
    </xsl:template>
    <xsl:template match="Banking">
        <E1KNBKM SEGMENT="1">
        </E1KNBKM>
    </xsl:template>
</xsl:stylesheet>

For your first input result looks like:

<?xml version="1.0" encoding="utf-8"?>
<DEBMAS06>
    <IDOC BEGIN="1">
        <EDI_DC40 SEGMENT="1"/>
        <E1KNBKM SEGMENT="1"/>
    </IDOC>
    <IDOC BEGIN="1">
        <EDI_DC40 SEGMENT="1"/>
        <E1KNBKM SEGMENT="1"/>
    </IDOC>
</DEBMAS06>

I guess you could enhance this template furher to build desired IDoc structures.

Regards, Evgeniy.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Evgeniy,

Thanks for your response!

But we are working on PI 7.4 single stack.I have not worked on XSLT before. Also they are several fields Can you help with graphical mapping.

Thanks,

Ramu.

0
avatar image
Former Member Nov 17, 2017 at 09:34 PM
0

Hi Ramu,

You can also use ifWithoutElse function to fulfill your requirement. The point is to change the context of the first parameter to an upper level, which is the same level as the second parameter.

Share
10 |10000 characters needed characters left characters exceeded