- BADI Definition or Implementation
- BADI's Type
- BADI's Scenario
- Identify Standard BADI's
- Steps to implement BADI
- Identify the all implementations of BADI
- User Exits and types of User Exits
- Steps to Implement User Exits
- Best Practices of Using User Exits
- User Exits vs BADI's and when to use which?
- Real-world Example of user exits in SAP SD/MM/PP
- Enhancing Standard SAP Functionality with user exits
- Customer Exits and its types
- Identifying Customer exits
- Implementing Customer Exits
- Best practices for using customer exits
- Practical Example
- Troubleshooting common issues
- Comparing Customer exits with other Enhancement Techniques
- Real-Time Case Studies
- Enhancement Framework and its Types
- Enhancement Apportunities
- Implement Explicit Enhancements
- Working with Implicit Enhancements
- Understanding and Implementing BADIs in ABAP
- Enhancement spot and Enhancement implementation
- Tools of Enhancement Framework and Transactions
- Advance topics in the Enhancement framework
- Case Studies and real-life examples
- Introduction Enhancement Spot and Types
- Ways to Finding Enhancement Spots
- Creating an Explicit Enhancement Spot
- Implementing Enhancements using Enhancement Spot
- Managing enhancement implementations
- Advance topics in Enhancement Spots
- Best Practices for using Enhancement Spot
24ENHANCEMENT0410 – Practical Example
1. Sales Order Validation in SAP SD (Sales and Distribution)
- Scenario:
A company wants to validate that the customer’s credit limit is not exceeded when creating a sales order (VA01). If the limit is exceeded, the sales order should not be created, and the system should throw an error message. - Customer Exit:
USEREXIT_SAVE_DOCUMENT_PREPARE in the program SAPMV45A. - Solution:
In this customer exit, you can insert custom ABAP code to perform a credit check before saving the sales order. If the credit limit is exceeded, the system displays an error message, preventing the sales order from being saved.
IF customer_credit_exceeded = ‘X’.
MESSAGE E001(ZCUSTOM) WITH ‘Credit limit exceeded for this customer’.
ENDIF.
2. Material Validation in SAP MM (Materials Management)
- Scenario:
A company wants to ensure that only authorized users can create or change certain materials in the material master (MM01/MM02). Unauthorized users should be blocked from making changes to sensitive materials. - Customer Exit:
EXIT_SAPLMGMU_001 in the program SAPLMGMU. - Solution:
In this exit, you can add logic to check the user’s authorization before allowing them to create or modify a material. If the user lacks the proper authorization, an error message is displayed.
IF NOT user_authorized_for_material( sy-uname ).
MESSAGE E001(ZCUSTOM) WITH ‘You are not authorized to change this material’.
EXIT.
ENDIF.
3. Automatic Delivery Date Calculation in SAP SD
- Scenario:
A logistics company needs to automatically calculate and populate the delivery date in the sales order based on the lead time and customer location when creating sales orders (VA01). - Customer Exit:
USEREXIT_MOVE_FIELD_TO_VBEP in the program SAPMV45A. - Solution:
In this exit, you can insert custom logic to calculate the delivery date based on the lead time and customer location. Once the calculation is done, the system automatically updates the delivery date field.
lv_lead_time = get_lead_time_for_customer( vbkd-kunnr ).
lv_delivery_date = sy-datum + lv_lead_time.
vbep-edatu = lv_delivery_date.
4. Default Shipping Instructions in SAP SD
- Scenario:
A company wants to default specific shipping instructions for certain customers when creating a delivery document (VL01N). These instructions should be automatically populated when creating the delivery. - Customer Exit:
USEREXIT_MOVE_FIELD_TO_LIKP in the program SAPMV50A. - Solution:
You can implement logic to automatically populate the shipping instructions field in the delivery document based on the customer.
IF likp-kunnr = ‘100000’.
likp-trspg = ‘EXPEDITED’.
ENDIF.
5. Enhancing the Billing Process in SAP SD
- Scenario:
A company needs to perform custom calculations for taxes during the billing process (VF01). The tax calculation should be adjusted based on customer-specific rules. - Customer Exit:
USEREXIT_ACCOUNT_PREP_KOMKCV in the program SAPLV60A. - Solution:
In this exit, you can enhance the tax calculation logic by inserting customer-specific tax rules before the billing document is posted.
IF komk-kunnr = ‘100200’ AND komk-land1 = ‘US’.
komk-mwskz = ‘A0’. “Custom tax code for specific customers in the US
ENDIF.
6. Purchase Order Custom Approval in SAP MM
- Scenario:
A company requires an additional approval step for purchase orders over a certain value (ME21N). If the purchase order value exceeds a predefined limit, it must be flagged for additional approval. - Customer Exit:
EXIT_SAPMM06E_012 in the program SAPMM06E. - Solution:
In this exit, you can add a custom check on the purchase order value. If the value exceeds the limit, the purchase order is flagged for additional approval.
IF ekko-netwr > 10000. “PO value limit
ekko-frggr = ‘Z1’. “Custom release strategy for high-value POs
ENDIF.
7. Customer-specific Pricing in SAP SD
- Scenario:
A company offers special discounts to certain customers when they order specific materials. This discount should be applied automatically during sales order creation (VA01). - Customer Exit:
USEREXIT_PRICING_PREPARE_TKOMK in the program SAPMV45A. - Solution:
In this exit, you can apply custom pricing rules that automatically adjust the pricing conditions for certain customers and materials.
IF komk-kunnr = ‘500123’ AND komp-matnr = ‘MATERIAL_A’.
komp-kbetr = komp-kbetr * 0.9. “10% discount for this customer and material
ENDIF.
8. Default Plant in SAP MM for Purchase Requisitions
- Scenario:
A company wants to default the plant field for certain users when creating purchase requisitions (ME51N) based on the user’s department or location. - Customer Exit:
EXIT_SAPLMEREQ_001 in the program SAPLMEREQ. - Solution:
In this exit, you can implement logic to automatically fill in the plant field based on the user’s department.
IF sy-uname = ‘USER1’.
c_werks = ‘PLANT_A’. “Default plant for this user
ENDIF.
Customer Exits allow businesses to customize SAP’s standard behavior in a way that is non-intrusive and upgrade-safe. They are ideal for implementing specific business logic, validations, and field updates without modifying SAP standard code, making them an effective solution for adding flexibility while maintaining system integrity.
Author : Aniket Pawar, 9373518385
24ENHANCEMENT0410 – Practical Example
1. Sales Order Validation in SAP SD (Sales and Distribution)
- Scenario:
A company wants to validate that the customer’s credit limit is not exceeded when creating a sales order (VA01). If the limit is exceeded, the sales order should not be created, and the system should throw an error message. - Customer Exit:
USEREXIT_SAVE_DOCUMENT_PREPARE in the program SAPMV45A. - Solution:
In this customer exit, you can insert custom ABAP code to perform a credit check before saving the sales order. If the credit limit is exceeded, the system displays an error message, preventing the sales order from being saved.
IF customer_credit_exceeded = ‘X’.
MESSAGE E001(ZCUSTOM) WITH ‘Credit limit exceeded for this customer’.
ENDIF.
2. Material Validation in SAP MM (Materials Management)
- Scenario:
A company wants to ensure that only authorized users can create or change certain materials in the material master (MM01/MM02). Unauthorized users should be blocked from making changes to sensitive materials. - Customer Exit:
EXIT_SAPLMGMU_001 in the program SAPLMGMU. - Solution:
In this exit, you can add logic to check the user’s authorization before allowing them to create or modify a material. If the user lacks the proper authorization, an error message is displayed.
IF NOT user_authorized_for_material( sy-uname ).
MESSAGE E001(ZCUSTOM) WITH ‘You are not authorized to change this material’.
EXIT.
ENDIF.
3. Automatic Delivery Date Calculation in SAP SD
- Scenario:
A logistics company needs to automatically calculate and populate the delivery date in the sales order based on the lead time and customer location when creating sales orders (VA01). - Customer Exit:
USEREXIT_MOVE_FIELD_TO_VBEP in the program SAPMV45A. - Solution:
In this exit, you can insert custom logic to calculate the delivery date based on the lead time and customer location. Once the calculation is done, the system automatically updates the delivery date field.
lv_lead_time = get_lead_time_for_customer( vbkd-kunnr ).
lv_delivery_date = sy-datum + lv_lead_time.
vbep-edatu = lv_delivery_date.
4. Default Shipping Instructions in SAP SD
- Scenario:
A company wants to default specific shipping instructions for certain customers when creating a delivery document (VL01N). These instructions should be automatically populated when creating the delivery. - Customer Exit:
USEREXIT_MOVE_FIELD_TO_LIKP in the program SAPMV50A. - Solution:
You can implement logic to automatically populate the shipping instructions field in the delivery document based on the customer.
IF likp-kunnr = ‘100000’.
likp-trspg = ‘EXPEDITED’.
ENDIF.
5. Enhancing the Billing Process in SAP SD
- Scenario:
A company needs to perform custom calculations for taxes during the billing process (VF01). The tax calculation should be adjusted based on customer-specific rules. - Customer Exit:
USEREXIT_ACCOUNT_PREP_KOMKCV in the program SAPLV60A. - Solution:
In this exit, you can enhance the tax calculation logic by inserting customer-specific tax rules before the billing document is posted.
IF komk-kunnr = ‘100200’ AND komk-land1 = ‘US’.
komk-mwskz = ‘A0’. “Custom tax code for specific customers in the US
ENDIF.
6. Purchase Order Custom Approval in SAP MM
- Scenario:
A company requires an additional approval step for purchase orders over a certain value (ME21N). If the purchase order value exceeds a predefined limit, it must be flagged for additional approval. - Customer Exit:
EXIT_SAPMM06E_012 in the program SAPMM06E. - Solution:
In this exit, you can add a custom check on the purchase order value. If the value exceeds the limit, the purchase order is flagged for additional approval.
IF ekko-netwr > 10000. “PO value limit
ekko-frggr = ‘Z1’. “Custom release strategy for high-value POs
ENDIF.
7. Customer-specific Pricing in SAP SD
- Scenario:
A company offers special discounts to certain customers when they order specific materials. This discount should be applied automatically during sales order creation (VA01). - Customer Exit:
USEREXIT_PRICING_PREPARE_TKOMK in the program SAPMV45A. - Solution:
In this exit, you can apply custom pricing rules that automatically adjust the pricing conditions for certain customers and materials.
IF komk-kunnr = ‘500123’ AND komp-matnr = ‘MATERIAL_A’.
komp-kbetr = komp-kbetr * 0.9. “10% discount for this customer and material
ENDIF.
8. Default Plant in SAP MM for Purchase Requisitions
- Scenario:
A company wants to default the plant field for certain users when creating purchase requisitions (ME51N) based on the user’s department or location. - Customer Exit:
EXIT_SAPLMEREQ_001 in the program SAPLMEREQ. - Solution:
In this exit, you can implement logic to automatically fill in the plant field based on the user’s department.
IF sy-uname = ‘USER1’.
c_werks = ‘PLANT_A’. “Default plant for this user
ENDIF.
Customer Exits allow businesses to customize SAP’s standard behavior in a way that is non-intrusive and upgrade-safe. They are ideal for implementing specific business logic, validations, and field updates without modifying SAP standard code, making them an effective solution for adding flexibility while maintaining system integrity.
Author : Aniket Pawar, 9373518385