cancel
Showing results for 
Search instead for 
Did you mean: 

How can I deal with recursive target nodes?

Former Member
0 Kudos

Hello All,

I am working on an IDOC to B2MML scenario.

I need to map E1PLPOL segment to a recursive node - product segment - on the target side.

The initial occurrence of product segment node will be the operations and the child product segment node under it will be the phases.

When I test the message mapping, I can see one successful occurrence of the operations and phases.

But, when I give values for subsequent occurrences of operations and phases, I am able to see the operations alone. What could be the reason for the phases to miss out from the second iteration onwards?

Any help would be deeply appreciated.

Warm Regards,

Earnest

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Got solved by using intermediate mapping concepts.

Former Member
0 Kudos

Hi All,

This issue got solved by using Intermediate mapping concepts. Please write to me (earnest dot thomas at gmail dot com ) incase someone needs more details on the solution

Thanks a lot for all the comments.

Warm Regards,

Earnest A Thomas

0 Kudos

Hi Earnest,

Could you give an example of source and target messages?

Ibrahim

Former Member
0 Kudos

Hi Ibrahim,

Here is the source tree structure:

MT_NEW_TEST

- E1PLPOL

--VORNR

--PVZNR

Target tree structure is as given below:

MT_INT_MR1

-OPERATIONS

--OVORNR

--OPVZNR

---PHASES

-


PVORNR

-


PPVZNR

Test data for source side is given below:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_NEW_TEST xmlns:ns0="http://hclcoe/PIPs">

<E1PLPOL>

<VORNR>10</VORNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>20</VORNR>

<PVZNR>10</PVZNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>30</VORNR>

<PVZNR>10</PVZNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>40</VORNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>50</VORNR>

<PVZNR>40</PVZNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>60</VORNR>

<PVZNR>40</PVZNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>70</VORNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>80</VORNR>

<PVZNR>70</PVZNR>

</E1PLPOL>

<E1PLPOL>

<VORNR>90</VORNR>

<PVZNR>70</PVZNR>

</E1PLPOL>

</ns0:MT_NEW_TEST>

The following is what I got on the target side:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_INT_MR1 xmlns:ns0="http://hclcoe/PIPs">

<Operations><OVORNR>10</OVORNR>

<Phases><PVORNR>20</PVORNR><PPVZNR>10</PPVZNR></Phases>

<Phases><PVORNR>30</PVORNR><PPVZNR>10</PPVZNR></Phases>

<Phases><PVORNR>50</PVORNR><PPVZNR>40</PPVZNR></Phases>

<Phases><PVORNR>60</PVORNR><PPVZNR>40</PPVZNR></Phases>

<Phases><PVORNR>80</PVORNR><PPVZNR>70</PPVZNR></Phases>

<Phases><PVORNR>90</PVORNR><PPVZNR>70</PPVZNR></Phases>

</Operations>

<Operations><OVORNR>40</OVORNR></Operations>

<Operations><OVORNR>70</OVORNR></Operations>

</ns0:MT_INT_MR1>

The condition to map the phases under the operation is: "VORNR value should match the PVZNR value".

So, in the above sample, the operations would be 10, 40 & 70. I am struggling to group the respective phases under the operations using the condition mentioned above.

Thanks a lot,

Earnest

Edited by: Earnest Thomas on Nov 30, 2008 9:56 AM

Edited by: Earnest Thomas on Nov 30, 2008 9:57 AM

Edited by: Earnest Thomas on Nov 30, 2008 9:59 AM

Former Member
0 Kudos

What I am looking to get on the target side is as given below:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_INT_MR1 xmlns:ns0="http://hclcoe/PIPs">

<Operations><OVORNR>10</OVORNR>

<Phases><PVORNR>20</PVORNR><PPVZNR>10</PPVZNR></Phases>

<Phases><PVORNR>30</PVORNR><PPVZNR>10</PPVZNR></Phases>

</Operations>

<Operations><OVORNR>40</OVORNR>

<Phases><PVORNR>50</PVORNR><PPVZNR>40</PPVZNR></Phases>

<Phases><PVORNR>60</PVORNR><PPVZNR>40</PPVZNR></Phases>

</Operations>

<Operations><OVORNR>70</OVORNR>

<Phases><PVORNR>80</PVORNR><PPVZNR>70</PPVZNR></Phases>

<Phases><PVORNR>90</PVORNR><PPVZNR>70</PPVZNR></Phases>

</Operations>

</ns0:MT_INT_MR1>

Please advice me on how to accomplish the above.

Thanks,

Earnest

0 Kudos

Hi,

You can use XSL mapping for this. You can group your elements by using Muenchian Method:

http://www.jenitennison.com/xslt/grouping/muenchian.html

Your XSL file should be like this:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://hclcoe/PIPs">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:key name="myKey" match="E1PLPOL" use="PVZNR" />
<xsl:template match="/">
<ns0:MT_INT_MR1>
<xsl:for-each select="ns0:MT_NEW_TEST/E1PLPOL[generate-id()=generate-id(key('myKey', PVZNR)[1])]">
<xsl:param name="pvznr" select="PVZNR" />
<Operations>
  <OVORNR><xsl:value-of select="$pvznr"/></OVORNR>
  <Phases>
    <xsl:for-each select="//E1PLPOL[PVZNR=$pvznr]">
      <PVORNR><xsl:value-of select="VORNR"/></PVORNR>
    </xsl:for-each>
  </Phases>
</Operations>
</xsl:for-each>
</ns0:MT_INT_MR1>
</xsl:template>
</xsl:stylesheet>

former_member187587
Contributor
0 Kudos

If you had your Operation node on a higher hirarchy you could have worked with the node mapping functions and contexts chnages to create your requested target xml.

You can try and create a user defined function and for each node that has the VORNER value alone save the value in a variable, run over the xml and compare to the saved value.

Good luck.

SudhirT
Active Contributor
0 Kudos

Hi Earnest,

try using splitbyvalue just a step before in taraget field 'phase',do same for the fields under 'phase'.

thanks