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 ALL issue

Former Member
0 Likes
673

Hi All,

I have a string like "Nikhil #". I need to remove # from the string but still keeping the trailing spaces. I tried REPLACE ALL and SHIFT statements but it deletes the Trailing spaces as well. Any help would be highly appreciated.

Please see there are 5 spaces between "Nikhil" and "#" and I need to remove # still keeping those spaces

Edited by: Nikhil Sood on Feb 16, 2008 12:15 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
659

Hi,

try using translate keyword.....

data string   type string.
move 'NIKHIL     #' to string.
write : string,'<-ends here'.
translate string using '# '.
write : / string,'<-ends here'.

Cheers,

jose.

6 REPLIES 6
Read only

Former Member
0 Likes
660

Hi,

try using translate keyword.....

data string   type string.
move 'NIKHIL     #' to string.
write : string,'<-ends here'.
translate string using '# '.
write : / string,'<-ends here'.

Cheers,

jose.

Read only

0 Likes
659

Even the TRANSLATE is deleting the trailing spaces. Any other clues please??

Read only

0 Likes
659

No did u try dat code...........<-end indicates the end of dat string.

Read only

0 Likes
659

You are absolutely right Jose.

The issue actually was with the "WS_DOWNLOAD" function. It trucates the trailing spaces of the lines in the itab. It does not have any option for processing otherwise. I have shifted to "GUI_DOWNLOAD" and it has TRUNC_TRAILING_BLANKS_EOL to help i nthis situation.

Thanks a lot for the help!!!

Read only

0 Likes
659

Hi,

My requirement is reverse.

How to replace all occurrunces of space with '.' ?

Your help is appreciated.

Thank you,

Surya

Read only

0 Likes
659

translate string using ' .'