Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Typing →  Checking Typing 

Return Values of Functional Methods

The return value of a functional method is always fully typed and is always passed as a value. An actual parameter can be appended to the return value as follows:

If a function method is used in an operation position, the return value is used like a data object whose data type is determined with an exception by the full typing of the return value (a type-friendly actual parameter is implicitly associated with it). Checking of this typing is not necessary (or is always successful). An error always occurs, however, if the typing of the return value does not match the operand type.
If the return value of a functional method as an actual parameter is bound to a generically typed formal parameter of type p, this uses the decimal places of the return value but not its length. In this case the formal parameter is given a length of 16.
If an actual parameter is specified explicitly after RECEIVING, this parameter does not have to comply with the general typing rules for typing the formal parameter. Instead, it is enough if the formal parameter can be converted to the actual parameter in accordance with the conversion rules.

If an exception is raised when the return value is assigned to a formal parameter or when it is used as an operand, the exception cannot always be handled and a runtime error can occur instead (depending on the operand positions).

Other versions: 7.31 | 7.40 | 7.54


Notes

  • If reference variables are returned using RECEIVING, an up cast is possible but a down cast is not.

  • The special rule that a generic formal parameter of type p gets a length of 16 when a functional method is passed does not apply to the other generic types any, data, simple, or numeric.