ABAP Keyword Documentation → ABAP − Reference → Declarations → Typing → typing Addition
typing - Addition - complete_type
Other versions: 7.31 | 7.40 | 7.54
Syntax
... { TYPE {[LINE OF] complete_type}
| {REF TO type} }
| { LIKE {[LINE OF] dobj}
| {REF TO dobj} } ...
Effect
To completely type a formal parameter or a field symbol, you can
- specify any non-generic type (
complete_type) afterTYPE.complete_typecan be a non-generic data type from ABAP Dictionary, a non-generic public data type from a global class, a non-generic program-local type already defined usingTYPES<, or a non-generic built-in ABAP type.
- By specifying a data object
dobjafterLIKE.dobjis specified based on the rules TYPES ... LIKE. The bound type of the data object is applied. If field symbols and formal parameters are specified fordobj, they must be fully typed, to make sure that their typing is full.
If complete_type or the data type of dobj is table-like, LINE OF can be used to reference the appropriate row type.
REF TO types the formal parameter or field symbol as a reference variable.
In this case, the same rules apply as for the definition
of reference types in TYPES. Typings with TYPE REF TO data or TYPE REF TO object are also considered as full typings.
If an actual parameter or a memory area is assigned to fully typed formal parameters or field symbols, the technical attributes of the specified data type must match the typing exactly (see Typing Check), except when passing literals. Completely typed formal parameters and field symbols can be used in the same operand positions as data objects of the corresponding data type.
Type attributes specified by the typing are used during both static and dynamic access to a fully typed formal parameter or field symbol.
Notes
- The data types of the ABAP Dictionary that can be referred to with
TYPEinclude specifically the CDS entities (CDS views, CDS table functions, CDS hierarchies, and abstract CDS entities).
- Complete data types, which can be referenced with
TYPE, or indirectly usingLIKE, also include enumerated types.
LIKEcan be used to reference the public attributes of global classes.
- In a
LIKEreference to an internal table with a header line, the header line is used. To reference the table type,[]must be appended to the name in the usual way. A formal parameter (with the exception of table parameters) or a field symbol can be typed only with reference to the header line or to the table type.
- Outside classes,
LIKEcan also be used for an obsolete type reference.
- The predefined generic data type
anycannot currently be specified afterREF TO.
Example
In the following example, the field symbol <spfli> is fully typed with
the structured data type spfli from ABAP Dictionary, and can therefore be used like a structure of that data type.
FIELD-SYMBOLS <spfli> TYPE spfli. ... <spfli>-carrid = ...