Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Attributes of Data Objects →  DESCRIBE 

DESCRIBE TABLE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n]. 

Extras

1. ... KIND knd

2. ... LINES lin
3. ... OCCURS n

Effect

This statement determines some properties of internal table itab and assigns them to the variables specified. The various additions enable you to determine the table type, the number of rows currently filled, and the initial memory requirement.

In addition, system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes.


Notes

  • For more detailed information about an internal table, use the RTTS methods of the DESCRIBE TABLE statement.
  • If an addition is not specified, the DESCRIBE TABLE statement sets system fields sy-tfill and sy-tleng only.

Addition 1

... KIND knd

Effect

The table type of internal table itab is determined and a corresponding one-digit identification is assigned to data object knd, for which a character-like data type is expected. The identifications are "T" for standard tables, "S" for sorted tables, and "H" for hashed tables. These values are also defined as constants sydes_kind-standard, sydes_kind-sorted, and sydes_kind-hashed in type group SYDES.

Addition 2

... LINES lin

Effect

The current number of table rows for internal table itab is determined and assigned to data object lin for which data type i is expected.


Note

The current number of rows of an internal table can also be determined using predefined function lines, which can be used at suitable operand positions.

Addition 3

... OCCURS n

Effect

The initial memory requirement defined using the INITIAL SIZE addition or obsolete addition OCCURS when the internal table is created is determined and assigned to data object n, for which data type i is expected.


Example

Sorting (in descending order) of a generically typed internal table in a subprogram. Since sorted tables must not be sorted in a descending order, the table type is checked to avoid an exception that cannot be handled.

FORM sort_descending CHANGING itab TYPE ANY TABLE. 
  DATA tabkind TYPE c LENGTH 1. 
  DESCRIBE TABLE itab KIND tabkind. 
  IF tabkind = sydes_kind-standard OR 
     tabkind = sydes_kind-hashed. 
    SORT itab DESCENDING. 
  ELSEIF tabkind = sydes_kind-sorted. 
    MESSAGE '...' TYPE 'E'. 
  ELSE. 
    MESSAGE '...' TYPE 'E'. 
  ENDIF. 
ENDFORM.