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

category

Former Member
0 Likes
738

Under what category does Exit , Break , Continue statements come ?

Loop control statements ? Contol break statements like that

Kumar

7 REPLIES 7
Read only

Former Member
0 Likes
715

These are control Break statements why because these statements will break the control of execution of statements.

Warm Regards,

Vijay

Read only

Former Member
0 Likes
715

LOOP CONTROL STATEMENTS..

Read only

Former Member
0 Likes
715

So AT FIRST ...END AT ....Those are also same ?

Can you give use of those EXIT , BREAK , CONTINUE statements ?

Read only

0 Likes
715

<b>EXIT.</b>

In loop structures:

Leaves the loop processing (DO , WHILE , LOOP , SELECT )

In subroutines and other modularization units (but outside loop structures):

Leaves the subroutine or modularization unit (FORM , MODULE , FUNCTION , TOP-OF-PAGE , END-OF-PAGE )

Outside loop structures and modularization units (report processing):

Cancels the report processing and displays the list

<b>CONTINUE.</b>

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 next loop pass, if there is one.

Read only

Former Member
0 Likes
715

AT FIRST AND AT LAST WIL BREAK THE LOOP FOR TEMPORARYLY N COME BACK AND CONTINUE WITH THE LOOP BUT EXIT N BREAK WILL COME OUT OF LOOP FOREVER

Read only

Former Member
0 Likes
715

<b>EXIT</b>

TABLES T100.
DATA SAP_COUNT TYPE I.

SELECT * FROM T100 WHERE SPRSL = SY-LANGU AND
                         ARBGB = 'DS'.
  WRITE / T100-TEXT.
  IF T100-TEXT CS 'SAP'.
    ADD 1 TO SAP_COUNT.
    IF SAP_COUNT = 3.
      EXIT.
    ENDIF.
  ENDIF.
ENDSELECT.

<b>CONTINUE</b>

DO 100 TIMES.

 IF SY-INDEX >= 10 AND SY-INDEX <= 20.
    CONTINUE.
  ENDIF.
  ...
ENDDO.

Read only

Former Member
0 Likes
715

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.

Hope this helps.