‎2006 Aug 21 5:12 PM
Hi,
I would like to know is there any simple code that would able to let me to see whether an input is an integer or is a character. For example, isNumber(0012) would return true and isNumber(CRMD) would return false.
Thanks a lot!
Regards,
Anyi
‎2006 Aug 21 5:18 PM
‎2006 Aug 21 5:18 PM
‎2006 Aug 21 5:21 PM
Function module NUMERIC_CHECK returns NUMC for numeric and CHAR for character inputs.
Regards
Sridhar
‎2006 Aug 21 5:21 PM
you can use the function module:
NUMERIC_CHECK:
sample code:
DATA: TYPE LIKE DD01V-DATATYPE.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = VALUEIN
IMPORTING
STRING_OUT = HFELD
HTYPE = TYPE.
IF TYPE EQ 'NUMC'.
write:/ 'Numeric'.
else.
write:/ 'not numeric'.
ENDIF.
Regards,
ravi
‎2006 Aug 21 5:26 PM
U can even use the logic..
IF linput CA sy-abcde.
write : / 'Non-numberic'.
else.
write : / 'Numeric'.
endif.
Regards
Anurag
‎2006 Aug 21 5:26 PM
This should get you all the data about a field that you require:
REPORT zz_temp.
DATA: g_i TYPE i.
DATA: g_c(20) TYPE c.
DATA g_type TYPE c.
DATA g_len TYPE i.
DESCRIBE FIELD g_i TYPE g_type.
WRITE: / g_type.
DESCRIBE FIELD g_c TYPE g_type LENGTH g_len..
WRITE: / g_type, g_len.