cancel
Showing results for 
Search instead for 
Did you mean: 

Replace semicolon in the input string using groovy script for SAP CPI

former_member538292
Participant
0 Kudos

Hello All,

in message mapping,The name value is coming from source and i need to check name having semicolon(;) if there then i will send output in

quotations ("").

Name ----> Name_DE

EX:

intput output

ABCDS; "ABCDS;"

EFG; THE "EFG; THE"

for the same need a groovy script in message mapping.

Regards,

Kumar.

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor

Hello Kumar,

Below should work for you.

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

def String exampleSingleValue(String field1,, MappingContext context) {
	
	def inp=field1.toString();
	if (inp.contains(";"))
          inp="\""+inp+"\""


	return inp;
}

Regards,

Sriprasad Shivaram Bhat

Answers (0)