Want to perform well in your upcoming OOPs ABAP interview? Object-Oriented Programming (OOP) in ABAP is an important skill for SAP developers, and interviewers often test both fundamental and advanced concepts. To help you prepare, we’ve compiled the top 20 OOPs ABAP interview questions and answers. This guide will refresh your knowledge and make sure you’re ready to tackle key topics.
Let’s get to the questions!
Fun Fact: SAP ABAP Developer salaries in India range from ₹2.4 Lakhs to ₹12.3 Lakhs for 1 to 5 years of experience.
Basic OOPs ABAP Interview Questions
Here are some basic SAP ABAP OOPs interview questions and answers:
- What is Object-Oriented Programming (OOP) in ABAP?
OOP in ABAP is a programming paradigm that uses “objects”—data structures encapsulating data and behaviour—to design applications. This approach promotes modularity, reusability, and maintainability by organizing code into classes and objects that model real-world entities.
- How do you define a class in ABAP?
This is one of the most common SAP Object Oriented Programming interview questions.
In ABAP, a class is defined using the CLASS keyword, followed by the class name and the DEFINITION keyword. The class can have public, protected, and private sections to declare attributes, methods, and events.
For example:
CLASS lcl_example DEFINITION.
PUBLIC SECTION.
METHODS: display.
PRIVATE SECTION.
DATA: text TYPE string.
ENDCLASS.
- What are the visibility sections in an ABAP class?
ABAP classes have three visibility sections:
- Public: Accessible by all users and other classes.
- Protected: Accessible within the class itself and its subclasses.
- Private: Accessible only within the class itself.
These sections control the scope and accessibility of class components.
- Can you explain the concept of inheritance in ABAP Objects?
Inheritance in ABAP Objects allows a class (subclass) to inherit properties and methods from another class (superclass). This promotes code reusability and establishes a hierarchical relationship between classes. The subclass can also override or extend the functionality of the superclass methods.
OOPs Interview Questions in SAP ABAP for Freshers
Here is a list of common SAP ABAP OOPs interview questions and answers for freshers:
- What is the difference between a class and an object in ABAP?
A class is a blueprint that defines attributes and methods common to all objects of that type. An object is an instance of a class, representing a specific entity with actual values for the attributes defined by the class.
- How is polymorphism implemented in ABAP?
Polymorphism in ABAP is achieved through:
- Method Overriding: A subclass provides a specific implementation of a method already defined in its superclass.
- Interfaces: Different classes implement the same interface methods, allowing them to be used interchangeably based on the interface reference.
- What is an interface in ABAP, and how is it different from a class?
An interface in ABAP is a collection of method signatures without implementations. Classes that implement the interface must provide concrete implementations for these methods. Unlike classes, interfaces cannot hold data or provide method implementations.
- Can you explain the concept of method overloading in ABAP?
Method overloading in ABAP refers to defining multiple methods with the same name but different parameters (number, type, or sequence) within the same class. However, ABAP does not support method overloading in the traditional sense; instead, developers use optional parameters or different method names to achieve similar functionality.
Also Read - Top 25 SAP Interview Questions and Answers
SAP OOPs ABAP Interview Questions for Experienced
Let’s go through some important ABAP OOPs interview questions and answers for experienced candidates:
- How do you implement polymorphism using interfaces in ABAP?
In ABAP, polymorphism is implemented using interfaces by defining a common interface with method signatures and having multiple classes implement this interface. Objects of these classes can be handled through interface references, allowing dynamic method binding at runtime.
- What is the significance of abstract classes in ABAP?
Abstract classes in ABAP serve as templates for other classes. They can contain both implemented methods and abstract methods (without implementation). Abstract classes cannot be instantiated directly; instead, subclasses must provide implementations for the abstract methods.
- How do you handle exceptions in OOPs ABAP?
Exceptions in OOPs ABAP are handled using:
- Class-Based Exceptions: Defining exception classes that inherit from CX_ROOT and using RAISE EXCEPTION to trigger them.
- TRY…ENDTRY Blocks: Encapsulating code that might raise exceptions within these blocks and using CATCH to handle specific exceptions.
- Can you explain the concept of events in ABAP Objects?
Events in ABAP Objects allow a class to trigger actions that other classes can respond to. A class defines an event, and other classes can register to handle this event by implementing handler methods. This mechanism supports a publish-subscribe pattern, promoting loose coupling between classes.
Advanced SAP OO ABAP Interview Questions
These are advanced OOPs ABAP interview questions and answers:
- What are singleton classes in ABAP, and how are they implemented?
A singleton class in ABAP ensures that only one instance of the class exists during the runtime of an application. This is implemented by:
- Declaring the class constructor as private or protected.
- Providing a static method that checks if an instance exists and creates one if it doesn’t, returning the instance reference.
This pattern is useful when a single point of access to a resource or service is required.
- How do you achieve multiple inheritance in ABAP?
ABAP does not support multiple inheritance directly through classes. However, multiple inheritance can be achieved using interfaces. A class can implement multiple interfaces, thereby inheriting the method signatures from all the interfaces.
Also Read - Top 25+ Python OOPs Interview Question (2025)
Tricky OOPs ABAP Interview Questions in SAP ABAP
Here are some tricky OOPs in SAP ABAP interview questions and answers:
- Can you instantiate an interface in ABAP?
No, an interface cannot be instantiated directly because it does not contain implementations for its methods. Instead, a class implementing the interface must be instantiated, and an interface reference can be used to call its methods.
- What happens if a class implements an interface but does not provide implementations for all its methods?
If a class implements an interface but does not provide implementations for all the methods defined in the interface, it results in a syntax error. All methods of an interface must be implemented by the class that adopts it.
Also Read - Top 20 PHP OOPs Interview Questions and Answers
OOPs ABAP Real Time Interview Questions
Here are some real-time OOPs SAP ABAP interview questions and answers:
- How would you design a global class to handle database operations in ABAP?
To design a global class for database operations:
- Define a class in SE24 or as a local class.
- Use methods for CRUD (Create, Read, Update, Delete) operations.
- Implement generic select methods with input parameters for table names and conditions.
- Use exception handling to manage database errors effectively.
Example:
CLASS lcl_db_handler DEFINITION.
PUBLIC SECTION.
METHODS: get_data IMPORTING iv_table TYPE string
RETURNING VALUE(rt_data) TYPE STANDARD TABLE.
ENDCLASS.
- Can you describe a scenario where you used inheritance to simplify code in an ABAP project?
“In one of my projects, we had multiple reports that required different data-fetching logic but shared a common output structure. Instead of duplicating code, I created a base class with generic methods for ALV display and a subclass for each report that handled specific data retrieval. This approach reduced redundancy and made the code easier to maintain.”
Also Read - Top 30+ C# OOPs Interview Questions and Answers
Oops ALV Interview Questions
You might also come across interview questions on OOPs ALV in SAP ABAP like these:
- How do you implement an Object-Oriented ALV report in ABAP?
Implementing an ALV report using OOPs approach involves:
- Using CL_SALV_TABLE for ALV handling.
- Defining a global/local class with a method to fetch data.
- Calling ALV display methods to format and output the data.
Example:
DATA: lo_alv TYPE REF TO cl_salv_table.
cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv
CHANGING t_table = lt_data ).
lo_alv->display( ).
- What are the advantages of using the CL_SALV_TABLE class for ALV reports?
- Reduces coding effort by providing built-in functions for sorting, filtering, and column adjustments.
- Improves maintainability as layout settings and display logic are encapsulated in a class.
- Encourages reuse across multiple reports by using common ALV handling methods.
Also Read - Top 20 C++ OOPs Interview Questions and Answers
Wrapping Up
These 20 OOPs ABAP interview questions and answers cover essential concepts, from basics to advanced topics, helping you prepare effectively. Understanding these will boost your confidence in SAP ABAP interviews. Looking for top OOPs ABAP jobs in India? Hirist is a dedicated job portal for tech professionals, making it easy to find the right opportunities. Start your job search now!