cancel
Showing results for 
Search instead for 
Did you mean: 

Create segment based on Condition

former_member184789
Active Contributor
0 Kudos

Hi I have a requirement such that I have on the source side ORDERS05 IDoc and in E1EDP01, I have multiple E1EDP19 with QUALF as 002,001 & 004 ( in that order). Now they say that E1EDP01 may repeat and in some or all, the E1EDP19 corresponding to QUALF=002 may not appear. In such cases I have to create an E1EDP19 with QUALF=002. For example:

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    <E1EDP19>

    QUALF=001

   <E1EDP19>

     QUALF =004

<E1EDP01/>

< E1EDP01>

    <E1EDP19>

    QUALF=001

   <E1EDP19>

     QUALF =004

<E1EDP01/>

The above is a sample source where in the first E1EDP01, the E1EDP19 corresponding to QUALF=002 appears, whereas in the second E1EDP01, the E1EDP19 with QUALF=002 is not there. My target XML should look like:

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    <E1EDP19>

    QUALF=001

   <E1EDP19>

     QUALF =004

<E1EDP01/>

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    <E1EDP19>

    QUALF=001

   <E1EDP19>

     QUALF =004

<E1EDP01/>

And I need to populate IDTNR ( even though blank) from QUALF=002 if it does not appear. So in cases where QUALF=002 appears, IDTNR will take value from there, otherwise a blank IDTNR has to be created. Could anyone please guide me. I need detailed guidance.

Accepted Solutions (0)

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi ,

Very simple, create one duplicate segment and pass Qual value as 002. Now write a condition to E1EDP19 like IDTNR exists and Qualifies 002 not there then duplicate segment condition satisfies else no.

Regards,

Raj

former_member184789
Active Contributor
0 Kudos

Hi,

Now I need to take the value of IDTNR from E1EDP19 where QUALF=001 & need to store in target where QUALF=002.And it is possible that the source may not contain an E1EDP19 with QUALF=002, in such case I have to create a segment E1EDP19 with QUALF=002 in the source side so that it will create an E1EDP19 with QUALF=001 in target. So the QUALF=002 in source creates QUALF=001 & QUALF=001 creates QUALF=002 in target. I can surely create a duplicate subtree & pass a constant value to it. But when I provided the value of IDTNR with QUALF=001 & removed QUALF=002, it did create another segment, but now all the IDTNR were absent. It may be due to context handling issue that the values got garbled. Could you please create a dummy mapping and let me know how it could be resolved.

former_member184789
Active Contributor
0 Kudos

Now here is how the source will look like

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    IDTNR=100

    <E1EDP19>

    QUALF=001

    IDTNR=200

   <E1EDP19>

     QUALF =004

<E1EDP01/>

< E1EDP01>

    <E1EDP19>

    QUALF=001

    IDTNR=400

   <E1EDP19>

     QUALF =004

<E1EDP01/>

And the target should be

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    IDTNR= 200

    <E1EDP19>

    QUALF=001

    IDTNR=100

   <E1EDP19>

     QUALF =004

<E1EDP01/>

< E1EDP01>

     <E1EDP19>

    QUALF = 002

    IDTNR = 400

    <E1EDP19>

    QUALF=001

    IDTNR = "Blank"

   <E1EDP19>

     QUALF =004

<E1EDP01/>

Please notice the value changes in all & also the context handling part..Kindly help me..Please