Most of the OOP ABAP interview question lists are available online and resemble a syntax dictionary that defines a class, defines an interface, and continues. It’s not what takes place in an interview room. To answer these questions, you must be able to describe why you would choose composition over inheritance or why a singleton would be different in an S/4HANA ABAP Cloud context than in classic ECC. If you’re preparing for OOP ABAP interview questions, you’ve probably noticed a pattern: interviewers don’t want you to recite definitions; they want you to prove you can build.
Junior candidates go wrong on definitions. It’s experienced candidates who stumble on the follow-up, “Show me”, not “tell me”. When an interviewer hears a textbook definition, he or she will nearly always require you to write the definition; this is why most candidates get stuck when they hear the answer, having memorized it but not run it.
How This List Is Organized
Each level below represents what interviewers will ask at that experience level and not simply the difficulty of the topic. The basic questions are based on ability to read and write a class. Intermediate and advanced questions involve reasoning about design tradeoffs and about the behavior of S/4HANA.
Basic OOP ABAP Interview Questions
Every list of OOP ABAP interview questions starts here with core concepts like classes, objects, and encapsulation
1. Object Oriented Programming (OOP) in ABAP?
In ABAP, OOP represents a program as a collection of objects, which contain both data (attributes) and behaviour (methods), rather than as a set of data structures and a set of routines. Features a class-based, object-oriented approach to the replacement of the older procedural style of FORM/PERFORM, inheritance, and polymorphism.
2. What is meant by local class in ABAP?
Implement CLASS … DEFINITION with sections for visibility, then implement individually:
CLASS lcl_employee DEFINITION.
PUBLIC SECTION.
METHODS: display_name.
PRIVATE SECTION.
mv_name is a string data type.
ENDCLASS.
CLASS lcl_employee IMPLEMENTATION.
METHOD display_name.
Reads the private attribute and writes it out
WRITE: / mv_name.
ENDMETHOD.
ENDCLASS.
3. How many parts are there in the class that a student can see?
PUBLIC SECTION: anyone can call; PROTECTED SECTION: Anyone can call within the class & subclasses. PRIVATE SECTION only those inside the class themselves can call. ABAP enforces encapsulation in this way.
4. What is the difference between class and object?
A class is a blueprint, a type definition, attributes, and methods. Objects are instances of those classes in memory created by CREATE OBJECT or the NEW operator, with their own copy of the instance attributes.
5. What is encapsulation and why is it important? Encapsulation makes an object’s internal state inaccessible to its callers thereby preventing them from altering the data directly, or making assumptions about its internal structure. This allows for updating internal logic without breaking all callers.
6. Inheritance is what? To inherit from a superclass, subclass is implemented by using INHERITING FROM, which reuses part of the logic and possibly overrides some of the methods. Single inheritance: ABAP Objects only supports a single superclass for a class.
7. Polymorphism and its difference from overloading. The concept of polymorphism enables different classes to act differently when they are passed the same method name, usually via an interface or superclass reference. ABAP does not provide method overloading (same name, different parameters) — polymorphism in ABAP is by redefinition and interfaces.
8. A constructor is a method that is automatically called when an instance of a class is created.
All other methods are called after the instance constructor, and the instance constructor is called automatically every time an instance of the class is created using the CREATE OBJECT or NEW statement. Use it to set up mandatory attributes or validate required input parameters.
9. What are the difference between an instance constructor and static constructor (CLASS_CONSTRUCTOR)?
The instance constructor is called exactly once when an object is created, and can accept importing parameters. The static constructor is called automatically, once and only once per class per internal session without any arguments and is used for initializing static (class-level) data.
10. What is a local class vs. a global class?
Local classes are only defined within the program in which they are created (in the ABAP Editor or ABAP Development) and are not “global.” Global classes are built with SE24/Class Builder or ADT, saved in the class pool, and can be used throughout the system.
Intermediate OOP ABAP Interview Questions
11. What is the difference between CREATE OBJECT and NEW operator?
Both create an object, but NEW (from ABAP 7.40) is an inline constructor expression, which allows you to create and instantiate an object in one statement without using a DATA line.
” Old way
In this case, the field DATA lo_emp is type REF of a type lcl_employee.
CREATE OBJECT lo_emp.
Instantiates an inline “declares” statement.”7.40+ way — declares/instantiates”
DATA(lo_emp_new) = NEW lcl_employee( ).
If you are using an ECC system with a value less than 7.40, you cannot use NEW, because it is not supported.
12. What is an interface and how it differs from an abstract class?
A class implements an interface by adding INTERFACES to it and adding every method to it, while an interface just specifies method signatures, and has no attributes of its own and no implementation. An abstract class (ABSTRACT keyword) may contain both implemented and unimplemented (ABSTRACT METHODS) code and may contain state — you cannot create an instance of it, but subclasses do include the concrete code.
13. Is it possible to have more than one interface implemented by a class?
Yes this is how ABAP Objects achieves a form of multiple inheritance, since a class can extend only one superclass but implement any number of interfaces.
14. What is meant by method redefinition?
REDEFINITION – Overrides an inherited public/protected method with a new implementation in the same method list with the same signature. Static methods, private methods and attributes cannot be redefined.
15. On a class or method, what is the meaning of FINAL?
It is not possible to inherit a FINAL class, or to redefine a FINAL method in any subclass. Apply it in cases where the design is not supposed to be extended further, such as a utility class that does not have any variants.
16. A singleton class is a class whose constructor can only be called once.
A singleton class is a class that has only one constructor. A Singleton restricts the number of instances of a class to one instance per session and is normally used for things shared among the instances such as a logger, connection handler, or a cache. It’s been a pattern that SAP Community threads consistently point to for real-world scenarios: logging and shared state.
CLASS zcl_logger DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS get_instance
RETURNING VALUE(ro_instance) TYPE REF TO zcl_logger.
PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF OF zcl_logger.
ENDCLASS.
CLASS zcl_logger IMPLEMENTATION.
METHOD get_instance.
> Only creates the object the first time it is called for.
If the instance is not bound.
go_instance = NEW zcl_logger( ).
ENDIF.
ro_instance = go_instance.
ENDMETHOD.
ENDCLASS.
Make private create objects – all calls must go through get_instance.
17. What is meant by “casting,” and what is the difference between narrowing and widening casts? Widening (up-cast): An automatic widening of an object reference in a runtime polymorphic manner from a specific type to a more general type, such as a superclass or interface reference. Narrowing (down-cast) is a general operation that is made more specific by adding an explicit CAST operator or the ?= operator, and may throw an exception at runtime if the object is not of that specific type.
18. A class exception is what? How do you make it?
Class-based exception extensions of CX_STATIC_CHECK, CX_DYNAMIC_CHECK or CX_NO_CHECK. They change the old MESSAGE … RAISING model to a structured, inherited error object model.
TRY.
Raised when the input value is invalid.Raised if the input value is invalid.
EXPORTING textid = zcx_invalid_input=>empty_field.
If the input is invalid, then send it back into DATA(lx_error).
” Get the structured error in the form of lx_error->get_text( )
WRITE: / lx_error->get_text( ).
ENDTRY.
19. ABAP Objects have what kind of events?
An event is a declared signal (EVENTS) that may be raised by a class using the RAISE EVENT command, and that any object that is registered to handle the event responds to by executing a method whose FOR EVENT is included. This separates the originating object from the objects that react to the originating object.
20. What is a friend class?
Access to the protected and private members of a class is given to another class or interface through a FRIENDS declaration without making them visible. Use it sparingly, that is, only in tightly coupled helper classes, as it is not a good practice to increase coupling.
21. Is it possible to create an object of an interface directly?
No — CREATE OBJECT against an interface type is not allowed because an interface does not have an implementation. If necessary, the implementing class is always used, regardless of whether the implementing class is instantiated or not.
22. What is the difference between static and instance components?
A static (CLASS-DATA, CLASS-METHODS) component is part of the class, and is shared by all instances and all subclasses. Each instance (DATA, METHODS) component is independent of each other object.
Advanced OOP ABAP Interview questions
These OOP ABAP interview questions are the ones senior interviewers use to separate candidates who’ve memorized syntax from those who’ve actually designed systems.
23. What is the difference between S/4 HANA and OOP ABAP and ECC?
Based upon this classic ABAP Objects model, S/4HANA extends OOP design by introducing RAP (RESTful ABAP Programming Model), CDS (Content Delivery Services)-based business objects, and pushed-down logic via AMDP (ABAP Modular Programming Model). ECC code still heavily uses old-style BAdIs and function-module wrappers for OOP logic.
In R/3, the model was extensive and required extensive development and testing. In R/3, the model was large and needed extensive development and test.
24. What is an AMDP class and why is it important for an OOP interview?
A class that implements the IF_AMDP_MARKER_HDB interface is called AMDP (ABAP Managed Database Procedure), which pushes the SQLScript logic to the HANA database instead of the application server. People ask candidates about this, to determine if they know where the OOP structure and code-to-data performance design intersect.
CLASS zcl_amdp_example DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
CLASS-METHODS get_high_value_orders
The upper threshold for imported data.The maximum value of iv_threshold TYPE p
The et_orders TYPE STANDARD TABLE should be exported.
ENDCLASS.
25. What’s the difference between RAISING and EXPORTING an exception object?
RAISING in a method signature specifies which exceptions can be thrown from that method, resulting in them being caught by the caller and possibly re-thrown. There is no way of exporting an exception — you raise it using RAISE EXCEPTION, and catch it using TRY/CATCH, possibly reading the exported attributes from an exception object.
26. What is the Factory pattern and how do you use it in ABAP?
A static factory method determines which concrete subclass to create and returns a reference to an intermediary type (a common interface or superclass) that masks the identity of the actual subclass created.
CLASS zcl_payment_factory DEFINITION.
PUBLIC SECTION.
CLASS-METHODS create_handler
The following is an example of importing a string of type iv_type.
A return type that references a zif_payment_handler object.
ENDCLASS.
CLASS zcl_payment_factory IMPLEMENTATION.
METHOD create_handler.
CASE iv_type.
WHEN ‘CARD’.
ro_handler = NEW zcl_card_payment( ).
WHEN ‘WIRE’.
ro_handler = NEW zcl_wire_payment( ).
ENDCASE.
ENDMETHOD.
ENDCLASS.
27. Compare the difference between composition and inheritance, and when you choose one over the other.
Inheritance represents an “is-a” relationship and delegates behaviours through a class hierarchy, whereas composition means that a class owns another class and delegates behaviours to it, using a “has-a” relationship. Use composition to compose the behaviour that needs to change at runtime, or to prevent unrelated subclasses from having to share logic that they don’t need when a strict hierarchy would otherwise be required.
28. Can you implement multiple inheritance with ABAP objects?
Not by classes — a class is one and only one superclass. Interfaces are used to achieve multiple inheritance through the ability to implement multiple interfaces simultaneously.
30. What is a persistent class, and when is it used?
A persistent class, generated from the Class Builder on a database table, maps instances of the class directly to the rows in the database via a generated persistence layer. It is not in common use today during the modern development of S/4HANA,, as CDS-based access and RAP have taken its place.
Errors That Cost Candidates the Job
One pattern shows up again and again in OOP ABAP interview questions: candidates reciting definitions instead of writing actual code. That’s exactly why interviewers ask you to program a singleton or a factory on the spot — it’s the fastest way to expose someone who knows the theory but has never built with it.
The next red flag in OOP ABAP interview questions is the combination of “ABAP doesn’t support multiple interfaces” and “ABAP doesn’t support multiple inheritance.” Saying both in the same breath tells the interviewer you haven’t actually implemented interfaces in a real project; the two statements aren’t even about the same concept, and conflating them is an instant tell. Once you’re comfortable with classes and interfaces, see how these same OOP principles power modern SAP development in our ABAP S/4HANA interview questions guide.
A third mistake surfaces in OOP ABAP interview questions focused on S/4HANA: talking about persistent classes as if objects simply “don’t go away,” without mentioning CDS views or the RAP (RESTful ABAP Programming) model. On S/4HANA, that’s the keyword pairing interviewers listen for when discussing data-backed objects skipping it signals you haven’t worked with modern persistence patterns.
Conclusion
These 35 OOP ABAP interview questions cover everything from class fundamentals to production-grade design decisions the same judgment senior SAP interviewers test for. Interviewers are looking to see if you can convert ideas like encapsulation, inheritance, polymorphism, interfaces, exceptions, factories, and singletons to working ABAP code. They would also like to know if you can explain why one design is more appropriate than the other in a real project.
The most important advice is to solve questions sequentially and write the code yourself. Work with classes; use interfaces; redefine methods; deal with exceptions; work with dependency injection; use common design patterns. In your answer, describe the requirement, the design decision, the design alternative that was rejected, and the impact on maintainability, testing, and changes to the design.
In case of experience-based positions, link classic ABAP Objects knowledge with today’s development practices of the SAP S/4HANA, including RAP, CDS-based business objects, ABAP Unit, and AMDP. This will help you get ready for the first question of the interview, ‘What does it mean to you?’ as well as the far more significant second question: ‘Why would you design it that way, and can you construct it?’.
Frequently Asked Questions
1. What is the purpose of a singleton class in a real ABAP project?
The actual reason that most developers on SAP Community quote for a singleton is the concept of shared resources: loggers, DB connection handlers, and cache objects. The Singleton pattern deep dive provides details on implementing the Singleton pattern in ABAP objects.
2. How to create a singleton?
Create PRIVATE on the class definition and a static get_instance method, which will only create the object if a static reference variable to it hasn’t been bound yet before returning that reference on a following call.
4. What is the practical difference between the CREATE OBJECT and interface-based instantiation?
CREATE OBJECT (or NEW) always works with a concrete class; however, you can only create a reference to an object of an interface after defining the implementing class.
5. What are OOP ABAP interview questions for experienced candidates likely to focus on? Interviews at the experienced level move from definitions to design tradeoffs, composition vs inheritance, exception hierarchy design, and patterns of the S/4HANA era, such as RAP and AMDP, and not only syntax recall.