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

validating for alphabets only

Former Member
0 Likes
1,991

Hi i have declared the following,

PARAMETERS p_prefix(2) TYPE c OBLIGATORY.

how to i ensure that the information entered into p_prefix contains only alphabets?

thanks!

regards,

r3venant

1 ACCEPTED SOLUTION
Read only

rahulkavuri
Active Contributor
0 Likes
1,768

hi for this u can use the string operations like CS,CA,CP

operator & meaning

CO Contains Only

CN Contains Not only

CA Contains Any

NA contains Not Any

CS Contains String

NS contains No String

CP Matches pattern

NP Does not match pattern

11 REPLIES 11
Read only

Former Member
0 Likes
1,768

hi,

IF  p_prefix CO sy-abcde.

* only alphabets.

ur code.......

Endif..

rgds

Reshma

Read only

Former Member
0 Likes
1,768

if p_prefix co sy-abcde.

else.

error message.

endif.

reward points if help full

Read only

rahulkavuri
Active Contributor
0 Likes
1,769

hi for this u can use the string operations like CS,CA,CP

operator & meaning

CO Contains Only

CN Contains Not only

CA Contains Any

NA contains Not Any

CS Contains String

NS contains No String

CP Matches pattern

NP Does not match pattern

Read only

Former Member
0 Likes
1,768

At selection-screen on p_prefix.

if p_prefix cs 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

Message e000(0) with ' contains alphabets'.

endif.

Read only

Former Member
0 Likes
1,768

hiii,,

For this you can validate the field under AT SELECTION SCREEN event as follows..

****************************************************************************************

REPORT ZTEST NO STANDARD PAGE HEADING LINE-SIZE 255.

PARAMETERS P_PREFIX(2) TYPE C OBLIGATORY.

AT SELECTION-SCREEN ON P_PREFIX.

CASE P_PREFIX.

WHEN 'a' OR 'b' OR 'c' OR 'd' OR 'e' OR 'f' OR 'g' OR 'h' OR 'i' OR 'j' OR 'k' OR 'l' OR 'm'

OR 'n' OR 'o' OR 'p' OR 'q' OR 'r' OR 's' OR 't' OR 'u' OR 'v' OR 'w' OR 'x' OR 'y' OR 'z'

OR 'A' OR 'B' OR 'C' OR 'D' OR 'E' OR 'F' OR 'G' OR 'H' OR 'I' OR 'J' OR 'K' OR 'L' OR 'M'

OR 'N' OR 'O' OR 'P' OR 'Q' OR 'R' OR 'S' OR 'T' OR 'U' OR 'V' OR 'W' OR 'X' OR 'Y' OR 'Z'.

WHEN OTHERS.

MESSAGE 'error' TYPE 'E'.

ENDCASE.

****************************************************************************************

just copy paste this code and this will work...

<b>REWARD POINTS FOR USEFUL ANSWERS.</b>

Regards,

Tejas

Read only

Former Member
0 Likes
1,768

parameters : p_text(2).

at selection-screen.

if p_text co 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. " or you can use sy-abcde

else.

message 'Not only alphabets' type 'E'.

endif.

regards

shiba dutta

Read only

Former Member
0 Likes
1,768

PARAMETERS p_prefix(2) TYPE c OBLIGATORY.

at selection-screen.

if p_prefix co sy-abcde.

< code >

else.

error message.

endif.

Read only

0 Likes
1,768

hi ,

i answerd ur query correctly and even at first.

But still 2 points...

Rgds

Reshma

Read only

Former Member
0 Likes
1,768

at selection-sereen on field p_prefix.

if p_prefix co sy-abcde.

else.

error message.

endif

regards,

ananth

Read only

Former Member
0 Likes
1,768

alright, tahnks for all the reply!... i got it working now!

regards,

r3venant

Read only

Former Member
0 Likes
1,768

Hi,

If p_prefix co sy-abcde.

your code.

endif.

Regards,

Sandhya