Review the design choices, not just the syntax
Object-oriented programming is more than adding CLASS statements. The useful question is how to divide responsibility so that each caller has a clear contract and each object protects its own rules.
A few principles to carry forward
- Use a local class for a helper that belongs to one program; use a global class when repository-wide reuse is intentional.
- Keep object-specific state on instances and protect invariants through methods.
- Use interfaces for capabilities, composition for collaborators, and inheritance for substitutable specializations.
- Reach for exceptions to make failure explicit; catch only where meaningful recovery or reporting is possible.
- Add ABAP Unit tests for observable behavior, with fakes or test doubles around replaceable collaborators.
Patterns such as Factory and Singleton are tools, not checkboxes. A Factory can hide a nontrivial construction choice. A Singleton can centralize a shared instance but risks hidden global state and poor test isolation. Prefer a simple injected instance unless shared identity is truly required.
Try the quiz
The questions below are original. They review independently authored examples and design tradeoffs; they are not copied from a course assessment. The browser quiz does not run ABAP.
Sources and scope
This learning path is an original, bounded introduction to commonly used ABAP Objects concepts, not an exhaustive reference to every ABAP OO feature. Check your system’s release and language version before applying syntax or APIs.
- SAP Samples, ABAP Object Orientation
- SAP Samples, ABAP Unit Tests
- SAP Help Portal, ABAP Objects overview
Developer practice · ABAP
Practice: ABAP Objects knowledge check
Choose one answer per question. These independent review questions reinforce the OO techniques and tradeoffs in this path.
Choose one answer for each question.