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.
PARVW [context change INVOIC02] -> equalsS Constant = "WE"
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.