cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Mapping of fields for Repeated Segments in an IDoc

former_member201987
Participant
0 Kudos

Hello Experts,

We have an Orders IDoc with segment E1EDK02 with Occurence 0..10.

In this segment there are two fields QUALF & BELNR.

We want to map a value (Yes or No) to 2 target fields based on the incoming values of QUALF & BELNR .

Now the problem is that for the first occurence of segment E1EDK02 the mapping is working fine.

But for the subsequent occurences of the segment wrong value is mapped to the target field.

The context of both QUALF & BELNR is set to E1EDK02.

Please help!

Thanks in advance,

Suraj

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member201987
Participant
0 Kudos

Hello Suraj,

Thanks for ur inputs.

The Problem got solved by mapping in the below fashion:

Constant'NO'----


|then

QUALF= 'CMG' ---| AND -| RemoveContext|-sort(descending)-|CollapseContext|----


if -


| targetfield1

BELNR = C----


|

Constant ('YES')----


| else

This is shown for targetfield1. Same applies for targetfield2 also.

I am also curious about one more thing. How do u copy and paste the screenshots in SDN?

Thanks,

Suraj

former_member187339
Active Contributor
0 Kudos

Hi Suraj,

>>How do u copy and paste the screenshots in SDN?

Pasting screenshot is possible only for Moderators.. what I am doing is putting the text inside '{' code '}'

Regards

Suraj

former_member187339
Active Contributor
0 Kudos

Hi Suraj,

Try mapping like this

Don't change any context


BELNR --|mapwithdefault--| then
QUALF= '<your value>' ---| if ---------splitbyvalue--| targetfield
Constant ('')-----------------| else

Regards

Suraj

former_member201987
Participant
0 Kudos

Hello Suraj,

Let me elaborate the conditions:

If QUALF = 'CMG' and BELNR = A or D then TargetField1 = 'NO' else TargetField1 = 'YES'

If QUALF = 'UVA' and BELNR = C then TargetField2 = 'NO' else TargetField2 = 'YES'

The values of both the fields change in each occurence of segment E1EDK02.

Thanks,

Suraj

former_member187339
Active Contributor
0 Kudos

Hi Suraj,

Duplicate the target field and do this two mapping


        Constant'NO'----------|then
QUALF= 'CMG' ---| AND ---|if ---------splitbyvalue--| targetfield
BELNR = C--------| 
Constant ('YES')------------| else

           Constant'NO'------------|then
QUALF= 'UWA' ------| AND ---|if ----------splitbyValue -| targetField(2)
BELNR = A --|OR----| 
BELNR = D --|
Constant ('YES')---------------|| else

Regards

Suraj

former_member201987
Participant
0 Kudos

Hello Suraj,

Its still not working. I tried with all the different options of SplitByValue function.

Right now in the first occurence of segment E1EDK02 the Qualf = UVA & BELNR = C. So TargetField1 = NO. This is working fine.

But when in the third occurence of segment E1EDK02 the Qualf = CMG & BELNR = D, the target field2 = YES is the result. It should be 'NO'

The Display Queue for 'if' function is showing it correctly to be 'NO' at third position but I think the value is taken from the first position as 'YES'.

Thanks,

Suraj

former_member187339
Active Contributor
0 Kudos

Hi Suraj,

Can you paste an example for source and target XML structure..I think there is a context problem in output field and its parent

Regards

Suraj

former_member201987
Participant
0 Kudos

Hello Suraj,

The Source structure is of IDOC Orders05

ORDERS05 1..1

IDOC 1..1

Segment1

Segment2

.

.

.

E1EDK02 1..10

QUALF 0..1

BELNR 0..1

Segmentn

Target Structure

MT_ORDERDATA 1..1

TargetField1 0..1

TargetField2 0..1

ORDERITEM 0..unbounded

former_member187339
Active Contributor
0 Kudos

Hi Suraj,

Check the occurrence in target field


MT_ORDERDATA 1..1
TargetField1 0..1
TargetField2 0..1

maxOccurs is 1 so the TargetField1 and 2 will come for maximum 1 time.. but in source the max-occurrence for E1EDK02 is 10 and hence it can come 10 times..but because of the target max-occurs 1 output will have only 1 value.. you shoudl try changing the max-occurs in target..


E1EDK02 1..10
QUALF 0..1
BELNR 0..1

Regards

Suraj

former_member201987
Participant
0 Kudos

Hi Suraj,

I tried changing the occurence of the target fields to be same as the recurring segment (0..10). Still no success.

any other inputs?

Thanks,

Suraj