cancel
Showing results for 
Search instead for 
Did you mean: 

Add all E1EDT20.E1EDL20 to each E1EDT20.E1EDT37.E1EDT43

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi;

Did this solve your prob ?? If so please close the forum and award points.

If not we can take the discussion further.

Mudit

Former Member
0 Kudos

Thanks for your response,

my problem is not solved, I have the following result with your solution :

For the first E1EDT43 : only the first E1EDL20

and for the others E1EDT43 : no E1EDL20

The expected result is all the E1EDL20 elements for each E1EDT43.

If you have another idee...

Laurence

Former Member
0 Kudos

Hi Lawrence

Check in the queue of the UDF and if possible send back the entries in there.

Mudit

Former Member
0 Kudos

Hi;

Remove count steps before the UDF.

Mudit

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi;

Just remove the count step after removecontext from both the inputs to UDF.

Mudit

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi;

Means with the removal of count you are getting the values as required in E1EDL20 segment under E1EDT43??

Do you have some other nodes under E1EDL20 ??

Can you explian this in more detail

Mudit

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi;

This seems to be a new problem as a whole.

Just try mapping the same way as you did for E1EDL20 for all the nodes under this parent node just change the target node .

Mudit

Former Member
0 Kudos

it doesn't work

justin_santhanam
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Thanks for your response, Raj

I have implemented your solution.

I have well the both E1EDL20 elements under each E1EDT43 element,

but I haven't the nodes under E1EDL20, and I need them.

Any idee on how to get also the children of E1EDL20 element in target structure ?

Thanks in advance,

Laurence

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks to all for your responses.

Helmut, you solved my problem. Thank you very much, I was beginning to lose hope.

Answers (1)

Answers (1)

udo_martens
Active Contributor
0 Kudos

Hi Laurence,

which kind of mapping do you use?

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

I'm using Message Mapping.