sapdev logo background
sapdev logo sapdev logo
Comments

ABAP DESCRIBE TABLE Statement syntax, information and example SAP source code



Return to Statement index



DESCRIBE TABLE

Short Reference

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

ABAP_ADDITIONS:
1 ... KIND knd
2 ... LINES lin
3 ... OCCURS n

What does it do? This statement determines some of the properties of the internal table itab and assigns them to the specified target fields. The following can be specified as target fields of each addition:
Existing variables to which the return value can be converted.
Inline declarations DATA(var) .
The various additions enable the table category, the number of currently filled rows, and the initial memory requirement to be deter
mined.
In addition, the 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.

Latest notes: For more detailed information about an internal table, it is best to use the methods of the RTTS of the statement DESCRIBE TABLE .
If no addition is specified, the statement DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng .

ABAP_ADDITION_1 ... KIND knd

What does it do? Determines the table category of the internal table
itab . The return value is a single character character-like ID. In an inline declaration, a variable of the tye c with length 1 is declared.
The possible IDs 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 the
type group SYDES .

ABAP_ADDITION_2 ... LINES lin

What does it do? Determines the current number of table rows in the internal table itab . The return value has the type i . In an inline declaration, a variable of the tye ci is declared.

Latest notes: The current number of rows of an internal table can also be determined using the predefined function lines , which can be used in suitable operand positions
.

ABAP_ADDITION_3 ... OCCURS n

What does it do? Determines the initial memory requirements defined using the addition INITIAL SIZE or the obsolete addition OCCURS when the internal table is created. The return value has the type i . In an inline declaration, a variable of the tye ci is declared.

Example ABAP Coding Sorts a generically typed internal table in a subroutine in descending order. Since sorted tables
cannot be sorted in descending order, the table category is checked to prevent non-handleable exceptions from being raised.
FORM sort_descending CHANGING itab TYPE ANY TABLE.
DESCRIBE TABLE itab KIND DATA(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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




DESCRIBE_LIST_PAGE_PROPERTIES
DETAIL




comments powered by Disqus