ABAPintermediate
Object-Oriented ABAP (OO ABAP)
Classes, interfaces, inheritance, and polymorphism as implemented in the ABAP Objects paradigm.
SAP has pushed OO ABAP as the standard programming model since ABAP Objects was introduced, and virtually all modern frameworks - RAP, ALV Object Model, BOPF, even most new BAdIs - are class-based. Interviewers ask about OO ABAP to see if a candidate can design maintainable, testable code rather than long procedural programs full of global variables and PERFORM calls.
A class is a blueprint for a house; an interface is a building code contract (must have working plumbing) that any house design can promise to follow regardless of its actual blueprint.
Key Concepts
1
The fundamentals mirror any OO language: CLASS ... DEFINITION / IMPLEMENTATION, public/protected/private sections, constructors, and instance versus static (CLASS-DATA, CLASS-METHODS) members. Interfaces (INTERFACE ... ENDINTERFACE) define a contract that classes implement, enabling polymorphism - a topic worth demonstrating with a concrete example like different payment or output strategies implementing a common interface.
CLASS ... DEFINITIONIMPLEMENTATIONCLASS-DATACLASS-METHODSINTERFACE ... ENDINTERFACE
2
Inheritance in ABAP is single inheritance only; multiple behavior composition is achieved through interfaces instead, similar to Java. Candidates should be comfortable explaining method redefinition (REDEFINITION), abstract classes and methods, and the special me-> self-reference. Exception handling in OO ABAP uses class-based exceptions (CX_ROOT hierarchy) with TRY/CATCH/CLEANUP, replacing the old SY-SUBRC style error checking for new code.
REDEFINITIONme->CX_ROOTTRYCATCH
3
A senior-level discussion point is local classes for unit testing (FOR TESTING) using ABAP Unit, and dependency injection patterns via interfaces to make classes testable in isolation - a strong signal of engineering maturity beyond basic syntax knowledge.
FOR TESTING