Static Method Call
1. [CALL METHOD]
static_meth( parameter_list ).
CALL METHOD static_meth
parameter_list.
Short Forms
2. [CALL METHOD] { static_meth
( )
| static_meth
( a )
| static_meth
( p1 = a1 p2 = a2 ... ) }.
Dynamic Method Call
3. CALL METHOD
dynamic_meth { parameter_list
|
parameter_tables }.
Call of a method in ABAP Objects. There is a difference between a static method call, in which the method ID must be fully known in the program, and a dynamic method call, in which the method ID is determined entirely or in parts at runtime. The static method call can be executed in different forms. In one form, the parameters are passed in a parenthetical expression, in the other without a parenthetical expression. For the parenthetical expression, short forms are allowed. With the dynamic method call, you are not allowed to specify the parameters in parentheses and you must use the statement CALL METHOD.
When you call an instance method using a reference variable and the static type of the reference variable
is a superclass of the dynamic type, then you can use the dynamic method call to call all visible methods
of the dynamic type, whereas with the static method call, you can call only the visible methods of the static type.
System fields
The system field sy-subrc is set to 0 when a method is called. If a
non-class-based exception occurs that was handled through the assignment of a value, sy-subrc is set to this value.
Functional methods cannot only be called with CALL METHOD, but also at
operand positions.
Catchable Exceptions
CX_SY_DYN_CALL_EXCP_NOT_FOUND
CX_SY_DYN_CALL_ILLEGAL_CLASS
CX_SY_DYN_CALL_ILLEGAL_METHOD
CX_SY_DYN_CALL_ILLEGAL_TYPE
CX_SY_DYN_CALL_PARAM_MISSING
CX_SY_DYN_CALL_PARAM_NOT_FOUND
CX_SY_REF_IS_INITIAL
Non-Catchable Exceptions