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

difference between check&continue

Former Member
0 Likes
676

difference between check&continue

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
626

Hi,

check is conditional,continue is non conditional.


DO 4 TIMES.
  CHECK sy-index > 2.
  WRITE sy-index.
ENDDO.

output:3 4


DO 4 TIMES.
  IF not sy-index > 2.
    CONTINUE.
  ENDIF.
  WRITE sy-index.
ENDDO.

output:3 4

rgds,

bharat.

4 REPLIES 4
Read only

Former Member
0 Likes
627

Hi,

check is conditional,continue is non conditional.


DO 4 TIMES.
  CHECK sy-index > 2.
  WRITE sy-index.
ENDDO.

output:3 4


DO 4 TIMES.
  IF not sy-index > 2.
    CONTINUE.
  ENDIF.
  WRITE sy-index.
ENDDO.

output:3 4

rgds,

bharat.

Read only

Former Member
0 Likes
626

Hi,

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

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

Reward points!!!!!!!!!!

Read only

Former Member
0 Likes
626

CHECK evaluates the subsequent logical expression. If it is true, the processing continues with the next statement.

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

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.

Example

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

DO 100 TIMES.

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

CONTINUE.

ENDIF.

...

ENDDO.

anya

Read only

Former Member
0 Likes
626

Hi,

CHECK evaluates the subsequent logical expression. If it is true, the processing continues with the next statement.

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. Examples of loop structures are:

DO ... ENDDO

WHILE ... ENDWHILE

LOOP ... ENDLOOP

SELECT ... ENDSELECT

Note

Outside loops, a CHECK with a negative outcome will cause you to exit the current processing block (event block, dialog module, procedure). During the reporting event GET, the system terminates the processing of the current entry, read by the logical database, and processes the next entry in the current node of the logical database. Nodes that are subordinate in the hierarchical structure of the logical database are not processed.

SAP recommends that you only use CHECK within loops. Use the RETURN statement to exit processing blocks.

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.

Hope this is helpful.

Reward points if useful.

Regards,

Sowmya.