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: 

validating for alphabets only

Former Member
0 Kudos

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

rahulkavuri
Active Contributor
0 Kudos

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

Former Member
0 Kudos

hi,

IF  p_prefix CO sy-abcde.

* only alphabets.

ur code.......

Endif..

rgds

Reshma

Former Member
0 Kudos

if p_prefix co sy-abcde.

else.

error message.

endif.

reward points if help full

rahulkavuri
Active Contributor
0 Kudos

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

Former Member
0 Kudos

At selection-screen on p_prefix.

if p_prefix cs 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

Message e000(0) with ' contains alphabets'.

endif.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

PARAMETERS p_prefix(2) TYPE c OBLIGATORY.

at selection-screen.

if p_prefix co sy-abcde.

< code >

else.

error message.

endif.

0 Kudos

hi ,

i answerd ur query correctly and even at first.

But still 2 points...

Rgds

Reshma

former_member533584
Contributor
0 Kudos

at selection-sereen on field p_prefix.

if p_prefix co sy-abcde.

else.

error message.

endif

regards,

ananth

Former Member
0 Kudos

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

regards,

r3venant

Former Member
0 Kudos

Hi,

If p_prefix co sy-abcde.

your code.

endif.

Regards,

Sandhya