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

how to write Error message for select options?

Former Member
0 Likes
2,547

Hi

i have this select option statement

SELECT-OPTIONS: s_fevor FOR afko-fevor.

how to write error message for this?

Regards

Smitha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,163

Error messages are displayed for Select-options mostly on two conditions:

1) You needs to check wether a value is entered or not its done by:

a)

Select-options:SELECT-OPTIONS: s_fevor FOR afko-fevor Obligatory.

In this case error message is automatically throwed by system.

b) You can do this in Selection Screen events.

Ex:

AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
IF S_FEVOR-LOW IS INITIAL.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.

2) You need to Validate the entered value:

You can do this in Selection Screen events.

Ex:

AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.

SELECT FEVOR
             FROM AFKO
             INTO AFKO-FEVOR
             UP TO 1 ROWS
 ENDSELECT.         
IF SY-SUBRC NE 0.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.

Regards,

Gurpreet

4 REPLIES 4
Read only

_IvanFemia_
Active Contributor
0 Likes
1,163

Hi,

Try this:

AT SELECTION-SCREEN ON s_fevor.
your checks....
if fail...
MESSAGE text TYPE 'E'.

Regards,

Ivan

Read only

Former Member
0 Likes
1,163

try this

At selection-screen.

if s_fevor is initial. " or is not initial accoding to ur req. .

message 'Please Enter Value in s_fevor' TYPE 'E'.

endif.

Edited by: shishir deshmukh on Apr 11, 2009 1:44 PM

Read only

Former Member
0 Likes
1,164

Error messages are displayed for Select-options mostly on two conditions:

1) You needs to check wether a value is entered or not its done by:

a)

Select-options:SELECT-OPTIONS: s_fevor FOR afko-fevor Obligatory.

In this case error message is automatically throwed by system.

b) You can do this in Selection Screen events.

Ex:

AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
IF S_FEVOR-LOW IS INITIAL.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.

2) You need to Validate the entered value:

You can do this in Selection Screen events.

Ex:

AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.

SELECT FEVOR
             FROM AFKO
             INTO AFKO-FEVOR
             UP TO 1 ROWS
 ENDSELECT.         
IF SY-SUBRC NE 0.
MESSAGE 'XXXXX' TYPE 'E'.
ENDIF.

Regards,

Gurpreet

Read only

Former Member
0 Likes
1,163

Use this code !

AT SELECTION-SCREEN ON S_FEVOR. " OR AT SELECTION-SCREEN
 SELECT SINGLE FEVOR
               FROM AFKO
               INTO AFKO-FEVOR.
IF SY-SUBRC NE 0.
MESSAGE 'PLEASE ENTER VALUE FOR FEVOR' TYPE 'E'. 
" or you can use message class message - MESSAGE E(000) FROM <CLASS NAME>.
ENDIF.

when you declare select options as obligatory system will throw error but if you want to validate the date entered you need to use at selection screen. Depends on your requirement.

Regards,

Lalit Mohan Gupta.