This is about SAP user exit vs. SAP customer exit vs. SAP BAdI vs. SAP BAPI.
- What user exit, customer exit, BAdI, and BAPI mean
- The difference between them
If you want to get this SAP fundamental right, this is the article for you.
Let’s get started!
Why User Exits, Customer Exits, BAdIs, and BAPIs?
Let’s divide the four into two categories:
BAdIs (Business Add-ins), user exits, and customer exits belong to the same category.
BAPIs (Business Application Programming Interfaces) are another category.
#1 Category: User Exits, Customer Exits, and BAdIs
User exits, customer exits, and BAdIs all serve the same purpose:
See, SAP applications are standard software. Standard software provides a solution to clearly defined scopes, like standard business processes. Standard software doesn’t cover things like unique business processes. Let’s make this more clear with an example:
There is a standard software that manages lemonade stand materials:
These are the standard materials of a lemonade stand.
However, one lemonade stand doesn’t make lemonade like other lemonade stands. This lemonade stand makes its lemonade with mint. Obviously this lemonade stand wants to material manage away the mint too.
Now this unicorn lemonade stand has two options:
- Pay tons of money for an individual software system that gets created just for them.
- Use and customize the existing software and save a ton of money.
That’s a no-brainer:
It’s option 2. They buy the standard software for pennies and customize it to handle the mint material as well.
So far so good?
Now, if SAP made the lemonade stand standard software, you would do the customization that was needed (if you couldn’t do it with the standard customization options, but let’s keep our options simple for now) with a user exit, customer exit, or BAdI (likely the latter since the other two are outdated).
Therefore, sap user exits, customer exits, and BAdIs serve one purpose, and one purpose alone: to customize standard SAP software.
#2 Category: BAPIs
BAPIs aren’t for customizing standard SAP software.
BAPIs are APIs (Application Programming Interfaces), and they make SAP systems accessible to other SAP systems and third-party applications.
For example, there is an SAP ECC application server and an SAP CRM application server in your SAP system landscape. Now, you want to call a function in your SAP CRM from SAP ECC. How do you access SAP CRM? Correct: through a BAdI.
BAPIs have nothing to do with extending or modifying standard SAP programs. Therefore, there are two categories. However, BAdI sounds like BAPI, so it makes sense to compare the two for clarification.
Let’s take a look at each item:
What Is an SAP User Exit?
The user exit was one of the first SAP techniques to customize standard SAP programs.
An SAP user exit is a point in a standard SAP program where a customer can run its own code. User exit isn’t an enhancement, it’s a modification.
User exits allow developers to modify SAP programs by modifying their data objects and program components. On an upgrade, every user exit has to be re-implemented and verified that it complies with the original but now updated standard SAP program.
There are two types of user exits:
- User exits using includes: These are customer enhancements that are called directly in the standard program.
- User exits using tables: These are used and managed using customizing (transaction SPRO).
You invoke an user exit through a subroutine in the standard program:
As mentioned, the PERFORM executes in the standard SAP program. As a result, you have access to pretty much anything the program does. This means you can do pretty much anything but with power comes responsibility.
Furthermore, because the standard SAP program directly implements the user exit, you need an SAP activation key. Additionally, the user exits gets activated whenever you activate the standard program.
What Is an SAP Customer Exit?
The SAP customer exit is the successor to the SAP user exit.
SAP customer exits are like SAP user exits: they are special points where customers can implement their own logic.
But a customer exit isn’t a modification, it’s an enhancement. Unlike user exits, customer exits cannot change program components or data objects in the standard SAP program.
After you activate a customer exit in an SAP standard program, it calls an empty function module. You have access to this function module’s parameters:
By putting your code in the function module, you can enhance the standard SAP program.
So when the SAP standard program calls the user exit, the user exit calls the function module, and the function module calls your code:
SAP standard program > user exit > function module > your enhancement of the SAP standard program.
A standard SAP program invokes a customer exit as follows:
CALL CUSTOMER-FUNCTION 'the_customer_exit'
An SAP activation key isn’t needed for a customer exit. Activating a function exit requires creating a project in the transaction CMOD (Customer Exits) and activating the project.
What Is an SAP BAdI?
The BAdI is the successor to the customer exit.
BAdIs are like SAP user exits and SAP customer exits: they’re places where customers can implement their own logic.
The official SAP definition of a BAdI (Business Ad-In) is:
That sounds like an SAP user exit, doesn’t it? Yes, it does:
BAdIs are just object-oriented versions of SAP user and customer exits. Instead of putting logic in a standard SAP program or function module, you create a class that implements predefined methods from an interface. The SAP standard fires those methods at predefined points.
Some BAdIs can have multiple implementations, which is great for software development as many developers can use the same BAdI independently. Furthermore, you can create BAdIs for your own programs.
BAdIs come in two flavors: classical BAdIs and new ones. SAP released the classical BAdIs with release 4.6d and the new ones with the Enhancement Framework in release 7.0. You can migrate the old BAPIs to the new ones so that you can take advantage of the new features in the latest BAPI version.
BAdIs are great because they can be used without modifying the original code such as customer exits. Plus, BAdIs are object-oriented and therefore reusable—before BAdIs, there was no reusable enhancement technique in SAP.
There are both single-implementations and multiple-implementations of the BAdI, and multiple implementations can be created from a single BAdI definition.
A BAdI consists of an interface, a set of filters, and various settings that can be customized depending on the prerequisites in place, and these implementations can be externally controlled through switch framework.
BAdIs can also be used to build screens and menus for dynpros (Dynamic Programs) and SAP GUI (Graphical User Interface) statuses.
BAdls are created and edited inside ABAP Enhancement Builder. They’re in the global class namespace. You can search for BAdIs and see their details with t-code SE18 (Business Add-Ins: Definitions). You can implement a BAdI with the t-code SE19 (Business Add-Ins: Implementations).
What Is an SAP BAPI?
Business Application Programming Interfaces (BAPIs) allow SAP developers to safely access and share SAP business objects with external clients and third-party organizations that support the RFC protocol.
BAPIs are defined within the BOR (Business Object Repository) as either specific SAP interface types or methods of SAP business objects, within the SAP landscape. The BOR stores all SAP business objects, such as:
BAPIs provide an object-oriented view of developing business solutions and an interaction method by which objects can be fused and integrated to resolve problems.
BAPIs are implemented and stored as function modules that are usually RFC enabled. An RFC module communicates between SAP systems. It calls a function from one SAP system in another SAP system.
BAPIs allow external applications to access SAP systems:
Applications that access SAP systems with BAPIs belong to:
- The Same SAP system (for example, SAP S/4HANA)
- Another SAP system (for example, an SAP CRM 7.0 communicates to an SAP ECC)
- An External system (for example, a .Net system)
- HTTP Gateway
You can find BAPIs with the t-code BAPI (BAPI Explorer).
What Is the Difference Between a User Exit, Customer Exit, BAdI, and BAPI?
Now it’s easy:
- User exit
- One of the first extension methods by SAP
- Allows you to modify a standard SAP program
- Customer exit
- Successor of the user exit
- You can extend a standard SAP program
- It’s obsolete
- Successor of the customer exit
- You can extend a standard SAP program and get extensions for your own programs
- Latest ABAP extension technology
- You can share objects, functions, and data between SAP systems and with third-party applications that support the RFC protocol