DESCRIBE TABLE itab.
Returns the attributes of the internal table itab. You must use at least one of the additions listed below:
The DESCRIBE statement cannot be used for all ABAP
types. In connection with ABAP Objects, SAP has introduced a RTTI concept
based on system classes to determine type attributes at runtime. This concept applies to all ABAP types
and as such covers all the functions of the DESCRIBE TABLE statement.
1. ...
LINES n
2. ...
OCCURS n
3. ... KIND k
... LINES n
Places the number of filled lines of the table t in the field lin. The value returned to lin has type I.
The number of filled lines of the table itab can also be ascertained using the predefined function lines( itab ).
DATA: N TYPE I,
ITAB TYPE TABLE OF I.
...
CLEAR ITAB.
APPEND 36 TO ITAB.
DESCRIBE TABLE ITAB LINES N.
Result: N contains the value 1.
... OCCURS n
Passes the size of the OCCURS parameter from the table
definition (as defined with DATA)
to the variable n. The value returned to n has type I.
DATA: N1 TYPE I,
N2 TYPE
I,
ITAB1 TYPE TABLE OF I INITIAL SIZE 10,
ITAB2
TYPE I OCCURS 5.
DESCRIBE TABLE ITAB1 OCCURS N1.
DESCRIBE TABLE ITAB2 OCCURS N2.
Result: OCC contains the value 10 and N2 the value 5.
... KIND k
Writes the table type from itab
to the variables
n. The value returned to k
is of type
C. The constants SYDES_KIND-STANDARD,
SYDES_KIND-SORTED and SYDES_KIND-HASHED
are defined in the type group SYDES for the return values.
Generic FORM routine any table type
TYPE-POOLS: SYDES.
...
FORM GENERIC_FORM USING ITAB TYPE ANY TABLE.
DATA: K
TYPE C.
DESCRIBE TABLE ITAB KIND K.
CASE K.
WHEN
SYDES_KIND-STANDARD.
...
WHEN SYDES_KIND-SORTED.
...
WHEN SYDES_KIND-HASHED.
...
ENDCASE.
ENDFORM.
Determining the Attributesof Internal Tables