2010 Jun 14 12:24 PM
Is it possible to get back to main selection screen, if sy-subrc <> 0 in start-of-selection event, I will need to display error message.
IF Yes.
please provide exact code.
as for information purpose, following code had already failed.
select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. SET SCREEN 0. LEAVE SCREEN. -
So guys........................do we have any possible workaround.
2010 Jun 14 12:28 PM
You could try replacing the error messages with
message 'No Data Found' TYPE 'S' DISPLAY LIKE 'E'.
stop. "If processing has to stop after error message
Vikranth
Is it possible to get back to main selection screen, if sy-subrc <> 0 in start-of-selection event, I will need to display error message.
IF Yes.
please provide exact code.
as for information purpose, following code had already failed.
select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. SET SCREEN 0. LEAVE SCREEN. -
So guys........................do we have any possible workaround.
2010 Jun 14 12:28 PM
message s899(m3) with 'No data found' display like 'E'.
exit.
2010 Jun 14 12:28 PM
You could try replacing the error messages with
message 'No Data Found' TYPE 'S' DISPLAY LIKE 'E'.
stop. "If processing has to stop after error message
Vikranth
2010 Jun 14 1:09 PM
2010 Jun 14 12:30 PM
guys
i have already used.
message 'xxxxxxxx'.
stop.
not working
will check for
message 'xxxxxxx'.
exit.
2010 Jun 14 12:34 PM
Hi ,
why dont you write your validation related code under AT SELECTION SCREEN. then no need to go tro start of selection and coming back to selection screen in case of error. you will be at selection screen only even if error occurs.
Hope it is helpful.
Regards,
Uma Dave.
2010 Jun 14 12:35 PM
If you don't use an actual logical database, you can move your code from START-OF-SELECTION to AT SELECTION-SCREEN. Just add a check to insure execution has been required :
TABLES: sscrfields.
AT SELECTION-SCREEN.
* If running
IF sscrfields-ucomm = 'ONLI'
OR sscrfields-ucomm = 'PRIN'.
PERFORM load_of_data CHANGING no_data_raised.
IF no_data_raised. MESSAGE Ennn. ENDIF.
ENDIF.
START-OF-SELECTION. " or END-OF-SELECTION
PERFORM display_data.Regards,
Raymond
2010 Jun 14 12:38 PM
thanks for response Uma Dave.
but its a program of more than 1500 lines............so i will not able to do every validation in at selection screen event..............since 5 to 6 tables are used..................i will need to check at various location's if data is coming properly or not.
2010 Jun 14 12:40 PM
Exit will work.
Donot use it inside a subroutine.
Use it outside the routine.
2010 Jun 14 12:43 PM
hi,
use 'LEAVE LIST-PROCESSING' statement to go back to selection-screen. don't use error message.
select * from ....
IF sy-subrc <> 0.
message 'xxx' type 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
2010 Jun 14 1:08 PM
2010 Jun 14 1:08 PM
Hi,
Vikrant's solution works perfectly even within in the sub-routine.
Regards
Vinod
2010 Jun 14 12:48 PM
Simply handle your error processing in AT SELECTION-SCREEN. Don't put in the nonsensical leave to screen, etc. And, if data is retrieved, the return code will be 0, otherwise it will be 4.....
In the At SELECTION-SCREEN, you can as noted check for SSCRFIELDS-UCOMM, or you can simply validate your data...
If some condition is true (or false).
Message E016(gr) with 'My error message'.
endif.That's all you need to return to the selection screen
2010 Jun 14 1:48 PM
Check this code snippet:
DATA ITAB TYPE STANDARD TABLE OF T001.
PARAMETERS P_BUKRS TYPE BUKRS.
START-OF-SELECTION.
SELECT * FROM T001 INTO TABLE ITAB
WHERE BUKRS = P_BUKRS.
IF SY-subrc NE 0.
MESSAGE 'No Data selected' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.@ Vinod:
Vikranth's code will work fine if you don't have END-OF-SELECTION defined. Check this:
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE itab
WHERE bukrs = p_bukrs.
IF sy-subrc NE 0.
MESSAGE 'No Data selected' TYPE 'S' DISPLAY LIKE 'E'.
STOP.
ENDIF.
END-OF-SELECTION.
WRITE: / 'STOP triggers END-OF-SELECTION.'.STOP will trigger the event END-OF-SELECTION. Read the SAP documentation: [http://help.sap.com/abapdocu_70/en/ABAPSTOP.htm]
Hope this helps.
BR,
Suhas
Edited by: Suhas Saha on Jun 14, 2010 6:22 PM
2010 Jun 14 2:06 PM
The best way to do this is via the AT SELECTION-SCREEN event; however, if you insist on not doing it that way, you can:
SUBMIT z_this_prog VIA SELECTION-SCREEN.
Rob
2011 Apr 01 5:16 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |