‎2008 Feb 22 6:39 PM
I have below program:
DATA: V_1(03) TYPE C,
V_2 TYPE STRING.
V_1 = '9.0'.
SEARCH V_1 FOR '.' .
IF SY-SUBRC EQ 0.
REPLACE '.' IN V_1 WITH ' '.
ENDIF.
but search statement is not working,it sy-subrc eq 4.
Can anybody tell me why it is like this ?
‎2008 Feb 22 7:02 PM
‎2008 Feb 22 6:44 PM
hi,
do this way...
DATA: V_1(03) TYPE C,
V_2 TYPE STRING.
V_1 = '9.0'.
REPLACE '.' IN V_1 WITH ' '.Regards,
Santosh
‎2008 Feb 22 6:46 PM
From F1 on SEARCH:
The statement SEARCH has been replaced with the statement FIND in Release 6.10.
The search patterns 'str' and '.str.' are identical apart from a few exceptions. You must
use '.str.' when the pattern str contains spaces (at the end), the '.' character (at the
beginning and end), or the '*' character (at the end). You should also use '.str.' when the
search string str is variable and you cannot predict when you write the statement what the
contents of the string will be.
This should work:
DATA: v_1(03) TYPE c,
v_2 TYPE string.
v_1 = '9.0'.
SEARCH v_1 FOR '...' . <====
IF sy-subrc EQ 0.
REPLACE '.' IN v_1 WITH ' '.
ENDIBut it will compress the space.
Rob
Edited by: Rob Burbank on Feb 22, 2008 1:48 PM
‎2008 Feb 22 7:02 PM