SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Implement a Field Control Using a Business Add-in (`BAdI`)

Hide Prices for a Specified User Using a Business Add-in (`BAdI`) for a Purchase Requisition

Overview

🎓 intermediate 15 min. SAP S 4hana Cloud ABAP EnvironmentIntermediateABAP DevelopmentSAP Business Technology PlatformSAP BTP ABAP EnvironmentABAP Extensibility

You will learn

  • โœ”How to logon 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 hide a field, Price, by changing the status of a field control
Julie Plummer J Julie Plummer April 17, 2024
Created by March 9, 2023
Contributors

Prerequisites

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

Steps

Intro

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) enables you to implement enhancements to standard SAP applications without modifying the original code.

In this case, the BAdI is implemented in the SAP Fiori app as follows:

  1. Use an existing enhancement spot MM_PUR_S4_PR_FLDCNTRL_SIMPLE, with an existing BADI definition MM_PUR_S4_PR_FLDCNTRL_SIMPLE
  2. Create a container ( enhancement implementation ) in the enhancement spot
  3. Create a BADI implementation for the BADI definition.

step0-badi-creation-enhancement-process
step0-badi-creation-enhancement-process

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


Step 1 Log on to SAP S/4HANA Cloud ABAP Environment
โ€”

  1. Open ADT, select File > New > Other.

    logon
    logon

  2. Search ABAP Cloud Project, select it and choose Next >.

    logon
    logon

  3. Select SAP S/4HANA Cloud ABAP Environment, enter the ABAP service instance URL and choose Next.

    logon
    logon

  4. To log on, choose Open Logon Page in Browser, then choose Next.

    logon
    logon
    .
    logon
    logon

  5. Check your ABAP service instance connection and choose Finish.

    logon
    logon

Your project is available in the Project Explorer.

logon
logon

Step 2 Create package
+
Step 3 Choose enhancement spot
+
Step 4 Create enhancement implementation
+
Step 5 Add `BAdI` Implementation
+
Step 6 Create implementing class
+
Step 7 Implement code
+
Step 8 Test yourself
+
Step 9 More information
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Log on to SAP S/4HANA Cloud ABAP Environment 2. Create package 3. Choose enhancement spot 4. Create enhancement implementation 5. Add `BAdI` Implementation 6. Create implementing class 7. Implement code 8. Test yourself 9. More information

Learn more →