ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Types →  TYPES → 

TYPES - RANGE OF

Quick Reference

Syntax

TYPES dtype {TYPE RANGE OF type}|{LIKE RANGE OF dobj}
            [INITIAL SIZE n].

Effect

Derives a table type for a ranges table. A ranges table is a standard table in which a ranges condition can be saved. It has a standard key and a special structured row type whose internal definition can be represented as follows in ABAP syntax:

TYPES: BEGIN OF linetype,
         sign   TYPE c LENGTH 1,
         option TYPE c LENGTH 2,
         low    {TYPE type}|{LIKE dobj},
         high   {TYPE type}|{LIKE dobj},
       END OF linetype.

The additions TYPE and LIKE determine the data type of the components low and high:

The addition INITIAL SIZE is synonymous with the definition of normal internal table types.

A ranges table can be used in a relational expression with the relational operator IN or in a similar expression in a WHERE condition in ABAP SQL. It is also used for value passing to the selection screens of an executable program called using SUBMIT.

Notes

Example

Defines a table type for a ranges table and its use for an inline declaration of a ranges table on the left side of a constructor expression with the value operator VALUE.

TYPES carrid_range TYPE RANGE OF spfli-carrid.

DATA(carrid_range) = VALUE carrid_range(
  ( sign = 'I' option = 'BT' low = 'AA' high = 'LH') ).

SELECT *
       FROM spfli
       WHERE carrid IN @carrid_range
       INTO TABLE @DATA(spfli_tab).