cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Integration Suite - Message Mapping - addContextChange in UDF is ignored

PAST
Discoverer
0 Likes
333

Hi expterts,

I am trying to merge several single values into one structure using an UDF with the addContextChange function.
Unfortunately it does not work as expected. 

My source structure look similar to this all with occurence 0..1:
[...]
costCenter1 
costCenter2
costCenter3
percentage1
percantage2
percentage3
[...]

Inside the target message I would like to group them in a structure like this:
[...]
costDistribution (0..*)
- costCenter (1..1)
- percentage (1..1)
[...]

To map the values I am using an UDF function:
def void costDistribution(String[] costCenter1, String[] costCenter2, String[] costCenter3, String[] percentage1, String[] percentage2, String[] percentage3, Output parentNode, Output costCenters, Output percentages, MappingContext context){ ... }

For test purposes I tried this with static values to get a feeling for the context change function and tried this:
parentNode.addValue("004025235")
costCenters.addValue("004025235")
percentages.addValue("80")

parentNode.addContextChange()
costCenters.addContextChange()
percentages.addContextChange()

parentNode.addValue("004025240")
costCenters.addValue("004025240")
percentages.addValue("20")

My expection in the target would be to have several costDistribution nodes with the corresponding values like this:
[...]
costDistribution

costCenter 004025235
- percentage 80
costDistribution
- costCenter004025240
- percentage 20
[...]

In Reality the first block is generated. May someone explain me how I need to use the contextChange function to achieve the wanted structure?
Thank you all in advance.

Best regards

Accepted Solutions (0)

Answers (0)