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: 

difference between continue and exit... vvvvvery urgent

Former Member
0 Kudos

hi,

can anyone tell me the difference between continue and exit..

if useful points are rewarded

regards,

sree

9 REPLIES 9

Former Member
0 Kudos

continue will go to next index of the loop

exit will to end-of-selection event

Former Member
0 Kudos

Hi,

CONTINUE will skip the current processing of the record in the internal table and then process the next record in the LOOP statement or DO statement.

EXIT will completely go out of the LOOP statement or DO statement

Thanks

Naren

Former Member
0 Kudos

Hi

Check these links:

<u>http://www.howforge.com/difference-between-continue-check-and-exit-statement-in-abap-4</u>

<u>http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3564358411d1829f0000e829fbfe/content.htm</u>

Thanks

Vasudha

Former Member
0 Kudos

hi

good

Exit – It exits from the respective subroutine were this syntax is used , generally condition for the EXIT is stated before this syntax

· Check - here the conditional check is done at the same time .

CHECK = 10 AND SY-INDEX <= 20.

CONTINUE.

ENDIF.

...

ENDDO.

reward point if helpful.

thanks

mrutyun^

Former Member

HI here is the ex code,

Continue : In any loop statements if we give CONTINUE the control will goto next iteration without executing the commands after this continue statement.

Exit : In any loops if we give EXIT the control will exit from the loop and goto out of the loop.

The loop may be loop......endloop, do.....while, case.......endcase, form........endform.

Former Member
0 Kudos

Hi,

CONTINUE

Ends a loop pass.

Syntax

CONTINUE.

Only possible within loops. This statement terminates the current loop pass and starts the next.

EXIT

Terminates a loop or processing block.

Syntax

EXIT.

Within a loop: The entire loop is terminated, and processing continues with the first statement following the loop.

Outside a loop: Terminates the current processing block.

In a reporting event: Jumps directly to the output list.

EXIT FROM STEP-LOOP

Ends a step loop.

Syntax

EXIT FROM STEP-LOOP.

Terminates step loop processing. A step loop is a way of displaying a table on a screen.

EXIT FROM SQL

Terminates Native SQL processing.

Syntax

EXIT FROM SQL.

This statement may occur within a subroutine called using the PERFORMING addition in the EXEC SQL statement. The entire subroutine is processed, but no more subsequent lines of the selection are processed.

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.

Reward

Former Member
0 Kudos

HI

Continue remains in the LOOP ..ENDLOOP...

It goes to next loop pass.

wheres Exit comes out of it ...

Praveen.

varma_narayana
Active Contributor
0 Kudos

Hi Sree..

Continue: This statement can be used only in LOOPing Statements like

DO..enddo

While.. Endwhile

Select .. endselect

Loop.. Endloop

It will skip the Current Loop pass and continue the Next Loop pass.

Exit: Can be used anywhere to Terminate the Processing blocks like Loops, Subroutines.

<b>Reward if Helpful.

</b>

Former Member
0 Kudos

Hi,

<b>CONTINUE:</b>

Syntax

CONTINUE.

<b>Effect</b>

The CONTINUE statement can only be used in loops. If it is used, the current loop pass is ended immediately and the program flow is continued with the next loop pass.

<b>Example</b>

A loop pass is exited using CONTINUE if the loop index sy-index is an odd number.

DATA remainder TYPE i.

DO 20 TIMES.

remainder = sy-index MOD 2.

IF remainder <> 0.

CONTINUE.

ENDIF.

WRITE / sy-index.

ENDDO.

<b>EXIT:</b>

Syntax

EXIT.

<b>Effect</b>

If the EXIT statement is listed within a loop, it leaves the loop by ending the current loop process. Program execution is continued after the closing statement in the loop.

<b>Note</b>

Outside of a loop, the EXIT statement leaves the current processing block.

<b>Example</b>

Leaving a loop with EXIT if the loop index sy-index is greater than a number limit.

DATA limit TYPE i VALUE 10.

DO.

IF sy-index > limit.

EXIT.

ENDIF.

WRITE / sy-index.

ENDDO.

Regards,

Bhaskar