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

return to the selection screen after error message.

Former Member
0 Likes
27,654

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
Read only

Former Member
9,166

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
Read only

Former Member
9,166

Hi,

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

Regards,

Akshata Shetty

Read only

0 Likes
9,166

write code in at selection-screen event

Read only

Former Member
9,167

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

Read only

9,166

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

Read only

Former Member
0 Likes
9,166

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.

Read only

Former Member
9,166

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

Read only

0 Likes
9,166

Thank you so much friends

Read only

Former Member
9,166

use



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

Read only

former_member1716
Active Contributor
0 Likes
9,166

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