‎2008 Feb 19 9:31 AM
I have a string MIDDGBPP##SCHNRK22. I want to replace text MIDDGBPP with some other text.
The problem is that I am not able to find out the length of text in before ## signes.
y_v_str = 'MIDDGBPP##SCHNRK22'.
if y_v_str CS '##'.
y_v_offset = sy-fdpos.
endif.
Above code does not update the sy-fdpos variable. It can not find the ## sign in the y_v_str.
How to get length of the first part before ##?
Please provide code if possible.
‎2008 Feb 19 9:34 AM
Hi,
if you just want to replace the text:
replace all occurrences of 'MIDDGBPP' with 'new text' in lv_string.
grtz,
Koen
Edited by: Koen Labie on Feb 19, 2008 10:34 AM
‎2008 Feb 19 9:36 AM
try to split the text at ## and then use strlen on the first part
y_v_str = 'MIDDGBPP##SCHNRK22'.
split y_v_str at '##' into v_first v_second.
v_length = strlen( v_first ). " v_length contains the length
‎2008 Feb 19 9:46 AM
split y_v_str1b at '##' into y_v_first y_v_second.
does not work...
It does not find out the ## signes and y_v_first and y_v_second remains empty.
‎2008 Feb 19 9:40 AM
Hi Suhas,
U can use -
REPLACE 'MIDDGBPP' IN y_v_str WITH 'XXXX'.
‎2008 Feb 19 9:48 AM
‎2008 Feb 19 9:49 AM
Hi,
Check the below code...
y_v_str = 'MIDDGBPP##SCHNRK22'.
split y_v_str at '##' into v_str1 v_str2.
v_length = strlen( v_str1 ).
y_v_str(v_length) = '<your own text>'.
Rgds,
Bujji
‎2008 Feb 19 9:56 AM
Hi try doing like this.
SEARCH y_v_str FOR '##'.
CHECK sy-subrc IS INITIAL.
w_fdpos = sy-fdpos.
MOVE owntext TO y_v_str+0(w_fdpos).
In this case sy-fdpos will be set to 8. So u can replace ur first 8 characters by ur own text
Thanks,
Vinod.
Edited by: Vinod Vemuru on Feb 19, 2008 3:27 PM
‎2009 Oct 21 9:25 AM