Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

To check if a variable is made of only numbers

former_member228751
Contributor
0 Kudos

Hi Expets,

How to check if a variable (DATA: var(12) TYPE C) is made of only numbers. It should not contain any alphabets or spaces or special characters.

Thanks,

Sachin

6 REPLIES 6

Former Member
0 Kudos

Press F1 on CO.

Contain only '1234567890'

kesavadas_thekkillath
Active Contributor
0 Kudos

data:val(10) type c value '1234567890'.

if input co val.

"True

else

"False

endif.

Also check for any regex pattern available for this.

former_member156446
Active Contributor
0 Kudos
if var CA sy-abcde.

write:/ 'Contains characters'.

else.
write:/ 'Contains all numbers'.
endif.

0 Kudos

Hi Jay,

Will sy-abcde consider special characters too ?

0 Kudos

Use FM : NUMERIC_CHECK

Former Member
0 Kudos

Moderator message - Please do not ask or answer basic questions - thread locked

Rob