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

Validation

Former Member
0 Likes
474

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

3 REPLIES 3
Read only

Former Member
0 Likes
437

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

Read only

0 Likes
437

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.

Read only

matt
Active Contributor
0 Likes
437

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