cancel
Showing results for 
Search instead for 
Did you mean: 

Node function in graphical mapping in SAP CPI

06-06-2021 8:22 PM
1698 views 2 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi All,

Hope you and your family are doing great!!

I need help to achieve one scenario.

Input structure is:

<data>

<record>

<name>john</name> <city>pune</city> <doc_no>1</doc_no>

</record>

<sub_record>

<doc_no>1</doc_no> <empid>321</empid> <asset>cpu</asset>

</sub_record>

<record>

<name>mark</name> <city>delhi</city> <doc_no>2</doc_no>

</record>

<sub_record>

<doc_no>2</doc_no> <empid>44</empid> <asset>computer</asset>

</sub_record>

<sub_record>

<doc_no>2</doc_no> <empid>89</empid> <asset>mouse</asset>

</sub_record>

</data>

Key is doc_no and output that I need is :

<?xml version="1.0" encoding="UTF-8"?>

<data>

<header>

<name>john</name><city>pune</city><doc_no>1</doc_no>

<sub_record>

<empid>321</empid><asset>cpu</asset>

</sub_record>

</header>

<header>

<name>mark</name><city>delhi</city><doc_no>2</doc_no>

<sub_record>

<empid>44</empid><asset>computer</asset>

</sub_record>

<sub_record>

<empid>89</empid><asset>mouse</asset>

</sub_record>

</header>

</data>

Can you please help me to identify which node functions are used to get the desired output.

Appreciate your help in advance.

Thanks,
Divya

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor
0 Likes

Hi Divya,

You can something try like the below :

  • Assuming the record and related sub_record will come in the same order in source xml.

Output :

Thanks,

Manoj

Answers (1)

Answers (1)

babruvahana
Contributor
0 Likes

Hey pandeydivya82,

It seems to be just a structural change in the output and removing the doc_no field in the sub_record node.

Try to do the one to one mapping and just change the contexts of the input if required. I don't think any node-functions is required for this.

Lots of blog post are already available in the community on node functions, I would suggest you to go through them.

Regards,

Pavan