‎2008 Sep 16 9:21 AM
Hi everyone,
In ABAP, if I want to replace * with & which in the variable 'input1'. How to write the code?
Thanks!
‎2008 Sep 16 9:22 AM
‎2008 Sep 16 9:22 AM
Type REPLACE into the abap editor, and then press F1. or TRANSLATE can also be used.
‎2008 Sep 16 9:22 AM
‎2008 Sep 16 9:22 AM
‎2008 Sep 16 9:23 AM
wuyia,
Use REPLACE ALL OCCURENCES.
For syntax, check ABAPHELP transaction.
K.Kiran.
‎2008 Sep 16 9:29 AM
‎2008 Sep 16 9:31 AM
Hi Wuyia,
Try this way:
Data:
w_char(20).
w_char = 'ab*c*def*h'.
REPLACE ALL OCCURRENCES OF '*' IN w_char WITH '&'.
Write: w_char.With luck,
Pritam.
‎2008 Sep 16 9:32 AM
Use this sample code
MOVE 'ABCB' TO FIELD.
REPLACE 'B' WITH 'string' INTO field.
returns:
FIELD = 'AstringCB', SY-SUBRC = 0
The fields f and g in the REPLACE statement should not overlap.
Otherwise, the result is undefined.
Regards
Alpesh