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

Display selection screen after error raised.

0 Likes
6,745

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. -


select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. CALL TRANSACTION 'ZFCDL'. -
select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. LEAVE TO TRANSACTION 'ZFCDL'.

So guys........................do we have any possible workaround.

1 ACCEPTED SOLUTION
Read only

Former Member
2,874

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. -


select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. CALL TRANSACTION 'ZFCDL'. -
select * from toacm.... if sy-subrc <> 0. message e899(m3) with 'No data found'. LEAVE TO TRANSACTION 'ZFCDL'.

So guys........................do we have any possible workaround.

15 REPLIES 15
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,874

message s899(m3) with 'No data found' display like 'E'.

exit.

Read only

Former Member
2,875

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

Read only

0 Likes
2,874

removed

Read only

0 Likes
2,874

guys

i have already used.

message 'xxxxxxxx'.

stop.

not working

will check for

message 'xxxxxxx'.

exit.

Read only

Former Member
0 Likes
2,874

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.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,874

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

Read only

0 Likes
2,874

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.

Read only

0 Likes
2,874

Exit will work.

Donot use it inside a subroutine.

Use it outside the routine.

Read only

0 Likes
2,874

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.

Read only

0 Likes
2,874

removed

Read only

0 Likes
2,874

Hi,

Vikrant's solution works perfectly even within in the sub-routine.

Regards

Vinod

Read only

Former Member
0 Likes
2,874

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,874

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

Read only

Former Member
0 Likes
2,874

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

Read only

0 Likes
2,874

thanks for all the help...........

points awarded!!