Skip to Content
0
May 27, 2015 at 02:33 PM

Message mapping with missing source elements

462 Views

Hello

Having PI message mapping not as a daily task, it is often quite cumbersome for me to find a working solution in this context mapping environment as it is with the following apparently simple request.

Requirement: Map the partner number for role "WE" (element PARVW) to mandatory ShipToNumber field.

Input:

<INVOIC02>

<E1EDKA1>

<PARVW>RS</PARVW>

<NAME1>abcd</NAME1>

</E1EDKA1>

<E1EDKA1>

<PARVW>RE</PARVW>

<PARTN>123</PARTN>

<NAME1>Bill to</NAME1>

</E1EDKA1>

<E1EDKA1>

<PARVW>WE</PARVW>

<PARTN>456</PARTN>

<NAME1>Ship to</NAME1>

</E1EDKA1>

<E1EDKA1>

<PARVW>ZE</PARVW>

<PARTN>789</PARTN>

<NAME1>xyz</NAME1>

</E1EDKA1>

Mapping:

PARVW [context change INVOIC02] -> equalsS Constant = "WE"

(ifWithoutElse)

then PARTN [context change INVOIC02] -> mapWithDefault -> ShipToNumber

Problem: ShipToNumber now contains the value 789 instead of 456 because to first E1EDKA1 segment is missing the PARTN element, i.e. the context is missing an entry.

I've tried various combinations of node functions and context changes, but some way or another it results in a solution not working properly either mapping the wrong value, not creating the target element at all when the node with WE doesn't exist, or giving the cannot create target element error.

Do I need to create an UDF for this which appears to me to be a common issue as IDocs are often missing elements in segments.

Thanks in advance for any feedback or solution.

Regards,

Daniel