12-15-2008 6:24 AM
hi there.... i want to search for SPACE in a string. Search ' '..... is not working. CAn anyone help.
12-15-2008 6:27 AM
data: v_len type i.
IF str CA ' ' .
v_len = sy-fdpos.
ENDIF.
For your example, the above query returns v_len (sy-fdpos) as 4 and the 5th position is space.
12-15-2008 6:26 AM
Hi
Check this
:
DATA string7(30) TYPE c VALUE 'This is a little sentence.'.
WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
ULINE /1(26).
SEARCH string7 FOR ' '.
WRITE: / ' ', sy-subrc UNDER 'SY-SUBRC',
sy-fdpos UNDER 'SY-FDPOS'.
Hope it helps.
Praveen
12-15-2008 6:27 AM
data: v_len type i.
IF str CA ' ' .
v_len = sy-fdpos.
ENDIF.
For your example, the above query returns v_len (sy-fdpos) as 4 and the 5th position is space.
12-15-2008 6:35 AM
Try this code:
DATA: A(50) TYPE C VALUE 'AMIT GUPTA',
B TYPE C,
N(2) TYPE N.
N = STRLEN( A ).
DO N TIMES VARYING B FROM A0(1) NEXT A1(1) RANGE A.
IF B IS INITIAL.
" DO ANYTHING
ENDIF.
ENDDO.
03-08-2009 5:29 AM
Actually, the correct syntax to find SPACE is:
SEARCH stringname FOR '. .'.
The strange thing is that the FIND command is not able to find SPACE. At least I tried it in every way I could think of but it didn't work. So I had to use the (otherwise obsolete) SEARCH command with the above syntax.