When standard SAP does not cover a business rule, the first question is: should you use an SAP BAdI, a user exit or an enhancement? The choice directly determines maintenance cost, upgrade risk and how hard the move to S/4HANA will be.
First question: is code really needed?
Every extension is future maintenance. So the first step is to check whether the requirement can be solved through configuration: a new condition type, a copy requirement, an output condition or a workflow often need no code at all. Code should only come in when the rule is truly company-specific and cannot be expressed in configuration.
Types of extension
- User exits (form routines): especially in SD, code is added to subroutines SAP left empty (for example the routine called before an order is saved). Powerful, but technically a modification; it needs an access key and care during upgrades.
- Customer exits: function-module-based exits activated per project. Classic but still common.
- Classic BAdIs: object-oriented interfaces supporting multiple implementations and filters. Not a modification.
- New BAdIs (enhancement spots): kernel-integrated, faster and easier to manage. This should be the first choice today.
- Implicit / explicit enhancements: code inserted at specific points of standard code. Flexible, but a maintenance nightmare if the insertion points are not well documented.
Which one when?
- If a suitable BAdI exists: BAdI. Clear interface, lowest upgrade risk.
- If there is no BAdI but a relevant SD user exit: user exit, with short, well-documented code.
- If neither exists: enhancement, as a last resort with a narrow scope.
- Changing a standard object directly (modification) only when there is no other way, and always recorded.
What a good extension looks like
- Thin code: the exit only calls a class method; the business logic lives in a separate, testable class.
- An on/off switch: the rule can be activated per company code or sales organisation through a settings table.
- Performance: no database reads inside loops; code that costs seconds on every order save hurts users every day.
- Documentation: which business need it serves, who requested it and how it was tested are written down.
S/4HANA and the clean core
SAP's current approach is to keep the core clean: released interfaces instead of modifications, and side-by-side extensions where possible. In S/4HANA Cloud, key-user extensibility and developer extensibility (ABAP Cloud) are part of this approach. Classic methods still work on-premise, but during an S/4HANA migration every piece of custom code should be questioned. In migrations, the share of unused custom code is usually higher than expected.
Extension is an engineering decision, not a habit. In SAP SD consulting and ABAP development, thinking standard first, BAdI second and enhancement last keeps a system healthy for years.