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

Exit Process

Former Member
0 Likes
957

i have the following piece of code in my program:

IF sy-dbcnt = 0.

MESSAGE 'No record matches.' TYPE 'I'.

CALL SELECTION-SCREEN '1000'.

ENDIF.

when the program meets that condition (sy-dbcnt = 0)

i should NOT continue to display the should be ALV for the report,

instead after displaying the message box it goes back to the selection.

now,

when i go back to the selection-screen 1000,

and execute whatever new selections i will make,

it just continues to the previously interrupted ALV grid display

regardless of whether i make a new selection or not.

how do i avoid that?

1 ACCEPTED SOLUTION
Read only

gopi_narendra
Active Contributor
0 Likes
909

Its because you have been giving the message type as 'I' which is Information message.

On pressing Enter it continues with the next steps

So if you give 'E' instead of 'I', it shoudl solve the problem.

is this what i understood from your post??

Regards

Gopi

9 REPLIES 9
Read only

gopi_narendra
Active Contributor
0 Likes
910

Its because you have been giving the message type as 'I' which is Information message.

On pressing Enter it continues with the next steps

So if you give 'E' instead of 'I', it shoudl solve the problem.

is this what i understood from your post??

Regards

Gopi

Read only

0 Likes
909

Gopi,

that would have been correct if i have this if block

inside my AT SELECTION-SCREEN event.

unfortunately i have reasons why i don't put it in there.

that's why i use 'I' in my message statement so i can force the program to

go back to the selection screen.

(coz in the 'E' it wouldn't).

regards,

laure

Read only

0 Likes
909

Can you check this

TABLES : t001.
PARAMETER : p_bukrs TYPE t001-bukrs.

START-OF-SELECTION.
  SELECT SINGLE * FROM t001 WHERE bukrs = p_bukrs.
  IF sy-subrc = 0.
  ELSE.
    MESSAGE i000(ztest_gopi) WITH 'Incorrect Company Code'.
  ENDIF.

Regards

Gopi

Read only

0 Likes
909

hmm, tried it.

it makes no difference to my code.

see, my concern is when the program goes back to the selection screen

and i do new selections it will just continue displaying the interrupted ALV display.

coz u see in my if block statement, if i had not put that, it will display the ALV

even it has no data in it.

that's what i'm trying to avoid.

so now i placed that if block so that if there are no records,

a message box will pop up and it will not display the ALV anymore.

instead will go back to my selection screen.

and it is a success.

BUT when i make new selections and execute,

it will continue to display the blank ALV that my if block statement previously interrupted.

Read only

0 Likes
909

Hi,

Just change below code to

IF sy-dbcnt = 0.

MESSAGE 'No record matches.' TYPE 'I'.

<b>*CALL SELECTION-SCREEN '1000'.</b> replace this with

<b>LEAVE LIST-PROCESSING.</b>

ENDIF.

Regards,

Atish

Read only

0 Likes
909

Ok its because when you give the Call Selection-Screen statement, it calls the selection screen again. Once you see the selection screen after getting the information message, press BACK button and see it still shows you the previous selection screen.

Its because Information Message allows you to continue from the step where the program was interupted, where as in case of Error it does not. It will start right from the start again.

If possible try to avoid using an 'I' Information message, that should solve your problem.

Or you can use LEAVE to LIST_PROCESSING.

Regards

Gopi

Read only

0 Likes
909

the leave list processing works fine ONLY IF

it doesn't get me stuck to a blank new screen without back button or anything.

i can't use that unless i'm putting the if block statement in my

AT SELECTION-SCREEN event.

which i'm afraid i won't do for certain reasons.

say we put some code after the call selection-screen '1000'.

something like:

EXIT.

or

STOP.

which by the way doesn't work as well.

coz tried.

any other ideas?

Read only

0 Likes
909

i stand corrected guys,

the leave list processing works fine.

that's just what i'm looking for even if i use 'I' in my message statement.

thanks both of you.

regards,

laure

Read only

0 Likes
909

Hi Laure,

Then you should reward points to the all useful answers :).

Regards,

Atish