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: 

Validation

Former Member
0 Kudos

How to validate a user name so that it can accept only alphabates....?? no digits...

3 REPLIES 3

Former Member
0 Kudos

Hi,

Do like this

Parameters: P_UNAME TYPE SY-UNAME.

AT SELECTION-SCREEN ON P_UNAME.

IF P_UNAME CA '0123456789'.

MESSAGE 'ENTER ONLY ALPHABATES' TYPE 'E'.

ENDIF.

Regards,

Satish

0 Kudos

PARAMETERS: P_NAME type sy-uname.

DATA: l_name type sy-uname.

Move p_name to l_name upper case .

IF NOT L_UNAME CO 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

MESSAGE 'ENTER ONLY ALPHABATES' TYPE 'E'.

ENDIF.

matt
Active Contributor
0 Kudos

You don't need the UPPER CASE bit, since the parameter has not been defined as allowing lower case.

The system variable sy-abcde contains the alphabet in uppercase.

PARAMETERS: P_NAME type sy-uname.

IF NOT p_name CO sy-abcde.
  MESSAGE 'ENTER ONLY ALPHABETIC CHARACTERS' TYPE 'E'.
ENDIF.

matt