LOOP - loop processing with a database table


Basic form

LOOP AT dbtab.

Addition



... VERSION vers

Note

This variant is no longer maintained and should therefore not be used (see also Obsolete key words ). Instead, please use a SELECT statement.

Effect

Loop processing of the database table dbtab .

You must declare the table dbtab under TABLES in the program. dbtab is a table name which begins with "T" and consists of up to five characters.
The processing is the same as for variant 1 (except that the system field SY-TABIX is not set). If you want to process the whole table, you must set all table fields to SPACE . Otherwise, the table fields you want to use as a generic argument must be filled beforehand (READ TABLE dbtab. ).

Note

Fields of type P and type N have an initial value other than SPACE . This means that fields of this type after CLEAR or MOVE SPACE TO ... are not set to SPACE .
In the case of tables which have arguments containing fields of type P or type N , the entire table header line must be set to SPACE ( MOVE SPACE TO dbtab , not (!) CLEAR dbtab ). It is preferable to use SELECT instead.

Addition

... VERSION vers

Note

You should use this addition only if it is absolutely necessary. In some cases, you can (and it makes sense) to avoid this LOOP addition by using a generation program.

Effect

Specifies a dynamically definable table name. The field vers must be a 4-character C field which contains the table name. It is declared under PARAMETERS and evaluated at runtime. The entry read is always placed in the assigned table T.... .

Index
© SAP AG 1996