ABAP Keyword Documentation → ABAP - Quick Reference
METHODS - Quick reference
Other versions: 7.31 | 7.40 | 7.54
Syntax
METHODS meth [ABSTRACT|FINAL]
|[DEFAULT IGNORE|FAIL]
[FOR EVENT evt OF {class|intf}]
[AMDP OPTIONS [READ-ONLY] [CDS SESSION CLIENT clnt|CURRENT]]
[ IMPORTING {{VALUE(p1)|REFERENCE(p1)|p1}
typing [OPTIONAL|DEFAULT def1]
{VALUE(p2)|REFERENCE(p2)|p2}
typing [OPTIONAL|DEFAULT def2]
... }
[PREFERRED PARAMETER p] ]
[ EXPORTING {{VALUE(p1)|REFERENCE(p1)|p1}
typing
{VALUE(p2)|REFERENCE(p2)|p2} typing
... } ]
[ CHANGING {{VALUE(p1)|REFERENCE(p1)|p1}
typing [OPTIONAL|DEFAULT def1]
{VALUE(p2)|REFERENCE(p2)|p2}
typing [OPTIONAL|DEFAULT def2]
... } ]
[ RETURNING {VALUE(r)} typing ]
[ {RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...}
| {EXCEPTIONS exc1 exc2 ...} ].
Effect
Declares an instance method meth
in the declaration part of a class or in an interface.
Additions
-
ABSTRACT
Declares an abstract method that cannot be implemented in the same class. -
FINAL
Declares a final method that cannot be redefined in a subclass. -
DEFAULT IGNORE|FAIL
Declares an optional interface method. -
FOR EVENT evt OF {class|intf}
Declares an event handler that can handle the eventevt
of the classclass
or of the interfaceintf
. Only input parameters are possible. -
AMDP OPTIONS ...
Declares attributes of AMDP methods -
IMPORTING
Defines input parametersp1
,p2
, ... -
EXPORTING
Defines output parametersp1
,p2
, ... -
CHANGING
Defines input/output parametersp1
,p2
, ... -
RETURNING
Declares a functional method with a fully typed return valuer
. -
VALUE(p1) ... VALUE(p2) ...
Defines the pass by value for a formal parameter. -
REFERENCE(p1)|p1 ... REFERENCE(p2)|p2 ...
Defines the pass by reference for a formal parameter. -
typing
Types the formal parameters. -
OPTIONAL|DEFAULT
Defines optional input or input/output parameters either with or without the replacement parametersdef1
,def2
, ... -
PREFERRED PARAMETER p
Declares a parameterp
of exclusively optional input parameters as preferred parameters. -
RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...
Declares class-based exceptionsexc1
,exc2
, ... that can be propagated from the method either with or without resumability. -
EXCEPTIONS exc1 exc2 ...
Defines non-class-based exceptionsexc1
,exc2
, ...