Object Oriented Programming (OOP) in SAP ABAP

Object Oriented Programming (OOP) is an approach in which programmers design programs by modeling real world entities as objects. This leads to more intuitive, maintainable, and extensible program designs; most modern OOP languages such as C++, Java and SAP’s ABAP Objects support this paradigm. This guide presents fundamental concepts required to effectively design and develop object-oriented programs with ABAP; additionally it offers an introduction into Unified Modeling Language (UML), the industry standard for object modeling.

What is OOPS ABAP ?

Object-Oriented Programming (OOP) is a problem-solving technique in which software solutions mirror objects in the real world.ABAP Objects is not a complete introduction to object orientation, but this documentation introduces some common terms. as well as those appearing within ABAP Objects; then proceeds with discussing in more depth their use within this programming language before closing with a list of titles on object orientation for further reading.

What is object oriented programming(OOP)language ?

Object oriented programming languages allow concepts like abstraction, modularity, encapsulation, polymorphism and inheritance. Simula was the first object oriented language and objects are considered an essential component. Simula allows simulation programs around objects.

The Evolution of Programming Languages

Programming languages must have the capacity to express complex ideas and thoughts clearly and concisely in order to be considered high quality. As languages evolve, they become easier for readers and writers alike to use – leading to the development of higher-level procedural languages like C and ABAP. These languages aim to improve the quality and nature of abstractions that developers interact with, leading to increased developer productivity. C programming language introduced variables with meaningful names and intuitive data types, conditional statements, and callable functions, freeing developers from technical details while enabling them to focus more fully on program logic issues. By the 1960s, however, language researchers observed a phenomenon known as semantic dissonance, where solutions in code bore little resemblance to their problem domain. This placed significant stress on developers to accurately convert software requirements into program code.

Object Oriented Programming Benefits:

  • Real-World Entity Modeling: Developers can represent real-world entities like clients, commodities, and orders as objects, making code more understandable and aligned with business domain.
  • Encapsulation: Information stored within objects can only be accessed and altered through specific methods, reducing unintentional data changes and improving data security.
  • Code Reuse: Establishing classes and using inheritance reduces redundancy and makes development more efficient.

Object Oriented Programming Features and Principles in ABAP

Inheritance is an attribute of OOP that permits classes to inherit the characteristics and techniques of a different class. In ABAP inheritance, it is accomplished through the inheritance keyword. In inheritance from an existing class, a new one is able to reuse the methods and properties in the parent class (or superclass) and then add or modify the methods as required. This reduces the number of programs to be written and allows for easier maintenance of the code.

Polymorphism is another characteristic of OOP that allows objects to adopt various forms. In ABAP, polymorphism is implemented using abstract classes and interfaces. Interfaces specify a set of processes that classes must implement, and abstract classes are a collection of methods that classes that are subclasses of the class can rewrite. This lets objects adopt various forms, depending on the context within which they’re used, and makes them more adaptable and flexible.

Another aspect of OOP that ABAP allows includes the usage of encapsulation, which allows programmers to shield the internal code of their class from the outside world. This means that data and methods used by a class may only be accessed via the class’s interface, making the code more reliable and less vulnerable to erroneous code.


In addition, the Model-View-Controller (MVC) pattern and other object-oriented design patterns are compatible with ABAP, allowing for a more readable and maintainable code structure. An architectural pattern known as Model-View-Controller (MVC) separates an application into its data and business logic models and an application layer. Lastly, the controller ensures that the views and models communicate with each other, while the view handles the user interface. The MVC pattern allows for the separation of code into multiple layers, each with its own set of responsibilities, which makes the code more readable, maintainable, updateable, and extensible.

Event handling, exception handling, and data type are just a few of the supplementary features that ABAP offers to help with the development of dependable and maintainable code, in addition to its OOP capabilities.ABAP also supports third-party frameworks and libraries, such as the ABAP Object Services (AOS) and the ABAP Workbench, which provide developers with even more tools and features for creating and maintaining code.

Basic OOP Concepts in ABAP

Let us first gain a basic understanding of object-oriented programming.

Classes and Objects:

  • class in ABAP OOP serves as a blueprint for creating objects. It defines attributes (data members) and methods (functions).
  • Class objects represent real-world entities.


  • Methods are functions defined within a class. They encapsulate behaviour and allow interaction with objects.
  • For example, a calculateSalary method in an Employee class can compute an employee’s salary.


  • Inheritance enables the creation a new class (subclass) based on an existing class (superclass).
  • Subclasses inherit attributes and methods from their superclass.
  • Example:


  • Encapsulation hides the internal details of a class and exposes only necessary interfaces.
  • It ensures data integrity and prevents unauthorized access.


  • Polymorphism allows objects of different classes to be treated uniformly.
  • It enables method overloading and method overriding.
  • Example: METHOD speak.
    • WRITE: ‘Animal speaks’.
    • METHOD speak.
    • WRITE: ‘Dog barks’.


  • Abstraction emphasizes key features while concealing others.
  • It simplifies complex systems by providing a high-level view.


  • Interfaces define a contract that classes must adhere to.
  • A class can implement multiple interfaces.
  • Example:
    • INTERFACE Z_Employee.
    • METHODS calculateSalary.

Comparison: Procedural vs. Object-Oriented Programming

Object Oriented Programming


In conclusion, ABAP is an object-oriented programming language that uses inheritance, polymorphism, encapsulation, and design patterns to help developers write code that is both easy to maintain and reliable. Using OOP in ABAP lets developers make code that can be used again and again, use design patterns, handle exceptions, and add on libraries and frameworks. When combined with ABAP’s strong integration with the SAP ERP system, these features make it a powerful tool for making customized business applications that meet a wide range of needs.

Object-oriented programming (OOP) has been used more and more over the years, and some newer SAP modules are built entirely with it. It is very important for developers to understand this new paradigm, adopt it, and start using it more often. However, it’s likely that a lot of Structured code written the “old” way will still be around for a long time.

We are a group of SAP Consultants who want to teach and make studying tough SAP topics easier by providing comprehensive and easy-to-understand learning resources.

Leave a Reply


Enjoy this blog? Please spread the word :)