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

Back to selection screen after error

Former Member
0 Likes
7,170

Hello ABAPers,

I have a executable program (REPORT) to do some processing (e.g. read a standard table with the parameters and select-options and save the data in a Z table).

When occurs an error (e.g. when sy-subrc <> 0 after select) and a message of type E is showed, the program show the message in a "clean" screen with title SAP. Then, after ENTER or ESC, it leaves to initial screen of SAP (SAP Easy Access).

The message of type E is triggered from a routine (FORM) called from START-OF-SELECTION event. And the program don´t write nothing in list (only return a status message if everithing is ok).

How can I force the program to back to selection screen after some error?

Thanks in advance.

Best regards,

Charles Oliveira

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,694

hi,

Do the following for your requirement.

in the message give the following

start-of-selection.

Perform <routine>.
.
.
.
.
.
.
Form <routine>.
if <condition>.
  message 'xxxx' type 'S' display like 'E'.
  exit.
endif.
endform.

This way the control returns to selection screen even after the message is triggered.

Thanks

Sharath

10 REPLIES 10
Read only

Former Member
0 Likes
3,695

hi,

Do the following for your requirement.

in the message give the following

start-of-selection.

Perform <routine>.
.
.
.
.
.
.
Form <routine>.
if <condition>.
  message 'xxxx' type 'S' display like 'E'.
  exit.
endif.
endform.

This way the control returns to selection screen even after the message is triggered.

Thanks

Sharath

Read only

0 Likes
3,694

Hi Sharath,

Your solution worked. But I used STOP in the place of EXIT, because there´s other form being called after the first.

Thank you.

Read only

0 Likes
3,694

Thanks @

Read only

Former Member
0 Likes
3,694

try

Message SXXX display like 'E'.

Exit.

Mathews

Read only

Former Member
0 Likes
3,694

HI,

instead of 'exit' use 'stop'.

if <condition>.

message 'xxxx' type 'S' display like 'E'.

STOP.

endif.

Read only

Former Member
0 Likes
3,694
START-OF-SELECTION.

IF <LOGICAL EXP>.
Message 'XXX' TYPE 'S' Display Like 'E'.

Leave LIST-PROCESSING .
ENDIF.

OR

START-OF-SELECTION.

IF <LOGICAL EXP>.
Message 'XXX' TYPE 'S' Display Like 'E'.

EXIT.
ENDIF.

Regards,

Gurpreet

Read only

Former Member
0 Likes
3,694

Hi,

Try this..

MESSAGE I208(00) WITH 'NO DATA FOUND'.
LEAVE LIST-PROCESSING.

Thanks

Naren

Read only

Former Member
0 Likes
3,694

iz it supposed to be error message? if it can be informative when sometHing failed and go back to selection screen

Try this:

IF SY-SUBRC = 0.

message i<id> with 'NO DATA FOUND'.

EXIT.

ENDIF.

Edited by: BrightSide on Mar 13, 2009 3:17 PM

Read only

Former Member
0 Likes
3,694

Hi,

The stop will work as long as you don't have END-OF-SELECTION...

If you have END-OF-SELECTION event...then the stop will go to that event...

Thanks

Naren

Read only

0 Likes
3,694

Yeah, I know that.

Thank you anyway.