Entering content frameDetermining the Attributes of Internal Tables Locate the document in its SAP Library structure

To find out the attributes of an internal table at runtime that were not available statically, use the statement:

DESCRIBE TABLE <itab> [LINES <l>] [OCCURS <n>] [KIND <k>].

If you use the LINES parameter, the number of filled lines is written to the variable <lin>. If you use the OCCURS parameter, the value of the INITIAL SIZE of the table is returned to the variable <n>. If you use the KIND parameter, the table type is returned to the variable <k>: ‘T’ for standard table, ‘S’ for sorted table, and ‘H’ for hashed table.

Example

DATA: BEGIN OF LINE,
         COL1 TYPE I,
         COL2 TYPE I,
      END OF LINE.

DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1
                                    INITIAL SIZE 10.

DATA: LIN TYPE I,
      INI TYPE I,
      KND TYPE C.

DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.
WRITE: / LIN, INI, KND.

DO 1000 TIMES.
  LINE-COL1 = SY-INDEX.
  LINE-COL2 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.

DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.
WRITE: / LIN, INI, KND.

The output is:

         0         10  H

     1,000         10  H

Here, a hashed table ITAB is created and filled. The DESCRIBE TABLE statement is processed before and after the table is filled. The current number of lines changes, but the number of initial lines cannot change.

 

 

 

Leaving content frame