2007 Apr 03 12:25 PM
Hi experts,
how can we search for a space in a string.
the following code is giving sy-subrc = 4 and sy-fdpos = 0 even after i'm having spaces between the strings.
DATA: STR(25) TYPE C VALUE 'welcome abc ghj',
SEARCH STR FOR ' '.
WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.
can anybody tell me how to do it
Rgds,
Prajith
2007 Apr 03 12:29 PM
hI..
IF STR CA SPACE.
*WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.
ENDIF.
Hi experts,
how can we search for a space in a string.
the following code is giving sy-subrc = 4 and sy-fdpos = 0 even after i'm having spaces between the strings.
DATA: STR(25) TYPE C VALUE 'welcome abc ghj',
SEARCH STR FOR ' '.
WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.
can anybody tell me how to do it
Rgds,
Prajith
2007 Apr 03 12:29 PM
hI..
IF STR CA SPACE.
*WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.
ENDIF.
2007 Apr 03 12:30 PM
Hi,
DATA: STR(25) TYPE C VALUE 'welcome abc ghj',
SEARCH STR FOR SPACE.
WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.Regards
Sudheer
2007 Apr 03 12:38 PM
HI,
CHANGE ' ' TO ` `.
TRY THIS CODE.
DATA: STR(25) TYPE C VALUE 'welcome abc ghj',
SEARCH STR FOR <b><b>` `</b>.</b>
WRITE:/ SY-SUBRC.
WRITE:/ SY-FDPOS.
REGARDS,
ANANTH
Message was edited by:
ananth
2007 Apr 03 12:39 PM
hi prajith
<u><i><b>first method</b></i></u>
SEARCH STRING FOR SPACE.
Here STRING would be your String, if this find the Space in your string then the SY-FDPOS will be the position number in the string, if there is no spacve, then the SY-FDPOS will be blank
<u><i><b>second method</b></i></u>
DATA : TEXT(15) TYPE C VALUE '12345 789'.
DATA : NUM1(15),NUM2(15).
SPLIT TEXT AT SPACE INTO NUM1 NUM2.
IF NOT NUM2 IS INITIAL.
WRITE : / 'TEXT CONTAINS STRING'.
ENDIF.
regards
navjot
reward all helpfull answers