Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Calling and leaving program units →  Calling Processing Blocks →  Calling procedures →  CALL METHOD 

CALL METHOD meth( ... )

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


[CALL METHOD] { static_meth( ) 
              | static_meth( a )
              | static_meth( p1 = a1 p2 = a2 ... ) }.

Alternatives

1. [CALL METHOD] static_meth( ).

2. [CALL METHOD] static_meth( a ).

3. [CALL METHOD] static_meth( p1 = a1 p2 = a2 ... ).

Effect

These three variants are short forms for parameter lists in parentheses in static method calls.


Notes

Alternative 1

[CALL METHOD] static_meth( ).

Effect

This is the short form of:

CALL METHOD static_meth.

The method termed static_meth can either have no input parameters or input/output parameters or only optional input parameters or input/output parameters. No values are passed. An actual parameter is not assigned to any output parameters or return codes.

Alternative 2

[CALL METHOD] static_meth( a ).

Effect

This is the short form of:

CALL METHOD static_meth EXPORTING p = a.

The method termed static_meth can have either only one non-optional input parameter p or only optional input parameters, of which p is defined as the preferred parameter using PREFERRED PARAMETER. The value in a is passed to this input parameter.

The method can have optional input/output parameters, output parameters, or a return code, and no actual parameters are assigned to them.

A calculation expression can be specified for a.

Alternative 3

[CALL METHOD] static_meth( p1 = a1 p2 = a2 ... ).

Effect

This is the short form of:

CALL METHOD static_meth EXPORTING p1 = a1 p2 = a2 ... .

The method termed static_meth can have any input parameters p, which are supplied with the actual parameters a. However, it can only have optional input/output parameters. No actual parameter is assigned to these input/output parameters, any output parameters, or return values.

Calculation expressions can be specified for a1, a2, ....


Example

Call of three methods of an object of class c1 in short form.

CLASS c1 DEFINITION. 
  PUBLIC SECTION. 
    METHODS: m0 IMPORTING p1 TYPE i OPTIONAL 
                EXPORTING p2 TYPE i 
                CHANGING  p3 TYPE i OPTIONAL, 
             m1 IMPORTING p1 TYPE i, 
             m2 IMPORTING p1 TYPE i 
                          p2 TYPE i 
                RETURNING value(p3) TYPE i. 
ENDCLASS. 

CLASS c1 IMPLEMENTATION. 
  METHOD m0. 
    ... 
  ENDMETHOD. 
  METHOD m1. 
    ... 
  ENDMETHOD. 
  METHOD m2. 
    ... 
  ENDMETHOD. 
ENDCLASS. 

DATA: o1   TYPE REF TO c1, 
      num1 TYPE i, 
      num2 TYPE i. 

START-OF-SELECTION. 

  CREATE OBJECT o1. 
  o1->m0( ). 
  o1->m1( num1 ). 
  o1->m2( p1 = num1 p2 = num2 ).