‎2006 Dec 12 9:23 PM
Hi,
I need to check the first 2 places of a string and check if they are characters or numerical.
For example: ch1 = string
Ch2 = 20string
I need to differentiate them depending on their first 2 places.
Anyone please tell me the syntax
Thank you
‎2006 Dec 12 9:25 PM
‎2006 Dec 12 9:25 PM
Hi,
You can use FM NUMERIC_CHECK to validate numeric or character by passing the first two character string.
DATA: WA_STRING TYPE STRING,
WA_HTYPE LIKE DD01V-DATATYPE.
MOVE CH1(2) TO WA_STRING.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = WA_STRING
IMPORTING
HTYPE = WA_HTYPE.
IF WA_HTYPE = 'NUMC'.
WRITE: / 'numeric value'.
ELSE.
WRITE: / 'character value'.
ENDIF.
Regards,
Ferry Lianto
‎2006 Dec 12 9:25 PM
‎2006 Dec 12 9:25 PM
Hi,
Check this...
DATA: CH1 TYPE STRING.
DATA: CH2 TYPE STRING.
CH1 = 'STRING'.
IF CH1+0(2) CO '01234567890'.
WRITE: / 'TRUE'.
ELSE.
WRITE: / 'FALSE'.
ENDIF.
Thanks,
Naren