sapdev logo background
sapdev logo sapdev logo
Comments

ABAP METHODS FUNCTIONAL Statement syntax, information and example SAP source code



Return to Statement index



METHODS - RETURNING

Short Reference

ABAP Syntax_2 METHODS meth [ABSTRACT|FINAL]
[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 , 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.

ABAP_ADDITION ... RETURNING VALUE(r) typing

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

Latest 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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




METHODS_EVENT_HANDLER
METHODS_GENERAL




comments powered by Disqus