Object-Oriented ABAP (OOABAP )

Preface – This post is part of the Object Oriented ABAP series.


Object Oriented ABAP or OOABAP is the object-oriented extension of ABAP, which mainly focuses on the object rather than the code flow. An object-oriented approach enables programmers to think like they are working with real-life entities.

Just take a real-life scenario, a person having knowledge can do various works, same in oops, object have fields to store data and with which it can do various works.

The Object-Oriented concept of ABAP mainly revolves around the classes and object, which are the basic elements of OOABAP.

Before moving further, let’s learn about the very basic and the most important elements of OABAP:


It’s a working entity of a class. Each object is unique at its own, meaning with unique identity and  attributes. Attributes defines the state of an object whereas behavior of an object refers to the changes that occur in its attributes over a period of time. An object can be associated with the class by declaring it with the same data type as of the class within which an object has been created.

An object has three characteristics –

  1. Has a state.
  2. Has unique identity.
  3. May or may not display behavior.


A class is like a blueprint of an object or a template that binds similar kind of data. It defines the characteristics of an object. Following are the components of class:

  1. Attribute – variables or constant declared within the class and can be access by all the methods of that class.
  2. Method – Determines the behavior of an object, it provide some functionality. A method can access all the attributes of their class.
  3. Events – A mechanism through which one method can raise method of another class.
  4. Interface – Independent structure which are used in a class to extend functionality of a class.
  5. Alias – A concept of providing alternate method name for interface method in an implemented class.


Component types of class

  1. Instance Component (instance attributes, instance methods & instance events) – These components can only be addressed by the instance(object) of that class only.
  2. Static Component (static attributes, static method & static events) – These components can be used independently of a class instance.


The three pillars of OOABAP (Advance elements of OOABAP):

  1. Encapsulation: It is a concept of preventing your data from being arbitrarily accessed by some other outside interference or protect your data from being misused. It Allows us to bind similar kind of data in one unit. It restricts the visibility of components of class.

There are 3 levels of visibility:

  1. Private – Components will be visible to that class only, where they are defined.
  2. Protected – Components will be visible to that class, where they are defined and to the inherited class.
  3. Public – Components with this visibility will be available to all.


  1. Polymorphism: A concept which allows to overwrite some functionality. That is, a same functionality of a class (i.e., method) can be reused in other classes with some enhancement in it.

‘Interface’ is a concept in object-oriented ABAP to achieve polymorphism. An interface is a place where a functionality(method) can be defined with some parameters, which later can have different implementations in different classes.

Advantage of polymorphism is that we don’t need to define a method for different scenarios of implementation. Same definition can be used for different implementations.


  1. Inheritance: A name itself explaining the concept, i.e., it allows a sub class or a child class to inherit the properties from a parent class. In OOABAP, only single and multilevel inheritance is allowed.

Single inheritance means only one parent class and its child class.

Multilevel Inheritance means a parent class can have a child class, it grandchild class and so on with the hierarchy.

The main advantage of inheritance is reusability of code functionality & fast implementation time.



Advantages of OOPS Concept in ABAP

  1. In OOABAP, programs are divided into objects leading to better and powerful data management.
  2. Provide properties like data hiding(encapsulation) & code reusability(inheritance) with more data security.
  3. Better performance with less consumption of time.
  4. Helps in future orientation.
  5. Simple and it much easier to maintain as compare to procedural ABAP programming.
  6. Relatively flexible & adaptable to changing business needs.
  7. Object Oriented programming languages include features such as “Class”, “Instance”, “Inheritance” and “Polymorphism” that increase the power and flexibility of an object.


  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.