‎2010 Jun 24 9:20 AM
We need to replace dashes in a string with a space.
DATA result TYPE string.
result = 'Hello--World!'.
REPLACE ALL OCCURRENCES OF '-' IN result WITH ' '.
However ABAP compresses all space and the result is
'HelloWorld!'
‎2010 Jun 24 9:31 AM
Hello
If you unnecessary to use REPLACE ALL OCCURRENCES, that try this way:
DATA result TYPE string.
result = 'Hello--World!'.
translate result using '- '.
condense result.
write result.
‎2010 Jun 24 9:31 AM
Try this.
DATA result TYPE string.
DATA blank TYPE c LENGTH 20.
result = 'Hello--World!'.
OVERLAY result WITH blank ONLY '-'.
WRITE:/ result.
REPLACE statement does not respect blanks, OVERLAY does.
‎2010 Jun 24 9:31 AM
Hello
If you unnecessary to use REPLACE ALL OCCURRENCES, that try this way:
DATA result TYPE string.
result = 'Hello--World!'.
translate result using '- '.
condense result.
write result.
‎2020 Apr 27 6:51 AM
‎2010 Jun 24 9:33 AM
have you searched SDN??
any ways...try the below one.. its a backquote
data : s1 type string value 'Hello--World!'.
replace all OCCURRENCEs OF `-` IN s1 WITH ` `. "this is the quote near by 1 in keyboard...
WRITE s1.