Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts →  Data Types and Data Objects →  Declaring Data Types →  TYPES 

TYPES - RANGE OF

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


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

Effect

Derivation of a table type for a ranges table. A ranges table is a standard table with a standard key, and a specially structured row type whose internal definition can be displayed 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:

  • type can be a non-generic data type from the ABAP Dictionary, a non-generic public data type of a global class, a non-generic program-local data type, or any ABAP type from the table of predefined ABAP types. The generic ABAP types c, n, p, and x are implicitly extended to the standard length without decimal places from the table of predefined ABAP types.
  • dobj can be a data object visible at this point, whose type is transferred for both components. Within a procedure, you cannot specify a generic typed formal parameter for dobj.

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


Notes

A ranges table has the same structure as a selection table, and can be used for pass by values to the selection screen of an executable program, which was called with SUBMIT, in a logical expression with the predicate IN or in a similar expression in a WHERE condition in Open SQL.

  • The sign and option columns of a ranges table declared with RANGE OF are not related to data types in the ABAP Dictionary. For a ranges table defined in the ABAP Dictionary, these columns refer to the data elements DDSIGN and DDOPTION.