‎2007 Aug 16 5:10 PM
I want to replace all occurances of
<b>/tmp/</b>
with
<b>\windows\homedir\</b> in the variants set for the programs.
The program name is on selection screen and i am dynamically reading variants.
REPLACE '/tmp/' WITH '\windows\homedir\' into w_path.
works fine.
If I now create paramters that accept the 'from text' and 'to text' and use Replace, it doesnt work. (SY-SUBRC = 4)
parameters : p_from type rlgrap-filename,
p_to type rlgrap-filename.
replace P_FROM with P_TO into w_path.
I need the from and to texts to be user inpits.
Another question : REPLACE only changes first occurance in a string, what if I want to REPLACE all occurances?
for ex in
wwlvfs1009\SystemFolders\DEV\' , I want to replace all '\' with '/'
‎2007 Aug 16 5:20 PM
to replace all occurances u can use
translate <field> using '\/' into <field>
in the quotes first give the symbol that u want to replace
next with the symbol that replaces that.(without space)
hope this helps u
‎2007 Aug 16 5:14 PM
Check this out... hope it helps
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/replace.htm
‎2007 Aug 16 5:20 PM
to replace all occurances u can use
translate <field> using '\/' into <field>
in the quotes first give the symbol that u want to replace
next with the symbol that replaces that.(without space)
hope this helps u
‎2007 Aug 17 9:14 AM
‎2007 Aug 16 5:48 PM
HI,
Do this way.
do..
replace
if sy-subrc ne 0.
exit.
endif.
enddo.
‎2007 Aug 17 9:22 AM
Hi... Vaishali.
To Replace all the Occurreneces,
This is the command you have to use.
<b>REPLACE ALL OCCURRENECES OF '/tmp/'
IN w_path WITH '\windows\homedir\' .</b>
<b>Reward if Helpful</b>
‎2007 Aug 17 9:35 AM
What version of SAP are you on? I am on 4.6, and REPLACE ALL OCCURENCES is a syntax error.