The Customer Exit mechanism in SAP ABAP is a powerful method for customizing standard SAP functionality without altering the core code. This ensures that your enhancements are upgrade-safe, maintainable, and tailored to your business needs.
You can introduce custom business rules, validations, or calculations specific to your organization’s requirements. Customer exits remain intact during upgrades as they are confined within dedicated includes or function modules. They support a variety of use cases, including Menu Exits, Screen Exits, Function Module Exits, and Field Exits.
Customer exits are part of the SAP enhancement framework, which also includes BAdIs (Business Add-Ins) and Enhancement Points. These components work together to provide developers with flexibility while maintaining system compliance with standards.
Because customer exits belong to their own namespace (e.g., ZX*, Z*), they are easy to document, review during audits, and transport between systems.
In SAP, an INCLUDE is provided within a Customer Exit to offer customers a safe and structured environment for writing custom code without directly modifying standard SAP programs. The INCLUDEs in Customer Exits serve as a secure sandbox for your custom logic — ensuring no risk of damaging standard code, and they are fully protected during upgrades.
The INCLUDE statement modularizes code by inserting the content of one ABAP program or code block into another. It functions as a usable container for code and is especially beneficial for organizing large programs. The INCLUDE statement directs the ABAP runtime to insert the source code from the specified include program at that point during compilation.
The advantages of INCLUDE statements include:
- Modularity: It divides large programs into smaller, logical blocks, making the code easier to understand and manage.
- Reusability: Common logic, declarations, and routines can be written once in an include and reused across multiple programs or function modules.
- Maintainability: Since INCLUDE statements isolate specific functionality, updates or bug fixes can be made in one place without affecting unrelated code.
- Enhancement Support: SAP often places enhancement points inside INCLUDES, making them ideal for customer-specific extensions(e.g., implicit enhancements).
- Version Control and Transport Simplicity: Smaller INCLUDE files make it easier to track changes and manage transports in a controlled manner.
In the Managed Gateway AddOn, INCLUDE, various statements are provided to address specific integration requirements between the backend SAP system and SAP Ariba. There are two INCLUDE statements available for the purchase order that you need to implement through the customer exit.
- The INCLUDE ARBCIG_ORDER_REQUEST_002 contains logic for Purchase Order (PO) outbound processing. It is used during the creation of the OrderRequest message sent from the SAP system to the SAP Business Network. This INCLUDE primarily manages the item-level structure and details of the Purchase Order necessary for integration.
- The INCLUDE ARBCIG_ORDER_REQUEST_011 typically addresses the accounting information in the OrderRequest message, including Account Assignment (Cost Center, GL Account, Internal Order, WBS Element, and Asset). It facilitates split accounting by correctly formatting and looping through each assignment when multiple account assignments exist for a single purchase order item.
Follow these steps to implement Customer Exits for Purchase Order:
- 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>Purchase Order.

- Expand the Purchase Order section and select IMG-Activity for Implement a Customer Exit for Purchase Order.

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

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

- On the SAP Enhancements in Enhancement Project ZMMIDOC screen, enter the Enhancement name MM06E001 field, and hit the Enter key on your keyboard.

- Return to the Attributes of Enhancement Project ZMMIDOC screen, and choose the Components button.

- On the Display ZMMIDOC screen, double-click the User Exit EXIT_SAPLEINM_002.

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

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

- On the ABAP Editor: Change Include ZXM06U02 screen, enter the INCLUDE statement INCLUDE ARBCIG_ORDER_REQUEST_002 IF FOUND.
- Choose the Activate button from the menu bar at the top.

- Return to the Display ZMMIDOC screen and double-click the User Exit EXIT_SAPLEINM_011.

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

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

- On the ABAP Editor: Change Include ZXM06U33 screen, enter the INCLUDE statement INCLUDE ARBCIG_ORDER_REQUEST_011 IF FOUND.
- Choose the Activate button from the menu bar at the top.

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

Note
To view the purchase order with line items deleted in the ARBCIG_ORDERS IDoc, you also need to implement the Customer Exit by adding a separate INCLUDE statement, INCLUDE ARBCIG_PO_ITEM_LINEDEL_002 IF FOUND in the standard SAP INCLUDE ZXM06U02 of the User Exit EXIT_SAPLEINM_002.
Ensure that this INCLUDE statement precedes the other INCLUDE statement, INCLUDE ARBCIG_ORDER_REQUEST_002 IF FOUND.