A Practical Guide to User Exits, BADIs, and Enhancements in SAP

This document provides a comprehensive guide to SAP enhancement techniques, detailing methods for customizing standard SAP applications without modifying the original core code. Enhancements in SAP refer to mechanisms like Customer Exits, User Exits, Business Add-Ins (BADIs), and the Enhancement Framework, which allow developers to insert custom logic or add fields and functionalities at predefined points within standard SAP programs, ensuring these customizations are preserved during system upgrades. The document explains how to find, implement, and manage these different types of enhancements.

Key topics covered in the document are:

  1. Customer Exits: Customer Exits are SAP-provided hooks allowing modifications to standard program functionality. They are categorized into Function Module Exits (called via CALL CUSTOMER FUNCTION), Screen Exits (for adding fields to standard screens, often requiring Append Structures), and Menu Exits (for adding custom menu items). The document explains finding these exits using transaction codes SMOD (to view/activate) and CMOD (to group exits into projects and manage implementations), and details the implementation process which typically involves writing ABAP code within specific Z-includes provided within the exit’s function module.
  2. User Exits (FORM EXITS): User Exits are subroutines (FORM routines), often found in the SD module and typically starting with USEREXIT_, where customers can add their own ABAP code. The document describes methods for finding these exits, such as navigating through SPRO (SAP Project Reference Object) or searching program code. Implementation involves creating an include within the standard program and writing custom logic, ensuring proper handling to avoid system dumps if the include is missing.
  3. BADIs (Business Add-Ins): BADIs offer an object-oriented approach to SAP enhancements, providing interfaces that custom classes can implement. The document covers BADI types (e.g., Multi-Use, Filter-Dependent), the concept of Enhancement Spots for organizing BADI implementations, and various techniques for finding BADIs (e.g., debugging CL_EXITHANDLER, searching for GET BADI/CALL BADI, using SE84/SE15, or SE37). Implementation is done via transactions SE18 (BAdI Builder: Definitions), SE19 (BAdI Builder: Implementations), and SE20 (Enhancement Spots), where developers create an implementation class for the BAdI interface.
  4. Enhancements (Enhancement Framework): The Enhancement Framework provides flexible ways to modify standard SAP objects. The document details Explicit Enhancements (Enhancement Sections and Points, explicitly defined by SAP for custom code insertion), Implicit Enhancements (available at predefined locations like the start/end of routines or methods), and Enhancement Options (for modifying standard functions and classes, including adding parameters or implementing Pre-Exit, Post-Exit, or Overwrite-Exit methods for class methods). It explains how to locate these enhancement options within ABAP programs (e.g., via the “Enhance” spiral icon in SE80) and implement custom logic.
  5. Append Structures: Append Structures are used to add custom fields to standard SAP database tables or structures without direct modification. The document emphasizes first checking for Customer Includes (e.g., CI_...) provided by SAP, as these are preferred. It outlines the process of creating an Append Structure (typically prefixed with ZZ or YY), adding fields with appropriate naming conventions (e.g., ZZFIELDNAME), and activating it, along with cautions regarding modifications to already active append structures.
  6. Important Considerations for Implementations: This section provides crucial guidelines for developing custom code within Exits, BADIs, and Enhancements. It advises against using ABAP commands like RETURN or CHECK that might disrupt standard logic flow, and prohibits database operations like COMMIT WORK or ROLLBACK WORK, as these can interfere with the main SAP LUW (Logical Unit of Work).

Download – A Practical Guide to User Exits, BADIs, and Enhancements in SAP

Leave a Comment