Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Vincent_Zhu
Product and Topic Expert
Product and Topic Expert
This is a detailed step-by-step guide document to introduce a Developer Extensibility case followed by this blog.

1. Case Background:


This case is about customizing the Sales Order standard App, adding a custom field called "BU Section". However, the custom fields on Sales Order are on the last tab "Custom Fields". People tends to forget maintaining the value of this field. So we need to make this custom field mandatory.

As you can see below, we use App Custom Fields to create a custom field like below:


Custom Field BUSection


 

When we saving the sales order without entering the custom field, an error message pops up:


Custom field is mandatory


 

2. Implementation Details:


2.1 Find the released BAdl


We check the sales Extensibility part, find the enhancement spot ES_SD_SLS_EXTEND, and under the enhancement spot, there is a BAdl called SD_SLS_FIELDPROP_ITEM, which can set the sales item field properties.

Detailed path is like below:

Release Objects > Enhancements > SD > SD-SLS > SD-SLS-EXT > Enhancements Spots


Find the BAdl to use


 

2.2 Create BAdl Enhancement Implementation


First, we create a package, and we add it to favorite packages for further look-up.


Create a new package


Then, right-click the package, choose New -> Other ABAP Repository Object -> BAdl Enhancement Implementation:


BAdl Enhancement Implementation


Enter Name and Description, and choose Browser:


 

Enter ES_SD_SLS_EXTEND and search, click OK.


 

2.3 Create BAdl Definition


Open the BAdl Enhancement Implementation created from last step, Click "Add BAdl Implementation", click on "Browser", search and choose SD_SLS_FIELDPROP_ITEM, click OK.


 

Enter your BAdl Implementation Name, and click on Add:


 

2.4 Customizing implementation logic in ABAP class


Right-click the package, choose New -> ABAP Class, enter the class name and description, click on Next.



 

In the class, implement the logic like below. Set the custom field BUSection as a mandatory field.
CLASS zcl_sls_fieldprop_item DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES if_badi_interface .
INTERFACES if_sd_sls_fieldprop_item .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS ZCL_SLS_FIELDPROP_ITEM IMPLEMENTATION.

METHOD if_sd_sls_fieldprop_item~set_field_prop.
loop at field_properties assigning field-symbol(<fs_field_properties>).
if salesdocument-salesorganization = 'your sales org value'.
if <fs_field_properties>-field_name = 'YY1_BUSECTION_SDI'.
<fs_field_properties>-mandatory = 'X'.
endif.
endif.
endloop.
ENDMETHOD.
ENDCLASS.

 

2.5 Activate the BAdl Implementation


Click on the checkbox "Active Implementation", then activate. The message "The implementation will be called" means the BAdl implementation has been activated.


 

3. Debug in Developer Extensibility


Easy to debug is one of the advantage to implement the BAdls in Developer Extensibility compared to Key-User Extensibility.

Here I will illustrate the steps how to debug in Developer Extensibility.

3.1 Add required Business Catalog


For the system you want to debug, you need to make sure your user has roles which contain the following Business Catalogs:

  • SAP_A4C_BC_DEV_SUP_PC          ---  Development - Analysis and Support

  • SAP_A4C_BC_DEV_OBJ_DIS_PC   ---  Development - Development Objects Display


 

3.2 Set Breakpoint in the code


After connecting the system in ADT, find the code you want to debug, and set the breakpoint properly, like the example below:


 

3.3 Run the program and debug


Open the APP Manage Sales Orders, click to change a sales order, you can see the system stops on loading page.


 

If we go back to ADT, we can see the debug mode has been activated. And the custom field YY1_BUSECTION_SDI's mandatory property has changed from blank to X.


Now the page is still loading:


We click F8 to proceed, then the debug mode ends, and the page has been loaded successfully:


 

 

More Information on SAP S/4HANA Cloud, Public Edition:



  • SAP S/4HANA Cloud, public edition, release info here

  • Latest SAP S/4HANA Cloud, public edition, release blog posts here and previous release highlights here

  • Product videos on our SAP S/4HANA Cloud, public edition and SAP S/4HANA YouTube playlist

  • SAP S/4HANA PSCC Digital Enablement Wheel here

  • Early Release Webinar Series here

  • Inside SAP S/4HANA Podcast here

  • openSAP Microlearnings for SAP S/4HANA here

  • Best practices for SAP S/4HANA Cloud, public edition, here

  • SAP S/4HANA Cloud, public edition, Community: here

  • Feature Scope Description here

  • What’s New here

  • Help Portal Product Page here

  • SAP S/4HANA Cloud ABAP Environment Community here


Follow us via @SAP and #S4HANA or follow vincent.zhu
4 Comments