Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Replace special characters in String

carlos_zhang3
Participant
0 Likes
1,057

Dear Guru ,

Does SAP provide the standard function that can replace the special characters in String ?

For example :

I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .

And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?

My idea is sourcing from the Message String that in tcode : SE91 .

Thanks .

Best Regards,

Carlos Zhang

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
856

Hi if the template is fixed

There is a tricky way like ,

create a message no in message class with & & & & &.

data:text type bapi_msg.

message ID 'ZSD'

type 'E'

number '901'

with p1 p2 p3 p4

into text.

write text.

5 REPLIES 5
Read only

Former Member
0 Likes
856

[Replace Special character|]

Read only

Former Member
0 Likes
856

Hi Carlos

Have you tryed with the REPLACE statement??or press F1 on REPLACE for more help?

regards

Marco

Read only

former_member224404
Active Participant
0 Likes
856

Hi Carlos,

I think instead of a standard FM you can write a one line command to do this job.

E.g.

constant: str1 type string value 'output(s) have not been processed yet ! '.

data: var1 type c,

var2 type c,

var3 type c,

var4 type c,

str type string.

concatenate var1 var2 var3 var4 str1 into str separated by space.

So str will have the final value.

Thanks,

Mainak

Read only

Former Member
0 Likes
856

Did you try passing values of P1, P2, P3.... as SPACE ?

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
857

Hi if the template is fixed

There is a tricky way like ,

create a message no in message class with & & & & &.

data:text type bapi_msg.

message ID 'ZSD'

type 'E'

number '901'

with p1 p2 p3 p4

into text.

write text.