SAP METHODS FUNCTIONAL ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• RETURNING METHODS

METHODS, RETURNING
Short Reference

ABAP_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 ...$}$].

ABAP Addition
... RETURNING VALUE(r) typing

What does it do?
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 read position.

ABAP Addition

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



Latest notes:

In the methods of a class, one method of the class hides a built-in function with the same name. The same applies in functional method calls. Functional method calls and specified built-in functions have similar syntax, which means it is important that a functional method is not given the same name as a built-in function.
Functional methods are allowed as actual parameters of methods, which enables the option of nesting method calls in an operand position.
The return value of a functional method is always passed by value, which means it is passed only if the functional method is completed without errors.
In functional methods, the statement RETURN can be used to assign the result of an expression expr to the return value when terminating the method.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Declaration of a functional method with input parameter and return value. The method is called functionally as an actual parameter for the input parameter of another method.
ABEXA 00418
ABAP_EXAMPLE_END

Return to menu