Skip to content

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

Quick Reference

Other versions: 7.31 | 7.40 | 7.54


... (meth_name) 
  | oref->(meth_name)
  | class=>(meth_name)
  | (class_name)=>(meth_name)
  | (class_name)=>meth ...


1. ... (meth_name) ...

2. ... (class_name) ...


1. ... (meth_name) ...

2. ... oref->(meth_name) ...

3. ... class=>(meth_name) ...

4. ... (class_name)=>(meth_name) ...

5. ... (class_name)=>meth ...


These names are used to specify methods dynamically.

Addition 1

... (meth_name) ...


meth_name expects a character-like field that must contain the name of a method when the statement is executed.

Addition 2

... (class_name) ...


class_name expects a character-like field that must contain the name of a class in uppercase letters when the statement is executed. An absolute type name can also be specified. The following can be specified for class_name:

  • Literal or constant
If the data object class_name is specified as a character literal or as a constant, it can be evaluated statically and the specified class is identified as the used object.
  • Variable
If the data object class_name is specified as a variable, it is specified only dynamically and the content is not evaluated statically.

When the statement is executed, class_name is not evaluated until runtime (in both cases).

Alternative 1

... (meth_name) ...


This variant is only possible for methods of the same class. It has the same effect as me->(meth_name) (see alternative 2).

Alternative 2

... oref->(meth_name) ...


This form may be used for all visible methods of objects. oref can be any class reference variable or interface reference variable that points to an object containing the method or interface method specified in meth_name. This method is searched for first in the static type, then in the dynamic type of oref


In the dynamic case too, only interface components can be accessed and it is not possible to use interface reference variable to access any type of component.

Alternative 3

... class=>(meth_name) ...

Alternative 4

... (class_name)=>(meth_name) ...

Alternative 5

... (class_name)=>meth ...


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.


  • 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.
  • External calls of local class methods is critical, especially for executable programs, module pools, and subroutine pools, since it is not usually possible to define statically to which program group the framework group is assigned.
  • Methods of local classes can be called externally only by specifying the compilation unit. In the case of classes defined in an include program, the name of the include program cannot be used.


This example demonstrates various types of dynamic method calls.

    CLASS-METHODS meth1. 
    METHODS: meth2, 

  METHOD meth1. 
    DATA(oref) = NEW cls( ). 
    DATA(meth) = `METH2`. 
    CALL METHOD oref->(meth). 
  METHOD meth2. 
    DATA(meth) = `METH3`. 
    CALL METHOD (meth). 
  METHOD meth3. 
    cl_demo_output=>display( 'called' ). 

  DATA(class) = `CLS`. 
  DATA(meth) = `METH1`. 
  CALL METHOD (class)=>(meth).