badi-enhancementlisted
Install: claude install-skill williamcorrea23/sap-router-skill
# BAdI and Enhancement Patterns
**Mental model:** A BAdI is an SAP-sanctioned extension contract — SAP defines
an interface at a specific call point; you implement the interface in a Z/Y
class. The SAP standard code calls your implementation via a dispatcher.
No standard code is modified. Upgrades preserve your logic because the contract
(interface) is stable.
## Prerequisites
- SAP system access (DEV client with developer key / S/4HANA Cloud ABAP)
- Transaction SE18 (BAdI definition) and SE19 (BAdI implementation)
- Object name in customer namespace (Z* or Y*)
- Transport request assigned (SE09/SE10)
- For new Kernel BAdI: ABAP ≥ 7.0 (GET BADI statement)
- For new BAdI syntax: ABAP ≥ 7.40 (BADI name directly in code)
- ADT/Eclipse recommended for class-based implementation
## BAdI Type Selection
- **Classic BAdI** (≤ 7.0): Uses `CL_EXITHANDLER=>GET_INSTANCE`. Deprecated — avoid for new development.
- **Kernel BAdI** (≥ 7.0): Uses `GET BADI` statement. Filter support, multiple-use.
- **New BAdI** (≥ 7.40): Direct `BADI_NAME` reference. Best: type-safe, filter UI, fallback class.
> **Rule:** Always prefer New/Kernel BAdI. Only touch classic BAdI when enhancing existing SAP code that already calls `CL_EXITHANDLER`.
## Step 1 — Find the Right BAdI
```abap
" Search BAdI definitions by keyword (SE18 or SQL)
SELECT name, descript FROM badi
WHERE name LIKE '%MATERIAL%'
INTO TABLE @DATA(lt_badis).
" Check existing implementations
SELECT badi_name, impl_name FROM badi_imp