SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Obsolete Language Elements → Obsolete Calls →
CALL METHOD - Static Method Call (Obsolete)
Obsolete Syntax
CALL METHOD { static_meth( )
| static_meth( a )
| static_meth( p1 = a1 p2 = a2 ... )
|
static_meth( [parameter_list] ) }.
CALL METHOD static_meth
[parameter_list].
Effect
Both statements have the same semantics and call the method that is specified statically by the name static_meth.
If CALL METHOD is used for the standalone method call, no chained method calls are possible and the operators NEW and CAST cannot be used to specify the method.
Note
CALL METHOD is no longer recommended for static method calls.
The statement CALL METHOD is now only intended for dynamic method calls and distinguishes them clearly from static calls.
Example
The three method calls in the following source code have the same meaning. The first two calls are the obsolete variants with CALL METHOD: one without parentheses and one with. The third call is the recommended variant, without CALL METHOD.
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS do_something IMPORTING p1 TYPE i
p2 TYPE i
EXPORTING p3 TYPE i
p4 TYPE i
RETURNING VALUE(r) TYPE i.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD do_something.
...
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
CALL METHOD
c1=>do_something
EXPORTING
p1 = 333
p2 = 444
IMPORTING
p3 = DATA(a1)
p4 = DATA(a2)
RECEIVING
r = DATA(a3).
CALL METHOD
c1=>do_something(
EXPORTING
p1 = 333
p2 = 444
IMPORTING
p3 = DATA(b1)
p4 = DATA(b2)
RECEIVING
r = DATA(b3) ).
c1=>do_something(
EXPORTING
p1 = 333
p2 = 444
IMPORTING
p3 = DATA(c1)
p4 = DATA(c2)
RECEIVING
r = DATA(c3) ).