Exercise: Implementing a Simple Developer Extension

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Implement a simple developer extension via released BAdI for Purchase Requisition

Implement a Simple Developer Extension

Business Scenario

You login with the role ‘Purchaser’ in the SAP S/4HANA Cloud for your daily activities and access ‘Manage Purchase Requisitions’ app. You have a requirement to meet the following conditions when creating a new ‘Purchase Requisition’:

  • The quantity of the items entered must be ten or fewer.
  • The delivery date allowed is up to 180 days (about six months).

If the above two conditions are not met, then the application should throw an error message.

Solution Approach

In the SAP Fiori app Manage Purchase Requisitions Professional, there is one released enhancement spot MM_PUR_S4_PR. At this spot, there are multiple enhancement definitions. We will identify the one relevant to our use case and implement it.

  • Create a new ABAP package.
  • Implement existing enhancement spot MM_PUR_S4_PR with an existing BAdI definition MM_PUR_PR_CHECK.
  • Create an enhancement implementation.
  • Create a BAdI implementation for the BAdI definition.
  • Add the logic inside the implementation.

Steps

  1. Log on to the development tenant of the SAP S/4HANA Cloud ABAP Environment. 

  2. Create a new ABAP Package using context menu.  

  3. Find out the enhancement spot for this requirement.  

  4. Implement the identified BAdI definition under the BADI Enhancement Spot ‘MM_PUR_S4_PR’. In this step you will now create a new enhancement implementation (also called container) within the enhancement spot ‘MM_PUR_S4_PR’. 

  5. Test the implemented code by creating a new purchase requisition via the Manage Purchase Requisitions app .

Result

Save progress to your learning plan by logging in or creating an account