Ansicht
Dokumentation
ABENMETHOD_CALL_GUIDL - METHOD CALL GUIDL
CL_GUI_FRONTEND_SERVICES - Frontend Services BAL Application Log DocumentationThis documentation is copyright by SAP AG.
Method Calls
Static calls of methods can be formulated in two different ways. The obsolete long form
CALL METHOD meth EXPORTING ...
is based on the notation of the function module call. Alternatively, a short form can be used:
meth( ... ).
This form uses a parenthesis notation instead of the initiating ABAP words CALL METHOD. A combination of CALL METHOD and parentheses is also possible.
Formulate static method calls without CALL METHOD
Use the long form of the method call using CALL METHOD only for dynamic method calls.
The short form of the static method call is clearer. The redundant ABAP words CALL METHOD provide no additional information to the reader. Using the short form, self-contained method calls have the same appearance as functional method calls on operand positions. For dynamic method calls, the long form with CALL METHOD is required by the syntax. If it is only used there, the different notations provide the reader with another distinguishing feature between the static and dynamic method call.
The following source code shows the long form of a static method call using CALL METHOD, which is no longer recommended.
...
CALL METHOD cl_class=>do_something
EXPORTING
some_input = value1
IMPORTING
some_output = value2
CHANGING
some_change = value3.
...
The following source code shows the same static method call as above, but with parentheses inserted. In this form, which also has correct syntax, either CALL METHOD or the parentheses are superfluous.
...
CALL METHOD cl_class=>do_something(
EXPORTING
some_input = value1
IMPORTING
some_output = value2
CHANGING
some_change = value3 ).
...
The following source code shows the same method call as above, but as recommended, without CALL METHOD. If a method has only importing parameters, IMPORTING and CHANGING can be omitted, and also the EXPORTING addition. If it is a single importing parameter, its name can also be omitted.
...
cl_class=>do_something(
EXPORTING
some_input = value1
IMPORTING
some_output = value2
CHANGING
some_change = value3 ).
...
CPI1466 during Backup CL_GUI_FRONTEND_SERVICES - Frontend Services
This documentation is copyright by SAP AG.
Length: 3103 Date: 20240425 Time: 022809 sap01-206 ( 47 ms )