Application Development and Automation 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: 
Read only

simple command for char and number

Former Member
0 Likes
1,078

how i can ask;

i want to know if the field contain numbers,or alphanumeric..

if zdata is alpha or

if zdate is alphanumeric....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,045

Just check.


IF zdata CO '0123456789'.
  "zdata is numeric
ELSE.
  "zdata is alphanumeric
ENDIF.

how i can ask;

i want to know if the field contain numbers,or alphanumeric..

if zdata is alpha or

if zdate is alphanumeric....

8 REPLIES 8
Read only

Former Member
0 Likes
1,045

Hi,

Please make the question more clear if possible....

Regards,

Phani,

Read only

0 Likes
1,045

once zdata = 1234

once zdata = 1A45

how i can when he contains only number, and when char too

Read only

Former Member
0 Likes
1,045

Hi,

Only CHAR data type stores alpha numeric, remaining will not store char values.

So check whether value contains any char otherwise it would be numeric values.

Regards,

Sunil

Read only

Former Member
0 Likes
1,045

Hi,

You can use the syntax Contains Not Any(NA) or Contains Only(CO) to check if a variable contains numeric values or if its alphanumeric.

Thanks

Vasudha

Read only

Former Member
0 Likes
1,045

IF field CO '0123456789'.

"numeric

ELSEIF field CA '0123456789'

"alphanumeric

ENDIF.

Read only

Former Member
0 Likes
1,046

Just check.


IF zdata CO '0123456789'.
  "zdata is numeric
ELSE.
  "zdata is alphanumeric
ENDIF.

Read only

Former Member
0 Likes
1,045

Please use SY-ABCDE to check for alphabets.

You can check for numbers using statement zvalue CO '0123456789'.

Please use F1 documentation to check on CO, CN and other optional phrases.

Read only

Former Member
0 Likes
1,045
DATA a TYPE string VALUE 'abcd'.
DATA b TYPE string VALUE '12345ab'.
IF a  CA 'abcdefghijklmnopqrstuvwxyz'.
  MESSAGE 'only alphabets' TYPE 'I'.
ELSE.
  MESSAGE 'alphanumeric' TYPE 'I'.
ENDIF.