‎2008 Oct 23 3:10 AM
Hi,
I need to write a function module which judges whether a string includes only numeric characters.
Import: a string
Export:
- True: If this is a numeric string
- False: The string includes non-numeric characters
Thanks in advance!
Best REgards, Johnney.
‎2008 Oct 23 3:20 AM
‎2008 Oct 23 3:13 AM
search before posting
its as simple as checking
xx co ( 1234567890 )
‎2008 Oct 23 3:16 AM
DATA: text(10).
text = '0123456789'.
IF string CA text.
write:/ 'numeric'.
else.
write:/ non-numeric'.
endif.
‎2008 Oct 23 3:20 AM
CA is incorrect, it needs ot be CO
DATA: text(10).
text = '0123456789'.
IF string CA text. <---------- should be CO instead of CA
write:/ 'numeric'.
else.
write:/ non-numeric'.
endif.
‎2008 Oct 23 3:28 AM
‎2008 Oct 23 3:20 AM
‎2008 Oct 23 5:25 AM
Hi ,
Try using this FM.
data in_string type string.
data out_string type string.
data h_type type string.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
string_in = in
IMPORTING
STRING_OUT = out
HTYPE = h_type.
if h_type = 'CHAR'.
WRITE:/ 'Not Numeric'.
else.
write:/ 'Numeric'.
ENDIF.
Hope this will be useful for you.
Regards,
Rohit