SAP TYPES ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for TYPES

TYPES

Short Reference
• TYPES ABAP Statement


ABAP Syntax


Using Predefined Types

1 TYPES { {dtype[(len)] TYPE abap_type [DECIMALS dec]}
| {dtype TYPE abap_type [LENGTH len] [DECIMALS dec]} }.

Reference to Existing Types

2 TYPES dtype { {TYPE [LINE OF] type}
| {LIKE [LINE OF] dobj} }.

Reference Types

3 TYPES dtype { {TYPE REF TO type}
| {LIKE REF TO dobj} }.

Structured Types

4 TYPES BEGIN OF struc_type.
...
TYPES comp ...
TYPES comp TYPE struc_type BOXED.
ABAP Code Snippet
...
TYPES END OF struc_type.

Table types

5 TYPES dtype { {TYPE tabkind OF [REF TO] type}
| {LIKE tabkind OF dobj} }
[tabkeys] [INITIAL SIZE n].

Ranges Table Types

6 TYPES dtype {TYPE RANGE OF type}|{LIKE RANGE OF dobj}
[INITIAL SIZE n].

LOB Handle Structures

7 TYPES dtype TYPE dbtab lob_handle_type FOR lob_handle_columns
[lob_handle_type FOR lob_handle_columns
... ].

What does it do? The TYPES statement defines either an independent data type dtype or a structured data type struc_type. The naming conventions apply to the names dtype and struc_type. The defined data type can be viewed within the current context from this position.

The syntax allows you to define elementary data types, reference types, structured types, and table types. As well as the types that are completely self-constructed, special types such as ranges table types or LOB handle structures can be derived from existing types.

For the definition of a structured type struc_type, any type definitions of two TYPES statements are included with the additions BEGIN OF and END OF; a structured data type struc_type is defined here, which contains the included data types as components struc_type-dtype. The structure definitions can be nested. Structure definitions can be nested.



Latest notes:Outside classes, LIKE can also be used for an
obsolete type reference.

Return to menu