cancel
Showing results for 
Search instead for 
Did you mean: 

Replace special characters inside mapping using UDF in SAP CPI

n_rvsavinashvarma
Participant
0 Kudos
4,128

Hi Everyone,

We have a requirement in SAP CPI to read each special character from the input and replace it with respective value.

Input :

<Data1>Árvíztűrő tükörfúrógépÆâÇßÐ</Data1>

Expected Output :

<Data1>Arvizturo tukorfurogepAEaCssD</Data1>

I am able to handle the same using replace function in groovy script but i want to handle the same in mapping.

Can someone please suggest.

Regards,

Avinash

View Entire Topic
0 Kudos

Hi Avinash,

Try below code as a custom groovy udf in message mapping, and use it for required fields as a mapping rule.

import java.text.Normalizer
str = Normalizer.normalize(str, Normalizer.Form.NFD);
str = str.replaceAll("[^\\p{ASCII}]", "");return str;

Regards,

Srikanth Vadlamani

0 Kudos

Thanks Srikanth,

Its worked for me.

Regards,

Abdul