cancel
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">com.sap.aii.utilxi.misc.api.BaseRuntimeException: 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)

former_member537867
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.

Ex:

If>Idocfield>Exists>then>Idocfield

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

Regards,

Vinod.

Former Member
0 Kudos

Hi,

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

Thanks,

Boopathi

Former Member
0 Kudos

Hi,

company_code in the target structure made as a Required field

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

Regards

Seshagiri