‎2008 Oct 10 4:45 PM
hello,
i need to check a constantes of 2 character if it's a NUMBER or not ; is there a MF or a method wich do this.
thank you for help.
‎2008 Oct 11 12:18 AM
data: var type C value '02'.
if var+0(1) ca sy-abcde and var+1(1) ca sy-abcde.
write: its not a character.
endif.
‎2008 Oct 10 4:53 PM
Hi,
You dont need a method or a FM to do this. Jus go with the simple IF stmt.
IF c_num CO '0123456789'.
.....
.....
ENDIF.
‎2008 Oct 10 5:27 PM
‎2008 Oct 10 7:56 PM
Yes forgot to mention tat. Add a '.' too.
Data: l_num(6) TYPE c value '123.56'.
if l_num CO '0123456789.'.
write 😕 'Success'.
else.
write 😕 'failure'.
endif.
‎2008 Oct 10 7:57 PM
‎2008 Oct 10 8:05 PM
... and 1234.56.789 would pass.
So the point is that the OP has to decide what his or her numbers should consist of. At that point it will be easy to code.
Rob
‎2008 Oct 11 12:18 AM
data: var type C value '02'.
if var+0(1) ca sy-abcde and var+1(1) ca sy-abcde.
write: its not a character.
endif.