ABAP Keyword Documentation → ABAP - Reference → Calling and leaving program units → Calling Processing Blocks → Calling procedures → CALL METHOD
CALL METHOD - static
Other versions: 7.31 | 7.40 | 7.54
Syntax
[CALL METHOD] static_meth(parameter_list ).
CALL METHOD static_meth
parameter_list.
Effect
Both statements call the method that is statically specified by the identifier static_meth
.
Use parameter_list
to assign actual parameters to the formal parameters of the method and return values to the
non-class-based exceptions. You can specify parameter_list
with or without parentheses. If you use parentheses,
short forms are possible. If you do not use parentheses, no short forms are allowed.
You can and should omit CALL METHOD
when using parentheses.
Note
We recommend that you do not specify the optional CALL METHOD
expression if you use parenthesis.
Example
In method m2
, method m1
of the own class is called.
The interface parameters are filled and the possible exceptions are treated in a CASE
structure.
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS: m1 IMPORTING p1 TYPE string
p2 TYPE I
EXPORTING p3 TYPE d
p4 TYPE decfloat16
EXCEPTIONS ex1
ex2,
m2.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
...
ENDMETHOD.
METHOD m2.
DATA: text TYPE string,
number TYPE i,
date TYPE d,
amount TYPE decfloat16
...
m1( EXPORTING p1 = text
p2 = number
IMPORTING p3 = date
p4 = amount
EXCEPTIONS ex1 = 10
ex2 = 20
OTHERS = 30 ).
CASE sy-subrc.
WHEN 10.
...
WHEN 20.
...
WHEN 30.
...
ENDCASE.
ENDMETHOD.
ENDCLASS.