cancel
Showing results for 
Search instead for 
Did you mean: 

n:1 mapping problem with incoming NULL value

Former Member
0 Kudos

Dear experts,

i have a problem mapping an incoming Idoc to XML file. Here's the situation:

1) Structure of inbound Idoc

ZTST00

ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z1", FIELDVALUE = "4";

ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z2", FIELDVALUE = null;

ZTST01 Structure: FIELDNAME, FIELDVALUE, Values: FIELDNAME = "ZABC", FIELDVALUE = "5";

ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z4", FIELDVALUE = "6";

ZTST02

2) Resulting XML:

LINEHEADER (1 line)

LINEDETAIL (1 line, Structure: VALUE)

LINEFOOTER (1 line)

3) I need to map ZTST01-FIELDVALUE to LINEDETAIL-VALUE, but only if the FIELDNAME equals "ZABC".

In my message mapping, i put an IF FIELDNAME = 'ZABC' THEN FIELDVALUE->VALUE, on context ZTST00. But because of the null value in line 2 of the Idoc, the value that is returned to the XML is "6", as the null value is disregarded and not in the queue of FIELDVALUE.

How can I put the correct value ("5") to LINEDETAIL-VALUE?

Regards

William

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

use " REMOVE CONTEXT" after segment!

Answers (2)

Answers (2)

Former Member
0 Kudos

dont change the context...u wil get the desired result.

However after if function u have to use removecontext to get the output value

Former Member
0 Kudos

Thanks a lot guys! The RemoveContext did the trick.

Regards

William

former_member184681
Active Contributor
0 Kudos

Hi William,

Simply go back to the default context ZTST01 (for both: FIELDNAME and FIELDVALUE fields) and it should be fine.

Hope this helps,

Greg