Implement a Business Add-in (`BAdI`) To Check a Purchase Requisition
- How to log on to SAP S/4HANA Cloud ABAP Environment
- How to create an ABAP package
- How to find relevant existing
BAdI
enhancement spots for your line of business, in this case Materials-Management-Purchasing - How to implement a
BAdI
that checks for the field quantity and delivery date during creation of purchase requisition item
Prerequisites
- You have a license for SAP S/4HANA Cloud and have a developer user in this system
- You have installed SAP ABAP Development Tools (ADT), latest version, and have created an ABAP Cloud project for your SAP S/4HANA Cloud System in it
- You are familiar with the concept of extensions to the SAP standard and with
BAdIs
in particular. If not, see the More Information section at the end of this tutorial - To test the
BAdI
: In SAP Fiori launchpad, you have the authorization for the app Process Purchase Requisitions - Professional, i.e.SAP_BR_PURCHASER
The administrator receives an welcome e-mail after provisioning. This e-mail includes the system URL. By removing
/ui
you can log into the SAP S/4HANA Cloud ABAP Environment system. Further information can be found Developer Extensibility: Connect to the ABAP System.
A Business Add-In (BAdI
) an object-oriented enhancement option, a hook for an object plug-in. It enables you to implement enhancements to standard SAP applications without modifying the original code.
In these tutorials, SAP has already defined the BAdI
enhancement spot, MM_PUR_S4_PR
for the Fiori App Manage Purchase Requisitions – Professional, and the BAdI
definition, MM_PUR_S4_PR_CHECK
.
You then implement the BAdI
in the SAP Fiori app as follows:
1. For the BAdI
definition MM_PUR_S4_PR_CHECK
, you create a container, known as an enhancement implementation - here ZEI_BADI_CHECK_PURCH_REQ_000
.
2. You can then create one or more BAdI implementations
- here ZIMP_CHECK_PURCH_REQ_000
.
3. For each BAdI implementation
you create an ABAP Class - here ZCL_CHECK_PURCH_REQ_000
.
4. Within this class, you then create a method of the BAdI
- here MM_PUR_S4_PR_CHECK~check
.

The advantage of this approach is that you can group several related BAdI implementations in one enhancement implementation.

At runtime:
- The user creates a purchase requisition.
- The enhancement checks:
- the quantity of items ordered is 10 or fewer
- the date is 180 days or fewer in advance
- If not, the application returns an error.
The application will look roughly like this:


Throughout this tutorial, objects name include a suffix, such as 000
. Always replace this with your group number or initials.