cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically create target xml nodes based on the source fields

10-18-2023 8:25 AM
pi_consultant1 Participant
1046 views 3 comments
0 Likes
SAP Managed Tags
Subscribe

HI Experts,

I have the following Source structure:

The Fields can be more than 5

Ive to create the following target structure:

Can you advise how to dynamically create target XML nodes based on the source xml fields, starting from name4/value4?

Thank you in advance,

John

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

fprokopiuk
Active Participant
0 Likes

Is the input structure dynamic? From your example it doesn't looks like it so you can simply map it manually. For each new name/Value create new Test instance on receiver side and map corresponding source Field to Limscode/Value. To choose name use CopyValue(1) and for value use CopyValue(2) - both with context changed to Tests level.

So something like:

Test(1)
Field4 (context Tests) ---> CopyValue(1) ---> Limscode
Field4 (context Tests) ---> CopyValue(2) ---> Value

Test(2)
Field5 (context Tests) ---> CopyValue(1) ---> Limscode
Field5 (context Tests) ---> CopyValue(2) ---> Value

Test(x) - add as many as you need for the input structure
Field(x+3)(context Tests) ---> CopyValue(1) ---> Limscode
Field(x+3) (context Tests) ---> CopyValue(2) ---> Value

pi_consultant1
Participant
0 Likes

The source structure is actually a csv file, with the first line the name of the fields (so name1, name2,...) fields and the second line are the values (value1, value2,...), the place and the number of the values can vary everytime.

So I would like to create the target fields dynamically, I made them now manually. So Im wondering if this is also possible dynamically and how to achieve that.

If you have an idea please let me know.

Br,

John

fprokopiuk
Active Participant
0 Likes

OK understood, you can then try to follow this blog: Message Mapping : Play around with target structure