09-03-2008 10:41 AM
wats the command to remove characters in a string?
I have to remove 'bb' from a string
09-03-2008 10:43 AM
hi,
you can try the REPLACE statement. There will be a space in the string instead of 'bb', which you can delete with CONDENSE ... NO-GAPS.
hope this helps
ec
09-03-2008 10:43 AM
hi,
you can try the REPLACE statement. There will be a space in the string instead of 'bb', which you can delete with CONDENSE ... NO-GAPS.
hope this helps
ec
09-03-2008 11:06 AM
If you are replacing bb by ' ' there will be a gap, but why dont you replace it by ''?
09-03-2008 12:03 PM
just checked:
DATA : text(10) TYPE c VALUE 'AABBCC'.
REPLACE 'BB' IN text WITH ''.
and really text is 'AACC' after the above
(I remembered so that a space was left there, even if the replacing value was 'nothing' and I had to use the CONDENSE ... NO-GAPS afterwards to delete that unnecessary space. There are two options: 1. My memories are wrong 2. It happened in earlier releases (now I tried in 4.7). Anyway, thanks for your correction!)
09-03-2008 1:18 PM
Just said so because the condense may delete gaps which should not be affected...
Nevertheless i cant tell you if this was working different in 4.7. i started to use this command in ERP 2005.
09-03-2008 10:49 AM
Hello
DATA FIELD(10).
MOVE 'ABCBB' TO FIELD.
REPLACE 'BB' WITH ' ' INTO field.
CONDENSE field.
09-03-2008 11:05 AM
Hi
DATA lv_field(5).
MOVE 'CCCBB' TO lv_field.
SEARCH lv_field FOR 'BB'.
IF sy-subrc = 0.
REPLACE 'BB' WITH ' ' INTO lv_field.
CONDENSE lv_field.
WRITE lv_field.
ENDIF.
09-03-2008 11:20 AM
Please do not double-post or cross-post your questions.
We typically delete all the questions when this is found.
Cheers,
Julius