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

update string

Former Member
0 Likes
581

Hi all,

I would like to add a '%' to a string always at position 5 in the string e.g.

XXXX1234567

becomes XXXX%1234567

Is this possible?

4 REPLIES 4
Read only

Former Member
0 Likes
542

Hi,

It is possible.

String = XXXX1234567.

str1 = String+0(4).

str2 = String+4(7).

Concatenate str1 '%' str2 into string1.

string1 will have XXXX%1234567

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

0 Likes
542

Hi Uma,

the times are over when coding was paid per line

what about


concatenate string(4) '%' string+4 into string.

In both cases a check strlen( string ) > 4 is mandatory.

Regards,

Clemens

Read only

Former Member
0 Likes
542

Hello,

Just to add on to the above point....

if we have a case where the number of characters can vary..always use the "Strlen"

Character_field = XXXX1234567.

Data :length type i.

length = strlen(character_field)

" length will now contain the number of characters.

and based on this we can do the concatenate or move

Regards

Byju

Read only

Former Member
0 Likes
542

hi

good

go through this link

http://www.sap-img.com/ab039.htm

thanks

mrutyun^