Wednesday, 27 March 2019

To split a string at a particular character using Groovy script in SAP CPI



To split a string at a particular character from the message body, utilize the script in message mapping to split.


import com.sap.it.api.mapping.*;

def void substring_CostCenter(String[] CC, Output output, MappingContext context)
{
String[] list = CC[0].split("_");

if (list.length > 0)
{
for (int j = 1; j < list.length; j++)
{

output.addValue(list[j]);
} }
}



No comments:

Post a Comment