Thursday 3 June 2021

Split the value by special character @ from the string using groovy script in SAP CPI/SCPI

Split the value by special character @ from the string using groovy script in mapping level in SAP CPI/SCPI.

Written a script to handle the logic on the splitting of two string using a special character

Groovy script:

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

def void filterStatus(String[] values, Output output, MappingContext context) {
def filtered = values.findAll { v -> v.startsWith('1')|| v.startsWith('Z6')}
filtered.each { v -> output.addValue(v.split(/@/)[1]) }

}


Input: 1@2020-05-23 22:00:00

Output: 2020-05-23 22:00:00




No comments:

Post a Comment