ABAP Series Part- 4
In this blog, I will discuss What is Object Oriented in ABAP and its concepts.

In most of the language we came across Object Oriented Programming, But why do we use this? In OOPS generally we say class and objects are used before any other terms we used in OPPS concept.
We use objects to create our codebase, reduce complexity and maintain reusability of our code. Each object is unique at its own, meaning with unique identity and attributes. A Class in a blueprint of our objects. Also it defines the characteristics of an object.

But What is Actual Definition of Both?

  • Objects are nothing but instances of classes, each object has a unique identity and it`s own attributes.
  • A class is a user defined data type with attributes, methods, events, user-defined types, interfaces etc, for a particular entity or application .

Characteristics of Class

  • Attributes: The variables or class defined within in a class.
  • Methods: Determines the behavior of an object, which provides some functionality.
  • Events: A mechanism through which one method can raise method of another class.
  • Interface: Independent structure which are used in a class to extend functionality of a class.
  • Types of Attributes:
    1. Instance Attribute
    2. Static Attribute
  1. Instance Attribute
    These components exist separately in every instance of the class and are referred to using instance component selector [->].
  2. Static Attributes
    These components exist globally for a class and are referred to using static component selector [=>] .

There are 3 levels of visibility:

  1. Public: Code can be accessed by the class itself, by its subclasses as well as by other users outside the class.
  2. Protected: Code can be accessed by the class itself, and also by its subclasses but not by external users outside the class.
  3. Private: Code is defined in this section can be accessed only inside the class itself.

Types of Classes:
1. Local Class
2. Global Class

1.Local classes are defined in an ABAP program and can only be used in the program in which they are defined.

  • Transaction Code for creating a Local class is SE38.

2.Global classes are defined in the Class Builder in the ABAP Workbench.

  • Transaction Code for creating a Global class is SE24.

Attributes of Object Oriented Programming:

  1. Abstraction: It is a process where you show only relevant data and hide unnecessary details of an object from the user.
  2. Encapsulation
    Binding code and data together into a single unit are known as encapsulation.
  3. Inheritance
    The process by which one class acquires the properties and functionalities of another class is called inheritance.
    There are Single and Multiple type of Inheritance.
  4. Polymorphism
    It allows us to perform a single action in different ways.

Advantages of OOPS Concept in ABAP:

  • Reduction in code redundancy.
  • Provide properties like data encapsulation & code inheritance.

Why do we use this?


It means reusing some facilities rather than building it again and again. This is done with the use of a class. We can use it ’n’ number of times as per our need.


With the use of data hiding and abstraction mechanism, we are filtering out limited data to exposure which means we are maintaining security and providing necessary data to view.


In the article, I give an overview of the OOPS concept in SAP ABAP.

Thanks for reading.

If you Want to Connect with Me:

LinkedIn: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Thank you, stay safe, stay healthy.

Stay tuned till the next blog.

@sap @sapabap SAP Conversational AI SAP Store SAP TV