Ansicht
Dokumentation

ABAPCALL_METHOD_METH_IDENT_DYNA - CALL METHOD METH IDENT DYNA

ABAPCALL_METHOD_METH_IDENT_DYNA - CALL METHOD METH IDENT DYNA

rdisp/max_wprun_time - Maximum work process run time   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

CALL METHOD, dynamic_meth

Short Reference



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



Additions

1. ... (meth_name) ...

2. ... (class_name) ...



Alternatives:

1. ... (meth_name) ...

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

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

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

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



Effect

These names are used to specify methods dynamically.



Addition 1

... (meth_name) ...

Effect

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

Addition 2

... (class_name) ...

Effect

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 constants
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 recognized 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) ...


Effect

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

Alternative 2

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


Effect

This form is possible 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. The system first searches in the static type and then in the dynamic type of oref for the method.

Notes

  • In dynamic access as in static access, interface reference variables cannot be used to access arbitrary components, but only interface components.

Alternative 3

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


Alternative 4

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


Alternative 5

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


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.

For alternatives with a dynamic class specification (class_name), the system first searches the class and then the method. If class is specified statically, the search for the method is carried out in the existing class.

Notes

  • External calls of local class methods is critical, especially for executable programs, module pools, and subroutine pools, since it is not usually possible to statically determine to which program group such programs are 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.

Example

This example demonstrates different types of dynamic method calls.






ROGBILLS - Synchronize billing plans   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 6951 Date: 20240616 Time: 102834     sap01-206 ( 92 ms )