cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Optional Field in IDOC

Former Member
0 Kudos

Hi,

I have an interface which maps an IDOC from R3 to a database insert. The IDOC has a repeating Node with some elements under it. I have a mapping in place that checks the value of one element in the node and if it equals X then map the other element.

The problem is that both elements are Optional in the IDOC and if either is not populated in the IDOC then the mapping gets confused.

For Example, the IDOC looks something similar to this:

. So where I would expect "XXX222" to be mapped its actually "XX22" thats being mapped.

Any Ideas?

Thanks

Edited by: Gareth O´Brien on Jan 18, 2010 5:09 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Addition to the existing condition in the mapping add the condition if exists then your condition...

so that it will check whether the element is present or not if not pass some default value...

Hope this helps you

Rajesh

Former Member
0 Kudos

Rajesh,

Thanks for your timely response, I have tried the following code and its not working:

IF <Optional Field 1> == "XXX111"

&&

<optional Field 2> exists

THEN

Map <optional Field 2> with default.

It is still mapping from the previous segment.

Gareth

Former Member
0 Kudos

> IF <Optional Field 1> == "XXX111"

> &&

> <optional Field 2> exists

>

> THEN

>

> Map <optional Field 2> with default.

As shown above it will not work.

You have to map it without checking the existance of optional Field2 i.e. first of all you use MapWithDefault as shown below

Optional Field2 --->MapWithDefault(double click and put 'abcxyz')

and then do your rest of mapping Like this..

IF <Optional Field 1> == "XXX111"

then map <Optional Field 2>

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

In this cases need to change the context of the element to the top level and put the if else condition and then remove the suppress values removeSuppress ....

i.e change the context of the oprional fields to the top level and put the if exists then pass the value else pass default value or something... and use node functions to removeSuppress and split the values ..

HTH

Rajesh

Former Member
0 Kudos

Hi Rajesh,

That worked. Thanks for your help.

Gareth

Answers (1)

Answers (1)

Former Member
0 Kudos

Use "map with default" for the optional fields. This will ensure that a blank value is inserted for <OptionalField2> & your contenxts are not messed up.

-Siva Maranani