User Exits
ABAP Developmentintermediate

When to Migrate a User Exit to a BAdI

S/4HANA cleanup opportunities.

Explanation

During S/4HANA conversion, review every classic user exit. If a released BAdI exists (SE18 search + SAP Note 3021557 for SD), migrate. If not, wrap logic in a service class and continue via enhancement point. Keep an inventory of exits with owners and remove those no longer needed.

Code example

ABAP Code
CLASS zcl_order_check DEFINITION. PUBLIC SECTION.  METHODS check_before_save IMPORTING is_head TYPE vbak.ENDCLASS.FORM userexit_save_document_prepare.  zcl_order_check=>get_instance( )->check_before_save( vbak ).ENDFORM.

Real project scenario

Migrating 40 exits into service classes reduced SPAU work at S/4 conversion from weeks to days.

Common mistakes

Rewriting exits without regression tests; deleting exits that quietly enforce compliance.

Best practices

Refactor first, migrate second; always have unit tests before touching legacy code.

Interview angle

How do you document exit coverage before S/4 conversion?