In this blog post I will showcase a simple example on Developer Extensibility in S/4 Cloud System.
I will extend the standard Manage Purchase Requisition App using released BADIs to add validations checks. In our example I will add validation to check and throw an error if the quantity is more than 10 or if the delivery date is more than 120 days. The outcome would look like below:
Developer Extensibility allows you to create developments projects in an S/4 HANA Cloud system, by providing an opportunity to develop cloud ready and lifecycle stable custom ABAP code on S/4 HANA cloud. It combines the benefits of custom ABAP code, with the necessary restrictions for cloud readiness and the S/4 HANA programming model to build Fiori Apps.
For more details on Developer Extensibility, please refer to the blog post by Jayprakash.
For more on BADI in S/4 Cloud, refer blog post.
Note: Developer Extensibility feature is available only on S/4 HANA Cloud 3 System Landscape (version 2208). The 3-system landscape is in an Early Adoption phase and is not available for all customers.
- Click on the link to install & setup Eclipse ADT.
- Make sure the user has necessary roles such as developer & ADT authorizations.
Once Eclipse ADT is ready and necessary ABAP add-ons are installed, and the cloud system has the roles setup, we are ready to begin.
Open Eclipse, Click File ->New, and choose ABAP Cloud Project. In the next pop-up, enter the service instance URL.
Click on next. In the next pop-up, click on Open Logon page in browser, and login to the system in the redirected URL.
Once logged in, you will get the message as below in the browser.
Now go back to Eclipse. You will see all the local APIs and released objects available as part of the new Developer Extensibility aka Embedded Steampunk – ABAP on-stack in Cloud.
In Today’s example, I will be extending the Purchase Requisition App by adding validations using released BADIs. Enhancement spot MM_PUR_S4_PR can be used for our purpose. Double click on enhancement, and it shows the list of BADIs available. We will use MM_PUR_S4_PR_CHECK for PR Item Checks.
Right click on the enhancement MM_PUR_S4_PR and click create New BADI Enhancement Implementation. Fill in the details as below:
Once the enhancement implementation is created, click on Add BADI Implementation button. Enter the BADI Definition and implementation name, in our case it is MM_PUR_S4_PR_CHECK as decided earlier.
Once the implementation is created, enter the class name in Implementing class box, and click on the Implementing class hyperlink to create the class.
Enter the class details and click next.
Save and activate the class. Now go to the class and write your code in the method ‘CHECK’. I have written a piece of code to provide message in case the quantity is more than 10 or delivery date exceeds 120 days.
METHOD if_mm_pur_s4_pr_check~check. data: ls_message type mmpur_s_messages. read TABLE purchaserequisitionitem_table into DATA(ls_preq_itm) index 1. if ls_preq_itm-orderedquantity > 10. ls_message-messageid = 'DUMMY'. ls_message-messagetype = 'E'. ls_message-messagenumber = '001'. ls_message-messagevariable1 = 'Quantity Limit is 10'. "Place Holder append ls_message to messages. endif. if ls_preq_itm-deliverydate - ( cl_abap_context_info=>get_system_date( ) ) > 120. ls_message-messageid = 'DUMMY'. ls_message-messagetype = 'E'. ls_message-messagenumber = '001'. ls_message-messagevariable1 = 'Delivery Date Limit 120 Days'. "Place Holder append ls_message to messages. endif. ENDMETHOD.
Save and activate.
Now login to your S/4 Cloud System and Open the Manage Purchase Requisitions App. Click on create, enter the document type. Next scroll down to PR Item and click on create. Enter the material & plant details. Next, enter the quantity more than 10 and delivery date more than 120 days. You can see the error messages displayed.
This is one of the simple scenarios to showcase what Developer Extensibility brings to the table. ABAP based custom extensions, ABAP based custom Apps etc. are some of the other use cases of Developer Extensibility. I will show case an example of designing a custom Fiori App using RAP model soon.