SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Calling and leaving program units → Calling Processing Blocks → Calling Procedures → Method Calls → Dynamic Method Call → CALL METHOD →
CALL METHOD - dynamic_meth
Syntax
... (meth_name)
| cref->(meth_name)
| iref->(meth_name)
| (class_name)=>(meth_name)
| (class_name)=>meth
| class=>(meth_name) ... .
Alternatives:
1. ... (meth_name) ... .
2. ... cref->(meth_name) ... .
3. ... iref->(meth_name) ... .
4. ... (class_name)=>(meth_name) ... .
5. ... (class_name)=>meth ... .
6. ... class=>(meth_name) ... .
Effect
These names are used to specify methods dynamically. meth_name and
class_name expect character-like fields, which must contain the name of a method or a class in uppercase when the statement is executed. For class_name, an
absolute type name can also be specified.
... (meth_name) ... .
Effect
This variant is only possible for methods of the same class. It has the same effect as me->(meth_name) (see alternative 2).
... cref->(meth_name) ... .
Effect
This form is possible for all visible methods of objects. cref can be any
class reference
variable that points to an object that contains the method specified in meth_name. This method is searched for first in the
static type, then in the
dynamic type of cref
... iref->(meth_name) ... .
Effect
This form is possible for all visible interface methods of objects. iref can be any
interface reference
variable that points to an object that contains the interface method specified in meth_name. The search for this method takes place only in the
static type of iref.
Note
Unlike access using class reference variables, interface reference variables can only be used to access interface components, not all components (even dynamically).
... (class_name)=>(meth_name) ... .
... (class_name)=>meth ... .
... class=>(meth_name) ... .
Effect
These forms are possible for all visible static methods. Both the class and method can be specified dynamically. The class class and the method meth can also be specified directly.
In the alternatives with a dynamic class name (class_name), first the class is searched for, then the method. If class is specified statically, the search for the method is carried out in the existing class.
Notes