CALL METHOD - dynamic_meth
Short Reference
ABAP Syntax ... (meth_name)
| cref- (meth_name)
| iref- (meth_name)
| (class_name)= (meth_name)
| (class_name)= meth
| class= (meth_name) ... .
ABAP_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) ... .
What does it do? 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.
ABAP_ALTERNATIVE_1 ... (meth_name) ... .
What does it do? This variant is only possible for methods of the same
class. It has the same effect as me- (meth_name) (see alternative
2).
ABAP_ALTERNATIVE_2 ... cref- (meth_name) ... .
What does it do? 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
ABAP_ALTERNATIVE_3 ... iref- (meth_name) ... .
What does it do? 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 .
Latest notes: Unlike access using class reference variables, interface
reference variables can only be used to access interface components, not
all components (even dynamically).
ABAP_ALTERNATIVE_4 ... (class_name)= (meth_name) ... .
ABAP_ALTERNATIVE_5 ... (class_name)= meth ... .
ABAP_ALTERNATIVE_6 ... class= (meth_name) ... .
What does it do? 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.
Latest notes: If, in class_name , a class of another program is
specified using an absolute type name
, this program is loaded into a new
additional program group or
into the current program group ,
depending on the program type (if not already loaded). If required, the
program constructor is also
executed.
The external calling of local class methods is
critical , especially for executable programs,
module pools, and subroutine pools, since it can usually not be
determined statically which program group the framework group is
assigned to.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved