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

diff between stop ,exit ,check ,continue

Former Member
8 REPLIES 8
Read only

Former Member
0 Likes
2,341

Try using SAP help or the search function on this forum before you post such an ignorant question.

Read only

0 Likes
2,341

thanks for answer

Read only

Former Member
0 Likes
2,341

Hi,

STOP :This statement terminates a processing block in an excutable

program.

The statement is only intended for use in the INITIALIZATION,

AT SELECTION-SCREEN, START-OF-SELECTION, and GET events. It

terminates the current processing block in an executable

program and triggers the END-OF-SELECTION event. In all other

processing blocks, or when you do not want to trigger the

END-OF-SELECTION event, you must use EXIT.

EXIT.

Within a loop structure:

Terminates looop processing (DO, WHILE, LOOP, SELECT).

Within subroutines and other modularization units (but not

in a loop structure):

Leaves the subroutine or modularization unit (FORM, MODULE,

FUNCTION, TOP-OF-PAGE, END-OF-PAGE).

Outside loop structures and modularization units (report

processing):

Terminates report processing and triggers list display.

DATA: SAP_COUNT TYPE I,

WA_T100 TYPE T100.

SELECT * FROM T100 INTO WA_T100 WHERE SPRSL = SY-LANGU AND

ARBGB = 'DS'.

WRITE / WA_T100-TEXT.

IF WA_T100-TEXT CS 'SAP'.

ADD 1 TO SAP_COUNT.

IF SAP_COUNT = 3.

EXIT.

ENDIF.

ENDIF.

ENDSELECT.

CHECK logexp.

CHECK evaluates the subsequent logical expression. If it is

true, the processing continues with the next statement.

In loop structures like

DO ... ENDDO

WHILE ... ENDWHILE

LOOP ... ENDLOOP

SELECT ... ENDSELECT

CHECK with a negative outcome terminates the current loop pass

and goes back to the beginning of the loop to start the next

pass, if there is one.

In structures like

FORM ... ENDFORM

FUNCTION ... ENDFUNCTION

MODULE ... ENDMODULE

AT events

GET events

CHECK with a negative outcome terminates the routine or

modularization unit.

If CHECK is neither in a loop nor a routine nor a

modularization unit, a negative logical expression terminates

the current event. In contrast, the statement REJECT terminates

the current event, even from loops or subroutines.

CONTINUE.

Within loop structures like

DO ... ENDDO

WHILE ... ENDWHILE

LOOP ... ENDLOOP

SELECT ... ENDSELECT

CONTINUE terminates the current loop pass, returns the

processing to the beginning of the loop and starts the nex

loop pass, if there is one.

DO loop: Omit an area (10 ... 20)

DO 100 TIMES.

IF SY-INDEX >= 10 AND SY-INDEX <= 20.

CONTINUE.

ENDIF.

...

ENDDO.

Regards

Kiran Sure

Read only

Former Member
0 Likes
2,341

hi,

Keyword Purpose

CONTINUE Terminating the Loop Pass Unconditionally

CHECK Terminating the Loop Pass Conditionally

EXIT Terminating a Loop Entirely

To terminate a loop pass immediately without any condition, use the CONTINUE statement as follows:

DO 4 TIMES.

IF SY-INDEX = 2.

CONTINUE.

ENDIF.

WRITE SY-INDEX.

ENDDO.

This produces the following output:

1 3 4

Here, the system terminates the second loop pass without processing the WRITE statement

To terminate a loop pass conditionally, use the CHECK statement as follows:

Syntax

CHECK <condition>.

DO 4 TIMES.

CHECK SY-INDEX BETWEEN 2 and 3.

WRITE SY-INDEX.

ENDDO.

This produces the following output:

2 3

Here, the system terminates the first and the fourth loop pass without processing the WRITE statement because SY-INDEX does not fall between 2 and 3.

To terminate a loop entirely without any condition, use the EXIT statement as follows:

Syntax

EXIT.

DO 4 TIMES.

IF SY-INDEX = 3.

EXIT.

ENDIF.

WRITE SY-INDEX.

ENDDO.

This produces the following output:

1 2

Here, the system terminates the entire loop processing in the third loop pass without processing the WRITE statement or the fourth loop pass.

regards,

sreelakshmi

Read only

Former Member
0 Likes
2,341

STOP:moves the control to END-OF-SELECTION event.

with STOP you can end an event.

EXIT:moves the control out of the loop or subroutine or program.if you write EXIT inside a subroutine then control moves out of the routine.if you code EXIT in a program control moves out of the program.

CHECK is conditional.

Check statement is like IF and EXIT combined. That is if check statement fails then it skips the programing code next..

DO 4 TIMES.

CHECK sy-index > 2.

WRITE sy-index.

ENDDO.

output:3 4

CONTINUE is non conditional.

Continue statement is used inside the loops if we want to again start the loop with the same record thus there is no exit..

DO 4 TIMES.

IF not sy-index > 2.

CONTINUE.

ENDIF.

WRITE sy-index.

ENDDO.

output:3 4

Read only

Former Member
0 Likes
2,341

Hi sravanthiaksha ... ,

Check out the following thread

Hope this helps a bit ..

Reward if useful

Cheers

Kripa Rangachari.

Read only

Former Member
0 Likes
2,341

HI,

Please refer ABAPDOCU TCode.

Read only

Former Member
0 Likes
2,341

STOP

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

Before and during selection screen processing, the next event in the prescribed sequence is always called. From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement. Once the corresponding event block has been processed, the system displays the list.

EXIT

If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately.

Before and during selection screen processing, the next event in the prescribed sequence is always called. From the START-OF-SELECTION event onwards, the system starts the list

processor directly when the EXIT statement occurs, and displays the list.

If the EXIT statement occurs in a loop using DO, WHILE, or LOOP, it is the loop that terminates, not the processing block.

CHECK : if the statement fails then skips the current loop pass. But it doesnot exit the loop.

CONTINUE : skips the current loop pass. But it doesnot exit the loop.

REWARD IF HELPFUL

regards

mano