‎2009 Mar 13 2:41 PM
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
‎2009 Mar 13 2:46 PM
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
‎2009 Mar 13 2:46 PM
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
‎2009 Mar 13 4:56 PM
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.
‎2015 Dec 29 4:14 PM
Thanks @Sharath Panuganti. That worked! I too think we should use STOP instead of EXIT like others have mentioned.... EXIT should be used for exiting loops only.
‎2009 Mar 13 2:46 PM
‎2009 Mar 13 2:55 PM
HI,
instead of 'exit' use 'stop'.
if <condition>.
message 'xxxx' type 'S' display like 'E'.
STOP.
endif.
‎2009 Mar 13 3:01 PM
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
‎2009 Mar 13 3:09 PM
Hi,
Try this..
MESSAGE I208(00) WITH 'NO DATA FOUND'.
LEAVE LIST-PROCESSING.Thanks
Naren
‎2009 Mar 13 3:17 PM
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
‎2009 Mar 13 5:26 PM
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
‎2009 Mar 13 6:41 PM