Skip to Content
Technical Articles
Author's profile photo Rohit Khan

Key User Extensibility on SAP S/4HANA Cloud – Adding Custom Business Logic

Key User Extensibility on SAP S/4HANA Cloud and SAP S/4HANA On-Premise – Adding Custom Business Logic

 

Last revisions
16-Aug-2021 Updated latest screenshots and content
03-Jun-2020 Updated latest screenshots and content
17-Jan-2019 Updated latest content

 

Blog updated for
SAP S/4HANA Cloud 2105, 2108
SAP S/4HANA On-Premise 1909, 2020
SAP S/4HANA Cloud Extended Edition

Read SAP Note 2936504

How to enable In-app extensibility Fiori apps in SAP S/4HANA Cloud, extended edition

 

Key User Extensibility on SAP S/4HANA Cloud and SAP S/4HANA On-Premise – Adding Custom Business Logic – Part 4

Target Audience – Business Experts, Key Users, Developers

To demonstrate Custom Logic let’s take the standard Fiori App to Create Customer Projects under Project Management. This is a simple demonstration; however, more complex logics can also be created provided such Enhancement Options are provided for a Business Context.

Also, this app for demo is only available in SAP S/4HANA Cloud. However, whatever you will learn is also applicable for SAP S/4HANA On-Premise

Scenario – When we start creating a new customer project, the standard does not automatically generate a Project ID. To check this, go back to Blog 3 and you would notice, Project ID is manually provided

Click the tile to create a customer project and try to save without giving a Project ID. You would notice an error is issues as system expects you to enter a Project ID.

For this demo we will see how we can implement the custom logic so that a number is auto-generated by the system and this field is auto-populated.

Let’s see how to do this.

Choose the tile – Custom Logic this time.

Once in, go to the tab Custom Logic.

You may see already some implementations in the list. Click on the ‘+’  icon to create a fresh Enhancement Implementation. Once you click that icon, following pop-up will appear. Fill the details as required.

Under BAdI Description, you will find many BAdIs are listed. However, for our scenario, we need to pick the following as shown below

Let’s understand few details related to above.

 

Business Context – means for which data set enhancement implementation will be applicable. When this enhancement is implemented, it is integrated with the parent application at the specified and designated point

Enhancement Option – is just like any other enhancement implementation point where an app can be extended

Name – is any meaningful name given to the enhancement implementation that will appear in the list above

Next choose the Business Context, and already available Enhancement Option. Give a meaningful name and hit Create

Please note that the Identifier name here is generated automatically by the system, however, you can still change it

Once you hit create, system takes you to ABAP Web Editor where you can write the enhancement code. As you see in the below screen shot, the system gives you a draft code pre-generated code which you can publish or make any other changes to it.

In this same window you can also test your code. Once satisfied, you can then save and publish.

Once you click on Test you would see some value being returned in the parameter ‘engagementProject’. This shows that the logic is working fine.

The ABAP Web Editor also has a syntax check feature and will highlight it with red mark. Some examples see below –

It is also important to note that, the capability of the ABAP Web Editor is restricted ABAP and no database create, update, delete statements etc. is allowed. Also, there is no direct access allowed to database tables. Instead, you can use released CDS views in the select statement. See screenshots below.

 

For more details about Restricted ABAP, see below link –

S/4HANA Extensibility Concept Details: Restricted ABAP

Now let’s go ahead and publish our implementation. Click on the Publish button

Click Ok

Now let’s go back and try to create a new customer project. You will notice that Project ID is now automatically generated as soon as you fill the first field – Customer

Visit SAP teched Online for more interesting videos: http://sapteched.com/online

 

Some more helpful links –

https://sapui5.hana.ondemand.com/#docs/guide/f1430c0337534d469da3a56307ff76af.html

 

Congratulations you have just finished Key User Extensibility – Adding Custom Business Logic to the standard S/4HANA Fiori UI app using Key User tools!

Rohit Khan, S/4HANA Regional Implementation Group

Thank you for reading through these blogs!

Link to previous parts of the blog series:

Part 1: Introduction to S/4HANA Cloud Key-User Extensibility

Part 2: Key User Extensibility on SAP S/4HANA Cloud – UI Adaptions for Key User

Part 3: Key User Extensibility on SAP S/4HANA Cloud – Adding Custom Fields

Assigned tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kishore Marodia
      Kishore Marodia

      Hey Rohit

       

      Great example with simple steps, nice work. Beneficial!

       

      Thanks

      Kishore

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Thank you Kishore !

      Author's profile photo Badal Bhasin
      Badal Bhasin

      Hi Rohit,

       

      This is such an amazing blog. Well done!!

       

      Thanks,

      Badal

       

      Author's profile photo Suman Ogeti
      Suman Ogeti

      Dear Rohit, We are migrating Time entry and Expenses into SAP S4 Cloud from our existing Non-SAP Time entry tool, We have to bring 6 months of time entry information into SAP S4 Cloud and I did not find the app in Manage your solution to upload entries. Can you help me in finding a correct app or process to succeed it?

      By the way, its a nice blog and appreciate for sharing information, it's really worth.

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Suman,

      Thank you for reading through the blog. Can you please mail me and I will get back to you.

      Best Regards

      Rohit

       

      Author's profile photo Suman Ogeti
      Suman Ogeti

      Dear Rohit,

      Morning! Thanks for the reply..I sent with more details to your company email and I really appreciate your help.

      Thanks!

      Author's profile photo madhusmita mansingh
      madhusmita mansingh

      Hi Rohit,

      We have a requirement to add a new tab in Manage Product Master fiori app and in this tab it should show data from a Z table.

      By using UI Adaption we can do 'add new section' to  add a new tab to the existing tabs.

      Currently by using UI Adaption we are able to see a list of section on click of Add section icon in Manage Product Master standard Fiori app.

      But could you please suggest how can I add more user defined entries to the existing sections shows in the add section option.

      And how can we show  data of a  Z table in the newly created tab.

      Kindly suggest.

       

      Regards

       

       

       

       

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi madhusmita mansingh ,

       

      Are on S4HC or S4H?

       

      Cheers

      Rohit

      Author's profile photo Martin Baeuml
      Martin Baeuml

      Hallo,

      do you know any possibility how to identify the system within the custom logic. So whether it is the quality or the productive?

      We need to implement a different logic for the systems.

      Regards

      Martin

      Author's profile photo Anup Kumar Tiwari
      Anup Kumar Tiwari

      Hello Rohit,

      Thanks for writing this blog. I followed similar steps on 'Manage Product Master Data' App.

      I have implemented BAdi 'CMD_PRODUCT_VALIDATE' & 'BD_CMD_PROD_DATA_API_CHECK' from CFL app to validate the custom fields. This works fine while triggering from the Fiori App.

      But if i try to create/change material from the BAPI 'BAPI_MATERIAL_SAVEREPLICA', the BAdi does not trigger. This BAPI is mentioned in business context 'PRODUCT' as well in SCFD_REGISTRY tcode.

      Can you help in identifying why the BAdi is not triggering from the BAPI or MM01/02 transaction or if we have any limitation on the In-App BAdi wrt the BAPI's and GUI tcode.

       

      Thanks.

      Author's profile photo Rohit Khan
      Rohit Khan
      Blog Post Author

      Hi Anup,

      The BADI you see in the CFL app is applicable for the UI and Reports that you see under UI and Reports tab in CFL app.

      For MM01/02, you can use SE18 or SE80 by searching in the relevant package.

      Thanks,

      Rohit