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

stop

Former Member
0 Likes
610

Hi all,

open dataset w_fname for input in text mode " get input data

message lw_msg. " any errors place here

if sy-subrc <> 0.

message i002 with lw_msg.

stop.

endif.

In the above code why the stop statement is required what does it mean there.Even if we don't give also after giving the message it will come out of the if endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
586

Hi,

If you use the STOP statement within an event block, the system <b>stops processing the block immediately</b>. The ABAP runtime environment triggers the next event.

<i>So in your code it exits of the block in which the code is and moves to the next block.</i>

For ex:

From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement.

regards,

madhu

4 REPLIES 4
Read only

Former Member
0 Likes
587

Hi,

If you use the STOP statement within an event block, the system <b>stops processing the block immediately</b>. The ABAP runtime environment triggers the next event.

<i>So in your code it exits of the block in which the code is and moves to the next block.</i>

For ex:

From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement.

regards,

madhu

Read only

former_member673464
Active Contributor
0 Likes
586

hi,

The statement STOP is only to be used in executable programs and in the following event blocks:

AT SELECTION-SCREEN (without additions)

START-OF-SELECTION

GET

You leave these event blocks via STOP, and the runtime environment triggers the event END-OF-SELECTION.

regards,

veeresh

Read only

Former Member
0 Likes
586

hi,

Cancels all data selection. No further tables are read.

Refer

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/stop.htm

this is from help

STOP

Syntax

STOP.

Effect

The statement STOP is only to be used in executable programs and in the following event blocks:

AT SELECTION-SCREEN (without additions)

START-OF-SELECTION

GET

You leave these event blocks via STOP, and the runtime environment triggers the event END-OF-SELECTION.

Note

The statement STOP is forbidden in methods and, since Release 6.10, leads to an uncatchable exception during the processing of screens called with CALL SCREEN and in programs not called with SUBMIT.

Example

Ending the event blocks GET sbook after max postings have been issued, and branching to END-OF-SELECTION.

NODES: sflight, sbook.

DATA: bookings TYPE i,

max TYPE i VALUE 100.

GET sflight.

WRITE: / sflight-carrid, sflight-connid, sflight-fldate.

GET sbook.

bookings = bookings + 1.

WRITE: / sbook-bookid, sbook-customid.

IF bookings = max.

STOP.

ENDIF.

END-OF-SELECTION.

ULINE.

WRITE: / 'First', bookings, 'bookings'.

Regards,

Santosh

Read only

Former Member
0 Likes
586

Not onli comes out of the IF.. it comes out of the loop if any loops u have.. or it goes to END -OF-SELECTION event directly if u dont have any loop ...

regards,

sai ramesh