cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicated segments in IDOC

Former Member
0 Kudos

Hi experts,

I have a scenario where my source is an IDOC.

The problem is that I have a segment called E1EDKA1 that is duplicated several times. In the different segments duplicated, I have a field that can have different values and according to the value of this field, I have to map different fields of the concerned segment E1EDKA1 to different targets.

Does anyone know what would be the best approach to do that?

Any help would be appreciated,

Regards,

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

thanks.

I tried with the if function, the problem is since the segment is duplicated, it only takes the values in the first segment.

Example:

In my Idoc, I have the segment E1EDKA1 that has 5 fields :

E1EDKA1

>>PARVW

>>NAME1

>>NAME2

>>STRAS

>>ORT01

This segment can be duplicated (occurence 0..99).

Let's say I have an Idoc with 3 times E1EDKA1, then I would have:

E1EDKA1

>>AB

>>NAME1

>>NAME2

>>STRAS

>>ORT01

E1EDKA1

>>CD

>>NAME1

>>NAME2

>>STRAS

>>ORT01

E1EDKA1

>>EF

>>NAME1

>>NAME2

>>STRAS

>>ORT01

My problem is the following :

if PARVW = AB, then NAME1 needs to go in the target field NAME1.

if PARVW = CD, then NAME2 needs to go in the target field NAME2 (without paying attention to the other fields).

if PARVW = EF, then STRAS needs to go in the target field STRAS (without paying attention to the other fields).

and so on..

Former Member
0 Kudos

>>it only takes the values in the first segment.

You need to use copyValue standard function to repeat values multiple times on receiver side.

Oops my bad,didn't realize your source is IDOC,i thought your receiver is IDOC,sorry about that

Thanx

Aamir

Edited by: Aamir Suhail on Sep 3, 2008 11:56 AM

Edited by: Aamir Suhail on Sep 3, 2008 12:02 PM

Former Member
0 Kudos

Hi,

Try the following :

if PARVW == AB then NAME1 ( important : set the context of PARVW and NAME to a node above E1EDKNA1 segment )

if PARVW == CD then NAME2 ( important : set the context of PARVW and NAME to a node above E1EDKNA1 segment )

if PARVW == EF then STRAS( important : set the context of PARVW and STRAS to a node above E1EDKNA1 segment )

Try chaning the contexts if proper NAME1 was not populated

Which IDOC are u using?

regards,

Venkat.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Mapping mentioned above may return errors in some cases. To avoid them use RemoveContexts before the segment.

Regards,

Radek

Former Member
0 Kudos

Hi Radek,

Correct me and let me know where it would show unexpected results?

Changing contexts to the segment above E1EDKNA1 would act same like removeContexts and it will not have any contexts to remove from the Queue [ I mentioned the same in Mapping image ]

I believe we dont need removeContexts here after the Contexts is changed.

Moreover if E1EDKNA1 is located under one of the line items, changing the context to line item would work, which will fail with removeContexts

mapWithDefault was used assuming one of the NAME1, NAME2, STRAS have 1....1 occurance, which might throw error message if no condition is satisfied

In the worst case, even if E1EDKNA1 does not appear in source IDOC or if PARVW do not have one of the AB,CD, EF it will dispaly default values

Regards,

Venkat.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Venkat,

thanks a million, it works now!!!

I put the same context to both entries and it works as you said

again, thanks for your help, I'll let you know

regards,

jamal

Former Member
0 Kudos

>>I have a field that can have different values and according to the value of this field

All the duplicated segments are independent of each other,so simply use If-Else conditions in all of them and keep on mapping the segements/elements as per your requirement.

Lets say you have ten fields in a certain E1EDKA1 and all these need to be filled based upon a certain value in E1EDKA1,the just give the same If-else condition in all of them.

Thanx

Aamir

Former Member
0 Kudos

HI,

Two ways to do it.

1) Using graphical mapping use the equals constant ifwithoutelse functions.

2) Write the advance UDF where again u wil check the condition using java and map the target field.

can u give one example of ur requirement.

chirag