Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Objects →  DATA 

DATA - RANGE OF

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


DATA rtab {TYPE RANGE OF type}|{LIKE RANGE OF dobj} 
          [INITIAL SIZE n]
          [VALUE IS INITIAL]
          [READ-ONLY].

Effect

This statement defines a ranges table rtab with the table type described in the section TYPES - RANGE OF. The table type defined here, however, is not a standalone type, but exists as a property of the data object rtab.

The addition VALUE IS INITIAL can be used to specify an initial start value.


Notes

  • Outside of classes, the addition WITH HEADER LINE can also be used to declare an obsolete header line.
  • The declaration of a ranges table using the statement RANGES is obsolete.

Example

In this example, a ranges table is declared, filled, and evaluated in the WHERE condition of a SELECT statement.

DATA: spfli_wa TYPE spfli, 
      r_carrid TYPE RANGE OF spfli-carrid, 
      r_carrid_line LIKE LINE OF r_carrid. 

r_carrid_line-sign   = 'I'. 
r_carrid_line-option = 'BT'. 
r_carrid_line-low    = 'AA'. 
r_carrid_line-high   = 'LH'. 
APPEND r_carrid_line TO r_carrid. 

SELECT * 
       FROM spfli 
       WHERE carrid IN @r_carrid 
       INTO @spfli_wa. 
  ... 
ENDSELECT.