Skip to Content
Jun 21, 2021 at 09:26 AM

Generate JSON string using Groovy UDF in SAP CPI Mapping

858 Views Last edit Jun 21, 2021 at 04:48 AM 6 rev

Hi Guys,

I am struggling to write a UDF in CPI mapping. My requirement is to get the 3 fields from source xml , combine them in a json string and pass it to the target xml field in JSON

The source xml is as below


these fields have to pass as JSON string into customrole_info field

[{“OrgUnit”: “<department1>”, “JobCode”: “<role1>”, “JobTitle”: “<title1>”, }, {“OrgUnit”: “<department2>”, “JobCode”: “<role2>”, “JobTitle”: “<title2>”, }]

Target xml is ,


any input is much appriciated.