Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Classes and Interfaces →  Components in Classes and Interfaces →  Methods →  METHODS 

METHODS - RETURNING

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


METHODS meth [ABSTRACT|FINAL] 
            |[DEFAULT IGNORE|FAIL]

  [IMPORTING parameters [PREFERRED PARAMETER p]]
  [EXPORTING parameters]
  [CHANGING  parameters]
  RETURNING VALUE(r) typing
  [{RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...}
  |{EXCEPTIONS exc1 exc2 ...}].

Addition

... RETURNING VALUE(r) typing

Effect

This statement declares a functional instance method meth The same applies to the additions ABSTRACT, FINAL, DEFAULT, IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS as to general instance methods.

A functional method can be called as a function in a suitable reader position.

Addition

... RETURNING VALUE(r) typing

Effect

Alongside any other formal parameters, a functional method has precisely one return value r declared using the addition RETURNING. The return value must be passed by value using VALUE and be fully typed using typing. In the typing check, special rules apply, depending on whether an explicit actual parameter is bound with RECEIVING or the functional method is used in an operand position.


Notes

  • In functional method calls, a functional method obscures a predefined function with the same name. This case can occur only in the methods of the class of the functional method; however, a method should never have the same name as a predefined function.
  • Functional methods are allowed as actual parameters of methods, which enables the option of nesting method calls in an operand position.
  • Within a method, the predicate expression IS SUPPLIED can be used to check whether an actual parameter was assigned to the return value when the call was made. This is always the case in functional method calls.