Visual SAP with plantUML #5 Class Diagrams

A Class Diagram shows:
Objects (classes, interfaces)
Their attributes and methods
Relationships: inheritance, association, composition
In ABAP, it’s a way to visualize your Z-logic before you write it — or to explain it clearly during specs or reviews.
📌 When to Use Class Diagrams
Use Case | Why It Helps |
Designing ABAP classes | Clarifies design before you code |
Explaining object relationships | Shows structure at a glance |
Documenting custom Z-logic | Clean, readable specs |
CDS + OO hybrid logic | Show how objects consume views |
Handover to other developers | Transfer knowledge visually |
🧩 Class Diagram Notation in PlantUML
Element | Syntax Example | Meaning |
Class | class ZCL_HANDLER | ABAP class |
Interface | interface IF_ORDER_CHECK | ABAP interface |
Attribute | + MATNR : MATNR | Public field |
Method | + check_order( ) | Public method |
Inheritance | class A extends B | Classic inheritance |
Interface Implementation | class A implements B | Implements interface |
Composition | A *-- B | "Has-a" (class uses another) |
Association | A --> B | Reference or collaboration |
✅ Example: Simple Z-Logic Design
plantuml
CopyEdit
@startuml
title Class Diagram — ABAP Order Processing
class ZCL_ORDER_HANDLER {
+ process_order( )
- validate_items( )
}
class ZCL_ORDER_LOGGER {
+ log_event( )
}
interface IF_ORDER_CHECK {
+ check_validity( )
}
ZCL_ORDER_HANDLER --> ZCL_ORDER_LOGGER : uses
ZCL_ORDER_HANDLER ..|> IF_ORDER_CHECK : implements
@enduml
What this shows:
One main handler class
A logger utility used via association
An interface being implemented for reusability
⚙️ Advanced Example: With Attributes and Data Types
plantuml
CopyEdit
@startuml
title ABAP Class with Attributes
class ZCL_MATERIAL_HANDLER {
+ MATNR : MATNR
+ process_material( )
- fetch_data_from_db( )
}
@enduml
+
means publicmeans private
You can skip visibility if not relevant
🔧 Real-World Use
Let’s say you’re designing a small ABAP framework for handling material checks:
plantuml
CopyEdit
@startuml
title ABAP Class Framework — Material Checks
interface IF_CHECK {
+ execute( )
}
class ZCL_CHECK_MATERIAL implements IF_CHECK {
+ execute( )
- read_mara( )
}
class ZCL_CHECK_SITE implements IF_CHECK {
+ execute( )
- read_werks( )
}
class ZCL_CHECK_CONTROLLER {
+ run_all_checks( )
- results : string[]
}
ZCL_CHECK_CONTROLLER --> IF_CHECK : runs
@enduml
You now have:
Multiple reusable check classes
One controller that runs all checks
Interface-based architecture = extensible
This is what good ABAP architecture looks like before it’s built.
🧠 Pro Tips
✅ Use class diagrams for custom frameworks, exit logic, Z-modules, and enhancements
✅ Combine with activity/sequence diagrams to show how objects interact
✅ Use in specs to align before coding starts
✅ Use stereotypes like <<interface>>
or <<abstract>>
if needed
✅ Summary
Class diagrams let you draw your design before you build it.
They help you think in objects, not just forms and tables.
Use them to:
Design better logic
Explain structure fast
Reuse patterns
Avoid messy procedural Z-monoliths
Next up:
👉 Visual SAP #6 — Use Case Diagrams: Who Does What in Your SAP Projects
We’ll map roles, actions, and systems — to clarify responsibility and access in a single diagram.
Subscribe to my newsletter
Read articles from Dzmitryi Kharlanau directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Dzmitryi Kharlanau
Dzmitryi Kharlanau
SAP Logistics Consultant with 10+ years of experience in SAP SD, SAP MM, SAP LE, and SAP IS-Automotive. Skilled in SAP system support, integration, and process improvements. Achievements ✔️ Delivered custom logistics solutions, overseeing the entire process from concept to go-live. ✔️ Achieved SLA compliance in JIT environments, managing tasks from requirements to release independently. ✔️ Resolved complex issues swiftly, minimizing downtime and optimizing efficiency. Interests: Motivated to work with 🔧 S/4HANA SD, MM, BTP, and ABAP, taking responsibility for end-to-end solutions.