Application Development 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: 

return to the selection screen after error message.

Former Member
0 Kudos

hello friends,

I have selection screen report using screen (Call screen 2001)

In Start-of-selection

i have used 1 perform and 1 more in the first perform. And checking condition in the second perform.

My requirement is if condition is not satisfied, disply error message and return to the selection screen.

e.g.


Start-of-selection.
PERFORM process1.


FORM process1.
	------
	------
	PERFORM process2
ENDFORM.


FORM process2.
	------
	------
	IF sy-subrc <> 0.
		Display error and return to the selection screen.
	ENDIF.
ENDFORM.

Can we do that?

Regards,

RH

1 ACCEPTED SOLUTION

Former Member

Hi,

Try like this,


Start-of-selection.
PERFORM process1.
 
 
FORM process1.
	------
	------
	PERFORM process2
ENDFORM.
 
 
FORM process2.
	------
	------
	IF sy-subrc  0.
	message 'Error message' TYPE 'S' DISPLAY LIKE 'E'.
  EXIT.
	ENDIF.
ENDFORM.

Vikranth

9 REPLIES 9

Former Member

Hi,

Try using 'LEAVE LIST-PROCESSING.' within the IF .. ENDIF block.

Regards,

Akshata Shetty

0 Kudos

write code in at selection-screen event

Former Member

Hi,

Try like this,


Start-of-selection.
PERFORM process1.
 
 
FORM process1.
	------
	------
	PERFORM process2
ENDFORM.
 
 
FORM process2.
	------
	------
	IF sy-subrc  0.
	message 'Error message' TYPE 'S' DISPLAY LIKE 'E'.
  EXIT.
	ENDIF.
ENDFORM.

Vikranth

Thanks. Solved my problem almost after a decade you posted the solution.

Former Member
0 Kudos

do like below:

Start-of-selection.

PERFORM process1.

FORM process1.

-


-


PERFORM process2

check v_flg NE 'X'.ENDFORM.

FORM process2.

-


-


IF sy-subrc 0.

v_flg = 'X'.

* message s001(00) with 'error message'.*

STOP. ENDIF.

ENDFORM.

Former Member

Hi

Try the below code.

Start-of-selection.
PERFORM process1.
 
 
FORM process1.
	------
	------
	PERFORM process2
ENDFORM.
 
 
FORM process2.
	------
	------
	IF sy-subrc  0.
                                 message 'ERROR' type 'E'.

                                 call screen 2001 *** the selection screen number.
                        ENDIF.
ENDFORM.

Thanks,

Harini

0 Kudos

Thank you so much friends

Former Member

use



  MESSAGE 'ur MEssage' ' TYPE 'S' DISPLAY LIKE 'E'.
  STOP.

former_member1716
Active Contributor
0 Kudos

Hello,

You can try below methods!

First method:

write you validation logic in At Selection screen event, and use leave list processing after displaying the error message.

Second method:

Once your error condition is satisfied, Try displaying your error message in the form of Type 'I'. Post that Try calling the same selection screen using Call transaction method.

This Should Satisfy Your requirement but one thing you would miss here is you will lose all the Data which was entered in the selection screen earlier.

Note: Am not sure if you have designed a selection screen (2001), i hope this should be the screen which is called after your selection screen validations. If this is the case then First method should definitely work. Try to keep all your validations in At Selection screen Event. Key point to remember here is your selection screen Number is different from screen 2001.

In case you have designed your selection screen itself then go for second method.

Cheers!!!

Satish