on 06-13-2007 11:09 AM
Hi all!
Can someone tell me how to add all E1EDT20.E1EDL20 nodes to each E1EDT20.E1EDT37.E1EDT43 node ?
My input structure :
E1EDT20 1..1
- E1EDT37 1..N
- E1EDT43 1..N
- E1EDL20 1..N
My output structure :
E1EDT20 1..1
- E1EDT37 1..N
- E1EDT43 1..N
- E1EDL20 1..N
I want to add <b><u>all the E1EDT20.E1EDL20</u></b> nodes as children of each <b><u>E1EDT20.E1EDT37.E1EDT43</u></b> node
For example, the input :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDT43
- E1EDT37
- E1EDT43
- E1EDT37
- E1EDT43
- E1EDT43
- E1EDT43
- E1EDL20
- E1EDL20
must result in output :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
Thanks in advance,
Laurence
Hi;
Here is the solution
You would require a User Defined Function in this case
Mapping
E1EDL20Remove ContextCount --
UDF --- E1EDL20
EIEDT43RemoveContextCount --
UDF Context type
for(int i=0;i<EIEDT43.length;i++)
{
for(int j=0;j<E1EDL20.length;j++)
{
result.addValue(E1EDL20[j]);
}
result.addContextChange();
}
Mudit
Awardpoints if it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So with the following input :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDT43
- E1EDT43
- E1EDT43
- E1EDL20
- E1EDL20
I have the following result :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDT43
- E1EDT43
- E1EDT43
instead of :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
Queue of the UDF :
IN0 - IN1 - OUT
<b>SUPPRESS</b> - <b>SUPPRESS</b> - <b>SUPPRESS</b>
<i>[2]</i> - <i>[4]</i> - <i>[2]</i>
<u>[2]</u> - <u>[4]</u> - <b> [2]</b>
- - <u>[2]</u>
Italic => blank
Bold => grey
Underlined => dark grey
Without count steps, I have the right structure :
E1EDT20
- E1EDT37
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
- E1EDT43
- E1EDL20
- E1EDL20
But the children of nodes E1EDL20 are not well initialized.
The E1EDL20 elements of the first E1EDT43 are all right.
But for all the others E1EDT43, there is nothing above E1EDL20
The complete input structure is the following one :
Messages 1..1
- Message1 1..1
- SHPMNT05 0..N
- IDOC 1..1
- E1EDT20 1..1
- E1EDT37 0..N
- E1EDT43 0..N
- E1EDL20 0..N
- SEGMENT 1..1
- VBELN 1..1
- VSTEL 0..1
- VKORG 0..1
- ...
- E1ADRM1 0..N
- ...
- E1EDT13 0..N
- ...
- E1EDL24 0..N
- SEGMENT 1..1
- MATNR 0..1
- ...
- E1EDL15 0..N
- ATNAM 0..1
- ATWRT 0..1
- E1EDL12 0..N
- ATNAM 0..1
- ATWRT 0..1
So all the nodes E1EDL20 must be mapped with their children and grandchildren.
Thanks in advance,
Laurence
Laurence,
Please find the logic , I attached them as Jpg's in the URL.
Part 1 - http://www.flickr.com/photos/8764045@N06/544183191/
Part 2 -http://www.flickr.com/photos/8764045@N06/544183195/
Part 3 - http://www.flickr.com/photos/8764045@N06/544183225/
Results - http://www.flickr.com/photos/8764045@N06/544183233/
If you have any doubts, plz revert back.
Best regards,
raj.
Hi Laurence,
maybe a different approach will help. Have you thought about using XSLT for this. What I mean is that you could do your normal mapping stuff in your current graphical message mapping and you just do the re-allocation of the E1EDL20 segments in a second mapping step (within your interface mappping). This second mapping step would be a XSLT mapping that would look like the following:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/ | *">
<!-- This template copies everything 1:1 despite E1EDT43 and E1EDL20 (see the templates below)-->
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- -->
<xsl:template match="SHIPMNT05/IDOC/E1EDT20/E1EDL20">
<!--This is to supprress the copying of E1EDl20. It will be copied in the template of E1EDT43-->
</xsl:template>
<!-- -->
<xsl:template match="SHIPMNT05/IDOC/E1EDT20/E1EDT37/E1EDT43">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
<!-- Find and copy the corresponding E1EDL20's (and all its children) below E1EDT43 -->
<xsl:for-each select="../../E1EDL20">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
We have done similiar things before. Sometimes it is just better to do things in two steps.
Let me know if this helps.
Regards,
Helmut
Hi Laurence,
which kind of mapping do you use?
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.