‎2006 Nov 04 8:59 AM
Hi abappers,
I need to check whether the content of a text field is numeric type or of character type? please any body can tell me how to do this?
Regards
Naren
‎2006 Nov 04 9:02 AM
hi,
CATS_NUMERIC_INPUT_CHECK
or
You can use the Function Module:
numeric_check.
Usage:
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = X
IMPORTING
STRING_OUT = X
HTYPE = H_TYPE.
if h_type = 'CHAR'.
WRITE:/ 'NOt Numeric'.
else.
write:/ 'Numeric'.
ENDIF
********without FM*********
If field CO '1234567890'.
Then its number.
else.
then character.
Endif.
rgds
anver
if hlped pls mark points
<i>hi narendran did it work</i>
‎2006 Nov 04 9:02 AM
hi,
CATS_NUMERIC_INPUT_CHECK
or
You can use the Function Module:
numeric_check.
Usage:
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = X
IMPORTING
STRING_OUT = X
HTYPE = H_TYPE.
if h_type = 'CHAR'.
WRITE:/ 'NOt Numeric'.
else.
write:/ 'Numeric'.
ENDIF
********without FM*********
If field CO '1234567890'.
Then its number.
else.
then character.
Endif.
rgds
anver
if hlped pls mark points
<i>hi narendran did it work</i>
‎2006 Nov 04 12:08 PM
hi,
You can even use <b>CATS_NUMERIC_INPUT_CHECK</b>
* Check for Numeric Value
call function 'CATS_NUMERIC_INPUT_CHECK'
exporting
input = t_return-fieldval
exceptions
no_numeric = 1
others = 2.
if sy-subrc = 0.
read table t_f4_table index t_return-fieldval.
endif.