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

regarding CO & CA

Former Member
0 Likes
383

Hi frnds,

This is a simple logic which i felt shuld work in my exit where we are making the Telephone number field as mandatory entry of numbers only between

0-9.

so This is what i tried.

<code>

DATA : V_TELF1(16) TYPE C.

V_TELF1 = I_KNA1-TELF1.

if v_telf1 CA '0123456789'.

MESSAGE 'GOOD' TYPE 'S'.

ELSE .

message 'PLEASE ENTER NUMBERS BETWEEN 0-9 ONLY' type 'E'.

ENDIF.

</code>

Here the problem is when i m giving only characters then its going out but when i giving some charcters and some values then the condition is getting true.

I have also tried with 'CO' ,its always becoming false.

so any solutions frnds.

regards,

sanjay

2 REPLIES 2
Read only

gopi_narendra
Active Contributor
0 Likes
361

You can use the SY-ABCDE infact.

Check this code below

PARAMETERS : p_123(10) TYPE c.

AT SELECTION-SCREEN.
  IF p_123 CA sy-abcde.
    MESSAGE e000(zam) WITH 'Contains Alphabets'.
  ENDIF.

Regards

Gopi

Read only

Former Member
0 Likes
361

declare one more variable of type n

i.e

DATA : V_TELF1(16) TYPE N.

DATA : CV_TELF1(16) TYPE C.

CV_TELF1 = I_KNA1-TELF1.

V_TELF1 = CV_TELF1.

if V_TELF1 CS CV_TELF1.

write : 'correct number'.

else

write: ' wrong number'.

endif.