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

Create and Debug a BAdI Implementation in S/4HANA Cloud ABAP Environment

Create and Debug a BAdI Implementation in ABAP Development Tools (ADT)

Overview

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

You will learn

  • โœ”How to create and implement a simple BAdI
  • โœ”Analyze errors using ABAP Cross Trace
  • โœ”How to inspect the BAdI implementing class in ABAP Debugger Throughout this tutorial, objects name include a suffix, such as ###. Always replace this with your group number or initials. > 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.
    step0-overview-debug
    step0-overview-debug
Julie Plummer J Julie Plummer November 6, 2024
Created by March 9, 2023
Contributors

Prerequisites

Prerequisites

  • You have a license for SAP S/4HANA Cloud; have a developer user in this system and have created an ABAP Cloud Project
  • 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 ADT in particular. If not, work through the Tutorial: Implement a Business Add-in (BAdI) To Check a Purchase Requisition. This tutorial also contains links to more information about BAdIs
  • You have created a BAdI enhancement implementation ZEI_PR_ITEM. (abap-s4hanacloud-procurement-purchasereq-checks), steps 1-4
  • You have opened the Fiori app Create Purchase Requisition
  • You are familiar with the concept of debugging ABAP in ADT. If not, see the links below
  • You have assigned the following roles to your user: SAP_BR_DEVELOPER, SAP_BR_PURCHASER

Steps

Step 1 Add `BAdI` implementation
โ€”

  1. Open an enhancement implementation ZEI_PR_ITEM.

  2. Choose Add BAdI implementation

    step1a-add-badi-impl
    step1a-add-badi-impl

  3. Add the following, then choose Next:

    • BAdI Definition: MM_PUR_S4_PR_MODIFY_ITEM Modify Purchase Requisition Item (Add by clicking on Browse)

    • BAdI Implementation Name: ZIMP_PR_ITEM

      step1b-badi-impl-info

Your BAdI implementation appears in a new editor.

step1c-badi-impl-editor
step1c-badi-impl-editor

Ignore the error. You will fix this in the next step.

Step 2 Create implementing class
+
Step 3 Implement code
+
Step 4 Add ABAP Cross Trace in ADT
+
Step 5 Execute app
+
Step 6 Analyze BAdI call in ABAP Cross Trace
+
Step 7 Open ABAP Debugger
+
Step 8 Set condition for breakpoint
+
Step 9 Set `watchpoint`
+
Step 10 Test yourself
+
Step 11 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 11
1. Add `BAdI` implementation 2. Create implementing class 3. Implement code 4. Add ABAP Cross Trace in ADT 5. Execute app 6. Analyze BAdI call in ABAP Cross Trace 7. Open ABAP Debugger 8. Set condition for breakpoint 9. Set `watchpoint` 10. Test yourself 11. More information

Learn more →