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

former_member204025
Participant
0 Likes
1,287

Hi guys,

I have to write a error message if after entering data in the selection screen i have no data, something like this:

if ti_data[] is not initial.

perform show_report.

else.

message e002(z_mensajes).

endif.

But, if ti_data IS INITIAL, I have to come back to the selection screen, how I can do that? I see an empty page and the error message.

Thanks

Gabriela.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,239

Try this,


if ti_data[] is not initial.
perform show_report.
else.
message e002(z_mensajes).
exit.          " add this
endif.

10 REPLIES 10
Read only

Former Member
0 Likes
1,239

I did it this way. Does it fit with your requirement?

at selection-screen.
if p_x = 'E'.
   message s000(ZMSG) with 'dodgy value in param'.
   stop.
endif.

Read only

Former Member
0 Likes
1,240

Try this,


if ti_data[] is not initial.
perform show_report.
else.
message e002(z_mensajes).
exit.          " add this
endif.

Read only

0 Likes
1,239

Hi guys,

I forgot to tell you, that I have that code un the END-OF.SELECTION event.

START-OF-SELECTION.

select * into corresponding fields of ti_vuelos

from ztabla_vuelos

where carrid eq p_carrid and

connid in s_carrid and

countryfr eq p_country.

check sy-subrc eq 0.

END-OF-SELECTION.

IF ti_vuelos[] IS NOT INITIAL.

PERFORM show_report.

ELSE.

MESSAGE e004(z_gabriela).

EXIT.

ENDIF.

I tried with EXIT, but is not working.

What I can do? I have to return to the selection screen after the error message in order to enter new values.

Thanks.

Gaby

Read only

0 Likes
1,239

Hi,

Try to use like this without the message class


START-OF-SELECTION.
select * into corresponding fields of ti_vuelos
from ztabla_vuelos
where carrid eq p_carrid and
connid in s_carrid and
countryfr eq p_country.
check sy-subrc eq 0.

END-OF-SELECTION.
IF ti_vuelos[] IS NOT INITIAL.
PERFORM show_report.
ELSE.
MESSAGE 'Error message' TYPE 'S' DISPLAY LIKE 'E'.
EXIT.
ENDIF.

Read only

0 Likes
1,239

IT WORKED!!

Thank you Vinkranth!

I wrote this:

MESSAGE 'Error message' TYPE 'S' DISPLAY LIKE 'E'.

Thak you very much!

Gaby

Read only

Former Member
0 Likes
1,239

Hi,

try:

CALL SELECTION-SCREEN ....

or

leave screen

Regards

Nicole

Read only

former_member404244
Active Contributor
0 Likes
1,239

HI,

Try like this.



if ti_data[] is not initial.
perform show_report.
else.
message I002(z_mensajes).
LEAVE LIST-PROCESSING.
endif.

Regards,

Nagaraj

Read only

0 Likes
1,239

Hi Nagaraj,

Not working yet, I mean, If I write an information message, works, but I need an error message and then return to the selection screen.

Thanks anyway!

Read only

0 Likes
1,239

hI,

we do give error messages when we want to validate the selection screen fields .Once we enter the data and then execute , for the data retrieval part if we don't get any records we give information message and go back to selection screen.error message won't work as it blanks the screen. Hence i suggested for information message

else try this


if ti_data[] is not initial.
perform show_report.
else.
MESSAGE 'No DATA ' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
endif.

Regards,

Nagaraj

Read only

0 Likes
1,239

Thanks Nagaraj!