Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts 

Typing

Typing means defining a generic or complete data type for a formal parameter of a procedure or for a field symbol. When an actual parameter is assigned to a formal parameter, or a data object to a field symbol, a check is carried out to make sure the data type matches the typing.

Other versions: 7.31 | 7.40 | 7.54

Generically Typed

Unlike data objects, where the data type has a specific property and is always fully established, formal parameters and field symbols that are generically typed receive their complete data type only upon transfer of an actual parameter when a procedure is called or when a memory area is assigned using ASSIGN.

When using generically typed formal parameters or field symbols, a difference is made between static and dynamic access.

  • In static access to a generically typed formal parameter, field symbol, or their components, the type attributes specified by the typing of the formal parameter are used.
  • In static access to a generically typed formal parameter, field symbol ,or their components, the type attributes of the actual parameter are used.

The attributes of the actual parameter, which are not checked in calls or assignments, can be different from those of the formal parameter. This can result in different behaviour in static and dynamic accesses. A dynamic access to components of generically typed formal parameters will result in a runtime error, if the components are not available in the actual parameter.

Fully Typed

During compilation and at runtime, formal parameters and field symbols that are completely typed are treated in the same way as data objects with completely known data types.

During the use of completely typed formal parameters, or field symbols, the attributes specified by the typing are used, regardless of whether they are accessed statically or dynamically.


Notes

  • The typing of formal parameters or field symbols defines some or all of the type attributes before the actual specification of the type. This permits the use of formal parameters and field symbols in operand positions that require certain type attributes.

  • The static type of data reference variables is always completely generic (data) or completely typed (see DATA - reference variables).

Programming Guideline

Be as specific as possible when typing formal parameters

Continue

typing Addition

Checking Typing

Generic and Complete Typing