Showing results for 
Search instead for 
Did you mean: 

how to handle empty field in idoc to file scenario

Former Member
0 Kudos

some field of IDoc is empty, there occurs error. like

<Trace level="1" type="T"> RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:vendor_list/vendor[3]/company_code. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at


Accepted Solutions (0)

Answers (3)

Answers (3)

Active Contributor
0 Kudos

Hi Shen,

You can do this in two ways :

1.If you are above XI3.0 SP14 then you can use the node function "mapWithDefault" in between the mapping. This will create the xml tag for the field on the target side even if you are not having those fields in the source side i.e., idoc.

2.At first check your field exists or not at runtime & based on that If exists then you map it to the target field else if you dont have then if the field is alphanumeric then map the same length spaces as constant in the target or if the target field is numeric then map with a constant having that many no. of zeros.



>else>constant(may be with spaces or zeros)



Former Member
0 Kudos


Take that XML payload and test your mapping in IR test tab.



Former Member
0 Kudos


company_code in the target structure made as a Required field

So make it as 0--1 Occurence, then it will work