DESCRIBE FIELD INTO

Note

This statement is for internal use only.
It cannot be used in application programs.


Syntax

DESCRIBE FIELD dobj INTO td.

Effect

All characteristics of the field f, its components , sub-components etc. are displayed in the field td (type description). td has to be of the type SYDES_DESC, defined in Type Group SYDES. Because of this, the type group SYDES must be integrated into the ABAP-program with a TYPE-POOLS statement .

The structure SYDES_DESC has two table-type components TYPES and NAMES:

The type description table (TYPES) not only stores information about the tree structure but also further information about the type of f resp. its components. This includes especially all information that can be determined using the usual additions to DESCRIBE FIELD. In detail, TYPES contains the following columns:

IDX_NAME
Component Name
IDX_USER_TYPE
Name of a user-defined type, i.e., a type that was defined through its TYPES-statement. Derived types (... TYPE A-B) and structures from the ABAP-Dictionary are not considered to be user-defined types.
CONTEXT
For user-defined types only: The context, in which the type is defined. Possible values are defined in the constant SYDES_CONTEXT of the type group SYDES. Please only use these constants to carry out a comparison. In detail, we distinguish between the following type contexts:

SYDES_CONTEXT-PROGRAM: Program-global type
SYDES_CONTEXT-FORM   : FORM-local type
SYDES_CONTEXT-FUNCTION: FUNCTION-local type
SYDES_CONTEXT-METHOD : METHOD-local type
IDX_CONTEXT_NAME
For user-defined types only:
With a local context: The name of the FORM or FUNCTION, whose type was defined. The name of the associated program is then the first entry in the name table.
With a global context: The name of the program in which the type was defined.
IDX_EDIT_MASK
Conversion routine from the ABAP-Dictionary, is in accordance with the addition EDIT MASK at simple DESCRIBE.
IDX_HELP_ID
Help-Id when referencing to fields from the ABAP-Dictionary
LENGTH
Internal length, corresponds to the addition LENGTH at simple DESCRIBE
OUTPUT_LENGTH
Output length, corresponds to the addition OUTPUT-LENGTH at simple DESCRIBE
DECIMALS
Number of decimal digits, corresponds to the addition DECIMALS at simple DESCRIBE
TYPE
ABAP-Type, corresponds to the addition TYPE at simple DESCRIBE
TABLE_KIND
A table type is stored here for the components which represent an internal table. The same values are returned as with the variant DESCRIBE TABLE itab KIND k. Components which do not represent a table get the return value set to SYDES_KIND-UNDEFINED (see type group SYDES).

Example

Example definition of the complex data type EMPLOYEE_STRUC:

PROGRAM DESCTEST.



TYPES: BEGIN OF name_struc,
         first  TYPE c LENGTH 20,
         last   TYPE c LENGTH 20,
       END OF name_struc,

       BEGIN OF absence_time_struc,
         day        TYPE d,
         from       TYPE t,
         to         TYPE t,
       END OF absence_time_struc,

       phone_number TYPE n LENGTH 20,

       BEGIN OF employee_struc,
         id         LIKE sbook-customid,
         name       TYPE name_struc,
         BEGIN OF address,
           street  TYPE c LENGTH 30,
           zipcode TYPE n LENGTH 4,
           place   TYPE c LENGTH 30,
         END OF address,
         salary_per_month TYPE p LENGTH 10 DECIMALS 3,
         absent           TYPE STANDARD TABLE OF absence_time_struc
                               WITH NON-UNIQUE DEFAULT KEY,
         phone            TYPE STANDARD TABLE OF phone_number
                               WITH NON-UNIQUE DEFAULT KEY,
       END OF employee_struc.

You can determine the structure of the type EMPLOYEE_STRUC by collecting the type group SYDES as follows:

TYPE-POOLS: sydes.

DATA: employee TYPE employee_struc,
      td       TYPE sydes_desc.

DESCRIBE FIELD employee INTO td.

The following table shows a few selected columns of the type description table TD-TYPES. For a better overview, the names of the columns IDX_NAME, IDX_UERR_TYPE and IDX_EDIT_MASK have been shortened:



    |FROM| TO |BACK|NAME|UTYP|EMSK|TYPE
----|----|----|----|----|----|----|----
  1 |  2 |  7 |  0 |  0 |  2 |  0 |  v
  2 |  0 |  0 |  1 |  6 |  0 |  4 |  N
  3 |  8 |  9 |  1 |  7 |  5 |  0 |  u
  4 | 10 | 12 |  1 |  8 |  0 |  0 |  u
  5 |  0 |  0 |  1 |  9 |  0 |  0 |  P
  6 | 13 | 13 |  1 | 11 |  0 |  0 |  h
  7 | 17 | 17 |  1 | 12 |  0 |  0 |  h
  8 |  0 |  0 |  3 | 13 |  0 |  0 |  C
  9 |  0 |  0 |  3 | 14 |  0 |  0 |  C
10 |  0 |  0 |  4 | 15 |  0 |  0 |  C
11 |  0 |  0 |  4 | 16 |  0 |  0 |  N
12 |  0 |  0 |  4 | 17 |  0 |  0 |  C
13 | 14 | 16 |  6 |  0 | 18 |  0 |  u
14 |  0 |  0 | 13 | 20 |  0 |  0 |  D
15 |  0 |  0 | 13 | 21 |  0 |  0 |  T
16 |  0 |  0 | 13 | 22 |  0 |  0 |  T
17 |  0 |  0 |  7 |  0 |  0 |  0 |  N


Please note that the entries in rows 6 and 7 represent internal tables (ABAP-Type h). There is always an entry for the corresponding row type (rows 13 and 17) to an internal table.

The indices in the rows 5 to 7 refer to entries in the name table TD-NAMES. If you look, e.g., at row 3, you find the corresponding component name in TD-NAMES from row 7 (NAME) onward and the corresponding user type from row 5 (NAME_STRUC) onward.

In the name table TD-NAMES you find the following entries. Note that the names SALARY_PER_MONTH and ABSENCE_TIME_STRUC are stored in two parts:


    |CONTINUE|NAME                   |CONTINUE|NAME
----|--------|--------------     ----|--------|--------------
  1 |        |DESCTEST            12 |        |PHONE
  2 |        |EMPLOYEE_STRUC      13 |        |FIRST
  3 |        |SBOOK-CUSTOMID      14 |        |LAST
  4 |        |==ALPHA             15 |        |STREET
  5 |        |NAME_STRUC          16 |        |ZIPCODE
  6 |        |ID                  17 |        |PLACE
  7 |        |NAME                18 |   *    |ABSENCE_TIME_ST
  8 |        |ADDRESS             19 |        |RUC
  9 |   *    |SALARY_PER_MONT     20 |        |DAY
10 |        |H                   21 |        |FROM
11 |        |ABSENT              22 |        |TO