Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  Classic Objects in ABAP Dictionary →  Data Types →  Structures →  Dictionary DDL for Structure Definitions →  DEFINE STRUCTURE 

DEFINE STRUCTURE - component

Other versions: 7.31 | 7.40 | 7.54

Syntax


[component_annos] 
[foreign_key_annos]
[KEY] comp : { {data_element [ value_help]
                             [foreign_key]}
               |abap. type[(n)|(n,m)] }
           | { REFERENCE TO any_type }
           | { struct [BOXED] }
           | { table_type }
           [NOT NULL];

Effect

Defines a single component in the definition of a structure using the statement DEFINE STRUCTURE in Dictionary DDL.

  • Optional component properties can be specified using annotations component_annos before the component itself is specified.
  • comp indicates the name of the component.
  • data_element or abap.type is used to define an elementary component or a component with a reference type:
  • data_element can be used to specify an existing data element. If the data element has an elementary data type, an elementary component is defined. If the data element has a reference type, the component is defined with this reference type.
  • abap.type[(n)|(n,m)] can be used to specify a built-in data type from ABAP Dictionary and an elementary component of this type is defined. When specified after the mandatory prefix abap, type indicates the type. n and m must be used to specify the length and number of decimal places, as specified by the type.
  • REFERENCE TO any_type is used to define a reference type. For any_type, the syntax abap.type[(n)|(n,m)] can be used to specify any existing data types from ABAP Dictionary, classes or interfaces from the class library, the generic types DATA or OBJECT, or built-in types.
  • struct [BOXED] is used to define a substructure. Structures, database tables, or views from ABAP Dictionary can all be specified for struct. BOXED can be used to define the substructure as a static box.
  • table_type is used to define a tabular component. Table types from ABAP Dictionary can be specified for table_type.
  • The additions KEY and NOT NULL can be used to define the component as a key field and to set a flag for initial values. Both these additions are only applicable to structures that are included in database tables.
  • The addition value_help can be used to assign a search help to a structure component whose data type is defined using a data element with elementary data type.
  • The addition foreign_key can be used to define a foreign key dependency for a structure component whose data type is defined using a data element with elementary data type. This addition is only applicable to structures that are included in database tables.


Note

The activation type (relevant only for database tables) cannot be modified using DEFINE STRUCTURE.


Example

Defines elementary components of the structure DEMO_DAY with reference to built-in dictionary types. In the example for include structures, the structure is included more than once in another structure.

@EndUserText.label : 'Demo for include structure'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
define structure demo_day {
  work : abap.char(8);
  free : abap.char(16); }

Continue

DEFINE STRUCTURE - component_annos

DEFINE STRUCTURE - value_help