SAP CALL METHOD STATIC SHORT ABAP Statements

Get Example source ABAP code based on a different SAP table
  



meth( ... ) - Standalone Method Call

Short Reference


ABAP Syntax {
static_meth( )
| static_meth( a )
| static_meth( p1 = a1 p2 = a2 ... )
| static_meth( [ EXPORTING p1 = a1 p2 = a2 ...]
[IMPORTING p1 = a1 p2 = a2 ...]
[CHANGING p1 = a1 p2 = a2 ...]
[RECEIVING r = a ]
[EXCEPTIONS [exc1 = n1 exc2 = n2 ...]
[OTHERS = n_others]] ) }.

ABAP_ALTERNATIVES:
1 static_meth( ).
2 static_meth( a ).
3 static_meth( p1 = a1 p2 = a2 ... ).
4 static_meth( EXPORTING ... IMPORTING ... CHANGING ... RECEIVING ... ).

What does it do? Static call of a method specified by the name static_meth as a standalone statement. In the parentheses, the parameter interface of the method is supplied with the actual parameters. In the first alternative, no formal parameters are supplied with actual parameters. The second and third alternatives are short forms for methods where only the input parameters are supplied with actual parameters. The fourth alternative allows all possible formal parameters to be supplied with actual parameters, and the handling of non-class-based exceptions.

ABAP Alternative 1 static_meth( ).

What does it do? Calls the method static_meth without pass by parameter. The method can either have no input parameters or input/output parameters or only optional input parameters or input/output parameters. An actual parameter is not assigned to any output parameters or return codes.
INTHINT Undocumented feature: The spaces after the opening and before
INTHINT the closing bracket can be omitted
INTHINT if the actual parameter is a text literal within quotes.



Example ABAP Coding
Calls a method without parameters.
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS do_something.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD do_something.
...
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
c1=>do_something( ).

ABAP Alternative 2 static_meth( a ).

What does it do? This is the short form of: static_meth( EXPORTING p = a ).

The method 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 of a is passed to this input parameter; this value can be specified as a data object, function, or expression.

The method can only have optional input/output parameters. No actual parameters are assigned to these input/output parameters, any output parameters, or a return value.
INTHINT Undocumented feature: The space before the closing
INTHINT bracket can be omitted if the last actual parameter
INTHINT is a text literal within quotes.



Example ABAP Coding
Calls a method with an input parameter
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS do_something IMPORTING p type i.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD do_something.
...
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
c1=>do_something( 333 ).

ABAP Alternative 3 static_meth( p1 = a1 p2 = a2 ... ).

What does it do? This is the short form of: static_meth( EXPORTING p1 = a1 p2 = a2 ... ).

The method static_meth can have any number of input parameters p1, p2, and so on, which are supplied with the actual parameters a1, a2, and so on. The actual parameters can be specified as a data object, function, or expression.

The method can only have optional input/output parameters. No actual parameters are assigned to these input/output parameters, any output parameters, or a return value.
INTHINT Undocumented feature: The space before the closing
INTHINT bracket can be omitted if the last actual parameter
INTHINT is a text literal within quotes.



Example ABAP Coding
Calls a method with two input parameters.
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS do_something IMPORTING p1 type i
p2 type i.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD do_something.
...
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
c1=>do_something( p1 = 333 p2 = 444 ).


ABAP Alternative 4 static_meth( EXPORTING ... IMPORTING ... CHANGING ... RECEIVING ... ).

What does it do? Calls the method static_meth with explicit pass by parameter and the option of handling non-class-based exceptions. This format can be used to call methods with any number of parameter interfaces.



Example ABAP Coding
Calls a method with explicit pass by parameter.
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.
c1=>do_something( EXPORTING p1 = 333
p2 = 444
IMPORTING p3 = DATA(a1)
p4 = DATA(a2)
RECEIVING r = DATA(a3) ).

Return to menu