Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Program Flow →  Obsolete Control Structures 

WHILE - VARY

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

WHILE ... VARY dobj FROM dobj1 NEXT dobj2 [RANGE range]
         [VARY ...].
  [statement_block]
ENDWHILE.

Effect

The addition VARY and its addition RANGE have exactly the same effect on a WHILE loop as the similarly obsolete additions VARYING and RANGE of the statement DO. The addition VARY can be used more than once in a WHILE statement.


Note

Instead of the addition VARY, the statement ASSIGN should be used in a loop with the addition INCREMENT.

Exceptions


Non-Catchable Exceptions

  • Cause:: Forbidden access to tables, strings, field or object references within the range specified by the RANGE addition.
    Runtime Error: DO_WHILE_VARY_ILLEGAL_ACCESS
  • Cause:: Access to data outside the range specified by the RANGE addition.
    Runtime Error: DO_WHILE_VARY_NOT_IN_RANGE