This is a test message to test the length of the message box.
ABAP Obsolete Call Method
Created by Software-Heroes

ABAP Obsolete - Call Method


Of course, the obsolete command does not mean the use of classes, but rather the use of additional commands to call and use methods.

The use of the addition Call Method is no longer up-to-date and may result in the source code being less readable. In this context, there are also two variants for calling methods:

  • Calling Call Method without parentheses is based on the call of function modules and is now very outdated
  • Calling with parentheses reminds you of the normal call of methods with the addition of a keyword but also not actual

We would like to show you the current state of development.


Status quo

Currently classes and methods are called as known from other languages. The object is specified, followed by the specification of the method. Within the class, you then have the opportunity to refer to the object or directly call the method that comes from the current class (see examples 1 & 2).

" Call outside a class
lo_obj->do_something( ld_bukrs ).

" Call inside a class (1)
do_something( ld_bukrs ).

" Call inside a class (2)
me->do_something( ld_bukrs ).



As always, there are exceptions where the call method command is useful and can be used. This is the case if you want to call a local class method in another program.

A small piece of coding for that purpose:

" Special case for calls
CALL METHOD ('PROGRAM={Programm}CLASS={Klasse}')=>('{Methode}')​
    " ...
    " ...

In this case, the class is called in another program and the static method is executed. The transfer of parameters is also possible, if you need this.

With this variant, however, the question arises as to whether the method should not already have been outsourced to a global class.



The use of Call Method has long been unnecessary and does not look really modern. It comes from the time of the function modules and should play no role in your modern programming style.


SAP Documentation CALL METHOD

Included topics:
Comments (0)

And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.

ABAP - Naming conventions

Category - ABAP

How important is it nowadays to adhere to naming conventions or even to use naming conventions in the modern ABAP environment? We want to look at that in this article.



Category - ABAP

APPEND already has a long history in ABAP, but this will play less and less of a role in the future. We'll show you why.


ABAP Obsolete - Assignment and calculation

Category - ABAP

How does it actually work with the assignments and the calculation in ABAP? Here you will find out the current language constructs and what you should avoid.


ABAP Obsolete - Ranges and Headers

Category - ABAP

Generate a decent range for an interface? Tables with or without header lines? We show you what is still possible and what you should rather be.



Category - ABAP

Again we have for you a most used ABAP term for which there is already a new alternative, this time not just one alternative.