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

error message for the select options

Former Member
0 Likes
375

hi.

i want to throw thw error message if the user enters the value not valid(not in the range) for the zregion1 of zbwcntry of the select options.

and user should be able to correct it before moving ahead.

Also,iis not a mandatory field,So if it is initial,it can b blank.

but if the input doesnot lie in the range,it should give error message on the selction screen.

please guid with the line of codes.

2 REPLIES 2
Read only

JozsefSzikszai
Active Contributor
0 Likes
354
AT SELECTION-SCREEN.

IF s_...[] IS NOT INITIAL.
SELECT COUNT( * ) FROM ... WHERE field IN s_...
IF sy-subrc NE 0.
==> issue error message, that entered values are wrong
ENDIF.
ENDIF.
Read only

Former Member
0 Likes
354

Check out this code:

TABLES: PERNR.

SELECT-OPTIONS VO_PERNR FOR PERNR-PERNR.

AT SELECTION-SCREEN ON VO_PERNR.

IF VO_PERNR IS INITIAL.

MESSAGE 'Enter some employee IDs' TYPE 'E' DISPLAY LIKE 'S'.

ELSE.

IF '000001' NOT IN VO_PERNR.

MESSAGE 'Employee id: 1, not selected' TYPE 'E' DISPLAY LIKE 'S'.

ENDIF.

ENDIF.