‎2006 Apr 25 9:40 PM
Hello,
How can I validate that a string a I got is only numeric?.
I have this for example:
DATA: str type string.
str = 'a1a1'.
I need to find out if str is ONLY numeric, not alphanumeric, any ideas?,
Thanks!!!
Gabriel
‎2006 Apr 25 9:44 PM
Hi Gabriel,
Please declare a string 'str2'with 'A to Z'.
in the statement,
if str CA str1.
then
...
else
...
endif.
It will work.
shylesh
‎2006 Apr 25 9:44 PM
Hi Gabriel,
Please declare a string 'str2'with 'A to Z'.
in the statement,
if str CA str1.
then
...
else
...
endif.
It will work.
shylesh
‎2006 Apr 25 9:58 PM
Hi Gabriel,
By using a check for value in SY-ABCDE you can check that..
DATA: str type string.
str = 'a1a1'.
IF STR CA SY-ABCDE."Checks if the string contains any alphabets from A to Z.
...
ELSE.
.....
ENDIF.
‎2006 Apr 25 10:09 PM
Try:
REPORT ztest MESSAGE-ID 00.
PARAMETERS: p_input(10).
DATA numbers(10) VALUE '1234567890'.
IF p_input CO numbers.
WRITE: /001 p_input, 'is numeric.'.
ELSE.
WRITE: /001 p_input, 'contains non-numeric characters.'.
ENDIF.Rob
‎2006 Apr 25 10:17 PM
Hi,
Thank you all for your help, I already tryed as you all said, but it worked for me like this:
IF str CN '1234567890' AND sy-fdpos EQ '1'.
...
endif.
Thanks,
Gabriel