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 Msg in Select Statement

Former Member
0 Likes
554

Hi,

Can you declare an error message under select statement?

3 REPLIES 3
Read only

varma_narayana
Active Contributor
0 Likes
532

Hi..

You can use the Message statement for this..

PARAMETERS: P_MATNR TYPE MARA-MATNR.

AT SELECTION-SCREEN ON P_MATNR.

SELECT SINGLE * FROM MARA WHERE MATNR = P_MATNR.

IF SY-SUBRC NE 0.

<b> MESSAGE E100(ZCLASS).</b>

ENDIF.

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
532

Hi

AT SELECTION-SCREEN ON P_MATNR.

SELECT SINGLE * FROM MARA WHERE MATNR = P_MATNR.

IF SY-SUBRC NE 0.

MESSAGE E000(Z00) WITH 'NO MATNR EXISTS'.

CLOSE ALL U R THREADS.

KIRAN.M

Read only

Former Member
0 Likes
532

Hi,

That depends on the event where u have used the error message.

In selection screen events u can use error message as control stops in selection screen it self. Where as if u used in selection events program execution is terminated by displaying an empty screen. So it is better not to use error message in start of selection events.

Regards,

Sankar