SAP METHODS - Reference ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for METHODS

METHODS

ABAP Reference
ABAP Code Snippet


ABAP Syntax METHODS meth [ABSTRACT|FINAL]

[FOR EVENT evt OF {class|intf}]
[ 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 ...} ].
ABAP Code Snippet

What does it do? Declares an instance method meth in the declaration part of a class or in an interface.

ABAP Addition 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.
FOR EVENT evt OF {class|intf}
Declares an event handler that can handle the event evt of the class class or of the interface intf. Only input parameters are possible.
IMPORTING
Defines input parameters p1, p2, ...
EXPORTING
Defines output parameters p1, p2, ...
CHANGING
Defines an input/output parameter p1, p2, ...
RETURNING
Declares a functional method with a fully typed return value r.
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 parameters def1, def2, ...
PREFERRED PARAMETER p
Declares a parameter p of exclusively optional input parameters as preferred parameters.
RAISING exc1|RESUMABLE(exc1) exc2|RESUMABLE(exc2) ...
Declares class-based exceptions exc1, exc2, ... that can be propagated from the method either with or without resumability.
EXCEPTIONS exc1 exc2 ...
Defines non-class based exceptions exc1, exc2, ...

Return to menu