cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping - Filter on parent element

Former Member
0 Kudos

Hi,

I'm using message mapping for mapping IDoc ORDERS05 to flat file.

This is the source structure :


ORDERS05  1..1
---- IDOC  1..1
     ---- E1EDKT1  0..99
          ---- TDID  0..1
          ---- TSSPRAS_ISO
          ---- E1EDKT2  0..9999999
               ---- TDLINE  0..1

and this is the target structure :


TCD 1..1
---- TCT  1..unbounded
     ---- TDID
     ---- TDSPRAS
     ---- TDLINE

Can anybody help me about how to do the mapping for having 1 TCT element for each

E1EDKT2 element with parent (E1EDKT1) having field TDID equals to the constant "ZALO" ?

For exemple:


<ORDERS05>
   <IDOC>
      <E1EDKT1>
         <TDID>ZALO</TDID>
         <TSSPRAS_ISO>tdspras1</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline11</TDLINE>
         </E1EDKT2>
         <E1EDKT2>
            <TDLINE>tdline12</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
      <E1EDKT1>
         <TDID>unused</TDID>
         <TSSPRAS_ISO>tdspras2</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline2</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
      <E1EDKT1>
         <TDID>ZALO</TDID>
         <TSSPRAS_ISO>tdspras3</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline3</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
   </IDOC>
</ORDERS05>

must result in :


<?xml version="1.0" encoding="UTF-8"?>
<TCD>
	<TCT>
		<TDID>ZALO</TDID>
		<TDSPRAS>tdspras1</TDSPRAS>
		<TDLINE>tdline11</TDLINE>
	</TCT>
	<TCT>
		<TDID>ZALO</TDID>
		<TDSPRAS>tdspras1</TDSPRAS>
		<TDLINE>tdline12</TDLINE>
	</TCT>
	<TCT>
		<TDID>ZALO</TDID>
		<TDSPRAS>tdspras3</TDSPRAS>
		<TDLINE>tdline3</TDLINE>
	</TCT>
</TCD>

Thanks in advance,

Laurence

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

1. Map <E1EDKT2> directly to <TCT>.

2. Map <TDLINE> direclty to <TDLINE>.

3. For mapping <TDID>, use useOneAsMany std function.

This function takes 3 input. The first input will be TDID, the next 2 inputs are E1EDKT2.

4. For mapping <TSSPRAS_ISO>, use useOneAsMany std function.

This function takes 3 input. The first input will be <TSSPRAS_ISO>, the next 2 inputs are E1EDKT2

Regards,

Jai Shankar

Former Member
0 Kudos

Thanks for your respone,

The mapping is right but the filter on the field E1EDKT1.TDID is missing : only elements E1EDKT2 belonging to parent element E1EDKT1 with field TDID equals to constant "ZALO" must be mapped.

Any idee of how to do that?

Thanks in advance

Laurence

Former Member
0 Kudos

Hi Laurence,

Take TDID.....take useoneasmany.....take EDKT2 as second and third argumnents......take it to equalS function......compare with constant ZALO....take its output to creatif funtion.......then take it to TCT...

Thanks,

Rajeev Gupta

Message was edited by:

RAJEEV GUPTA

Former Member
0 Kudos

Fine. Use a ifWithOutElse while mapping to TCT.

Use equalsS to check the condition and in then part give the input as E1EDKT2.

Do not change the mapping for the rest of the fields.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi,

when implementing your solution, I get only 2 of the 3 expected TCT elements :

<TCT>
     <TDID>ZALO</TDID>
     <TDSPRAS>tdspras1</TDSPRAS>
     <TDLINE>tdline11</TDLINE>
</TCT>
<TCT>
     <TDID>ZALO</TDID>
     <TDSPRAS>tdspras1</TDSPRAS>
     <TDLINE>tdline12</TDLINE>
</TCT>

The filter on "ZALO" TDID works fine, but only the first E1EDKT2 element of each E1EDKT1 is take into account.

Do I have to change some context?

Laurence

Former Member
0 Kudos

Hi,

When implementing your solution, I get only 1 TCT per E1EDKT01 (and no more loop on E1EDKT02) and filter on "ZALO" TDID is not working.

<TCT>
	<TDID>ZALO</TDID>
	<TDSPRAS>tdspras1</TDSPRAS>
	<TDLINE>tdline11</TDLINE>
</TCT>
<TCT>
	<TDID>unused</TDID>
	<TDSPRAS>tdspras2</TDSPRAS>
	<TDLINE>tdline2</TDLINE>
</TCT>
<TCT>
	<TDID>ZALO</TDID>
	<TDSPRAS>tdspras3</TDSPRAS>
	<TDLINE>tdline3</TDLINE>
</TCT>

I have changed context of TDID to ORDERS05, and context of E1EDKT2 to ORDERS05 too. Aren't thoses contexts correct?

Laurence