The Customer Exit mechanism in SAP ABAP is a powerful way to customize SAP standard functionality without modifying the core code. This ensures your enhancements are upgrade-safe, maintainable, and business-specific.
You can insert custom business rules, validations, or calculations specific to your organization’s needs. Customer exits remain intact during upgrades because they are isolated in dedicated includes or function modules. Customer exits support various use cases, such as Menu Exits, Screen Exits, Function Module Exits, and Field Exits.
Customer exits are part of the SAP enhancement framework, which includes BAdIs (Business Add-Ins) and Enhancement Points. They work together to provide developers with flexibility while keeping the system standard-compliant.
Since customer exits reside in their own namespace (e.g., ZX*, Z*), they are easy to document, review in audits, and transport between systems.
In SAP, an INCLUDE is provided inside a Customer Exit to offer customers a safe and structured place to write custom code without directly modifying SAP standard programs. The INCLUDEs in Customer Exits act like a secure sandbox for your custom logic — eliminating the risk of breaking standard code and remaining fully protected during upgrades.
The INCLUDE statement modularizes code by inserting the content of one ABAP program or code block into another. It functions like are usable container for code and is especially helpful for organizing large programs.
The INCLUDE statement instructs the ABAP runtime to insert the source code from the specified include program at that point during compilation.
The advantages of INCLUDE statements are:
- Modularity: Breaks large programs into smaller, logical blocks, making the code easier to understand and manage.
- Reusability: Allows common logic, declarations, and routines to be written once in an include and reused across multiple programs or function modules.
- Maintainability: INCLUDE statements isolate specific functionality, enabling updates or bug fixes in one place without affecting unrelated code.
- Enhancement support: SAP often places enhancement points inside INCLUDES, making them ideal for customer-specific extensions (for example, implicit enhancements).
- Version control and transport simplicity: Smaller INCLUDE files simplify tracking changes and managing transports in a controlled manner.

The Managed Gateway AddOn INCLUDE offers various statements to address specific requirements for integrating the backend SAP system with SAP Ariba. There are three INCLUDE statements included in this customer exit for the invoice that you need to implement:
- INCLUDE ARBCIG_INCL_INCOMING_INVOICE01 IF FOUND has logic for parking Service Invoices and non-PO invoices. This INCLUDE helps those customers to park invoices who have a service PO with GR-based IV and do not have an SES reference in the invoice. Customers also need to ensure that the INV_HDR_PRK_NOSES_POGRX_ENBLD parameter is enabled.
- INCLUDE ARBCIG_INCL_INCOMING_INVOICE03 IF FOUND manages hierarchy and the line numbers in the service invoice. It uses SRVMAPKEY to form the correct service hierarchy.
- INCLUDE ARBCIG_INCL_INCOMING_INVOICE02 IF FOUND handles accounting information in the non-PO invoices. In the non-PO invoices, shipping and handling charges added as service lines on the invoice need to be posted to G/L directly, and for that, additional information needs to be fetched in an extension segment. This INCLUDE reads the data from the extension segment and does the needful.
The standard SAP Invoice IDoc (INVOIC) doesn’t support invoices with service line items or non-PO invoices with shipping and handling charges, so you need to implement these three exits to handle this functionality. The customer exits under enhancement MRMH0002 are updated to include the parking of non-PO invoices without accounting details received from SAP Business Network.
Follow these steps to implement Customer Exits for Invoice:
Using the transaction code SPRO, navigate to Integration with Other SAP Components>Managed Gateway for Spend&Network for Buyer>SAP Business Network Integration>Application Specific Settings>Invoice.

- Expand the Invoice section and select IMG-Activity for Implement Customer Exit for Invoices with Service Type Line Items.

- On the Project Management of SAP Enhancements screen, enter the value or name in the Project field, for example ZTEST1,and select the Create button.

- On the Attributes of Enhancement Project ZTEST1 screen, enter a meaningful description in the Short Text field, and select the Enhancement assignments button.

- On the SAP Enhancements in Enhancement Project ZTEST1 screen, enter the Enhancement name MRMH0002, and choose the Enter key.

- Return to the Attributes of Enhancement Project ZTEST1 screen and select the Components button.

- On the Display ZTEST1 screen, double-click the User Exit EXIT_SAPLMRMH_011.

- On the Function Builder: Display EXIT_SAPLMRMH_011 screen, scroll-down to locate INCLUDE ZXM08U22, position your cursor on ZXM08U22, and double-click on it.

- On the ABAP Editor: Display Include ZXM08U22 screen, select Display <-> Change button from the menu bar at the top.

- On the ABAP Editor: Change Include ZXM08U22 screen, enter the INCLUDE statement INCLUDE ARBCIG_INCL_INCOMING_INVOICE01 IF FOUND.
- Select the Activate button from the menu bar at the top.

- Return to the Display ZTEST1 screen and double-click the User Exit EXIT_SAPLMRMH_014.

- On the Function Builder: Display EXIT_SAPLMRMH_014 screen, scroll-down to locate INCLUDE ZXM08U25, position your cursor on ZXM08U25, and double-click on it.

- On the ABAP Editor: Display Include ZXM08U25 screen, select Display <-> Change button from the menu bar at the top.

- On the ABAP Editor: Change Include ZXM08U25 screen, enter the INCLUDE statement INCLUDE ARBCIG_INCL_INCOMING_INVOICE03 IF FOUND.
- Select the Activate button from the menu bar at the top.

- Return to the Display ZTEST1 screen and double-click the User Exit, EXIT_SAPLMRMH_015.

- On the Function Builder: Display EXIT_SAPLMRMH_015 screen, scroll-down to locate INCLUDE ZXM08U26, position your cursor on ZXM08U26, and double-click.

- On the ABAP Editor: Display Include ZXM08U26 screen, select Display <-> Change button from the menu bar at the top.

- On the ABAP Editor: Change Include ZXM08U26 screen, enter the INCLUDE statement INCLUDE ARBCIG_INCL_INCOMING_INVOICE02 IF FOUND.
- Select the Activate button from the menu bar at the top.

- Return to the Project Management of SAP Enhancements screen and select the Activate project button.
