Avoid COMMIT or ROLLBACK in BAdI Implementations
WarningAnti-Patterns & Bad Practices#EC NO_BADI_COMMITLocal Only
Overview
Avoid COMMIT or ROLLBACK in BAdI implementations.
ATC Finding Message:
Avoid COMMIT or ROLLBACK WORK inside BAdI implementations (breaks LUW integrity)
Rationale
Executing COMMIT WORK or ROLLBACK WORK inside a Business Add-In (BAdI) breaks the Logical Unit of Work (LUW) of the calling application. It prematurely commits or rolls back standard transactions, leading to severe database inconsistencies and SAP short dumps.
Standard: Let the standard transaction or orchestrating caller manage commit and rollback lifecycles.
Non-Compliant
abap
METHOD do_work.
" Anti-pattern: Breaks caller's transaction boundary
COMMIT WORK.
ENDMETHOD.Compliant
abap
METHOD do_work.
" Clean ABAP: Pure extension logic without transaction control
update_buffer( ).
ENDMETHOD.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_BADI_COMMIT
" SAP CI_ prefix format:
... "#EC CI_NO_BADI_COMMITRelated Rules
- Ensure Opened Datasets and Cursors are Closed —
#EC NO_UNCLOSED_RES - Avoid Variable Scope Leaking from Inner Blocks —
#EC NO_SCOPE_LEAK
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_BADI_COMMIT - Implementation File: zcl_skylint_no_badi_commit.clas.abap