• You are here:
  • Home »

SAP OOP ABAP Class Methods

Advertisements

SAP OOP ABAP development adds OO(object-oriented) concepts to the ABAP development stack. This is implemented using objects such as a class, method along with concepts such as inheritance and polymorphism etc. SAP OOP ABAP uses SAP Class Methods which are much the same as object classes within any other development language (i.e. Java, C++) and offer you an object orientated way of developing your SAP applications. 

Advertisements

SAP Object Oriented Concepts

If you are new to OO concepts, then there are many resources available where you can try an learn about them. One of the best places to learn within an SAP environment is by taking the SAP ABAP objects online course. This is available on udemy and has almost all positive reviews. It has also be taken by nearly 5000 students including myself. 

Method vs FM ABAP code

So how do I get a class/method to work in my SAP ABAP code? On a simplistic level they are very similar to SAP function modules. The class is like the function group and the method is the actual function module that is called in order to perform the actual processing. The ABAP code for the basic call is also quite similar, only real difference is that you also have to reference the class as well as the method name. There are more powerful use cases for the method call but I will get onto that later.

Advertisements

—Function Module: 
CALL FUNCTION ‘GUI_DOWNLOAD’
EXPORTING…

Advertisements

—Class/Method:
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING…

Advertisements

You will also notice like with the example GUI_DOWNLOAD that SAP have converted many of there function modules into class methods. But for many of them all they do within the method is call the original function module. Yes it is now an OO version of the coding, but does it take advantage of the benefits of object oriented coding method? Or does it just add complexity for those developers that are not as familiar with OOP? Here is a basic example and some good comments that summarise the issues people who do not use OO concepts have when trying to understand the benefits of object orientated concepts.

Popular SAP Class objects

Here are a few links to popular SAP class objects but easiest way to find the class you are looking for is to use the search functionality on this page. 
CL_ABAP_CHAR_UTILITIES 
CL_SALV_TABLE 
CL_GUI_FRONTEND_SERVICES 
Full list of SAP classes

Index list of available classes

CL_GUI_ALV…
CL_ABAP…
CL_GUI…
Full Index list of SAP Class methods

Advertisements