cancel
Showing results for 
Search instead for 
Did you mean: 

Context change causing problems

Former Member
0 Kudos

Hi Experts

Scneario is Idoc to target jdbc structure.

Under a parent segment S1 (repeating three times) there is a child segment S2 which is repeating 4 times, each one having a field KSCHL and field BETRG.

KSCHL BETRG (value)

1 K1 V1

2 K2 V2

3 field not present V3

4 K4 V4

Mapping rule is : If KSCHL is K4 send value (V4) to target field.

Context change is on the parent segment S1, since the mapping rule needs to generate the jdbc structure 3 times - one for each occurrence of S1.

However since the field is not present in 3, the value V3 goes into the target field instead of V4.

I have tried context changes, split by value etc. but cannot get the solution

Please can you indicate whether this can be solved using graphical mapping or a UDF is needed.

If yes please specify the UDF to be used

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi Gary,

Switch back to the initial context (segment S2) for the fields you map, then use the IF function to test the required condition (KSCHL = K4) and put RemoveContext and then SplitByValue(Each Value) between the IF and the target field. This will solve your problem.

Hope this helps,

Greg

Former Member
0 Kudos

Hi Greg

Many thanks for your reply. It solved the issue completely.

Points awarded.

Former Member
0 Kudos

Hi Greg

Another one, if you can guide me in the right direction.

In the same scenario, case no. 3 - KSCHL is not present in the segment, but BETRG (value) is present.

When I try to send that value by using KSCHL not exists again the context queue imbalance comes into play. Tried all combinations of raising the context and without raising the context of KSCHL and BETRG, but the V3 value does not get passed to target.

I had to switch the mapping rule to another field KOTXT that exists in the segment, but wanted to avoid that since that field has free text.

Is there a way where I can keep the mapping rule to KSCHL, but send BETRG when it does not exist.

former_member184681
Active Contributor
0 Kudos

Hi Gary,

You can try with the following condition for IF: KSCHL's parent exists and KSCHL not exists. This should work in your case.

Greg

Answers (1)

Answers (1)

Former Member
0 Kudos

dont change the context of KSCHL and BETRG fields and then use mapwithdefault after KSCHL and ur mapping logic....