ABAP Keyword Documentation → ABAP − Reference → Calling and leaving program units → Calling Processing Blocks → Calling Procedures → Method Calls → Static Method Calls → meth( ... ) - Standalone Method Call
meth( ... ) - Statically specified method
Other versions: 7.31 | 7.40 | 7.54
Syntax
... meth
| oref->meth
| class=>meth
| super->meth ...
Alternatives
2. ... oref->meth ...
3. ... class=>meth ...
Effect
These names are used for to specify methods statically, where meth
is a valid
name for the method in the current context. A special case of specifying methods statically is when
they are specified after the pseudo reference super
in methods of subclasses.
Note
The name of a method can be the name of the method declared in METHODS
, a name composed using the
interface component selector, or an
alias name.
Alternative 1
... meth ...
Effect
Can be specified in method implementations for any method meth
of the same
class. In instance methods, meth
is a short form of me->meth
, where me
is the
self reference.
Example
Call of method meth2
from another method meth1
.
CLASS cls DEFINITION.
PUBLIC SECTION.
METHODS meth1.
PRIVATE SECTION.
METHODS meth2.
ENDCLASS.
CLASS cls IMPLEMENTATION.
METHOD meth1.
...
meth2( ).
...
ENDMETHOD.
METHOD meth2.
...
ENDMETHOD.
ENDCLASS.
Alternative 2
... oref->meth ...
Effect
Can be specified in processing blocks in which a method meth
is visible.
Here, oref
contains an object reference to an object that contains the method as a component. The following can be specified for oref
:
- A reference variable
- A single or chained table expression whose result is a reference variable
-
A constructor expression with a
constructor operator
NEW
orCAST
This applies to both standalone method calls and functional method calls.
Example
Call of instance method meth
via a temporary reference variable generated with the NEW
operator.
CLASS cls DEFINITION.
PUBLIC SECTION.
METHODS meth.
ENDCLASS.
CLASS cls IMPLEMENTATION.
METHOD meth.
...
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
NEW cls( )->meth( ).
Alternative 3
... class=>meth ...
Effect
Can be specified in processing blocks in which a
static method meth
is visible. Here, class
is one of the classes allowed by the package check that contains the method as a
static component.
Example
Calls the static method meth
using the name of the class.
CLASS cls DEFINITION.
PUBLIC SECTION.
CLASS-METHODS meth.
ENDCLASS.
CLASS cls IMPLEMENTATION.
METHOD meth.
...
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
cls=>meth( ).