DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n].
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-tleng are filled with the current number of table rows and the length of a table row in bytes.
For more detailed information about an internal table, use the
RTTS methods of the
If an addition is not specified, the
DESCRIBE TABLEstatement sets system fields
... KIND knd
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
type group SYDES.
... LINES lin
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.
... OCCURS n
The initial memory requirement defined using the INITIAL
SIZE addition or obsolete addition
when the internal table is created is determined and assigned to data object
n, for which data type
i is expected.
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.