Want to use Custom Classes and Custom CDS views inside In-App BADI aka Custom logic?
With S/4HANA comes the concept of Extensibility and with In-App extensibility comes the restricted ABAP. If you are new to S/4HANA Extensibility concept , there are ample of good blogs available and you can check one of my blog also here.
As we all know, inside the custom logic BADI’s we can use only restricted “ABAP for Key Users” which allows released/Whitelisted API’s or CDS views . And most of the time we need options like calling own custom CDS view , Classes ,FM or BAPI and feel helpless as it is not allowed …
A thought comes in the mind, can’t we make custom CDS views , classes , FM or BAPI as whitelisted??Unfortunately SCFD_REGISTRY doesn’t allow that.
Then is there any other way???… and the answer is YES… Awesome..isn’t it? it can make our life much easier…
So , before we see how to do it, one important point, We can’t use FMs/BAPIs directly inside Web based editor /Custom logic. So, we need to create wrapper classes around them to use them inside web based editor.
Now , the important question, how to make custom classes or CDS view whitelisted or released ??
So, we can do that using the Eclipse ADT properties. Once, we we ready with Custom CDS view or class we want to use , we need to follow the steps below.
- Go to the Eclipse and open the object to be released/whitelisted.In this case I have selected the CDS view. Click on the properties tab highlighted in below screen shot.
- Select “API State” in the left window and click on “Add Release Contract”.
- In the next screen, select the “Use System-Internally (Contract C1)”. This needs to be selected if we want to use the Object inside In-App BADI/ Fiori Custom Logic Fiori app. Contract C2 can be selected is we need the object to be release as remote API for external usage. These, options changes based on the object we want to release.
- Select release state as “Released” in the next screen. Also, notice that based on the contract we select, the checkbox for “Use in Key User Apps” is checked and the other one is grayed out.
- The system validates for any issues in releasing the object and shows the same in next screen as below. As we can see,there are no issues detected in this case.
- Select the TR to lock the changes .
- And finish the release.
With this, we have released the custom CDS view to be make it available for usage inside the custom fields and logic/ In-App web editor.
Similarly, we can create wrapper classes around FMs/BAPIs and can release and use the same inside web editor achieve much more then then what we were struggling to do so far. In case of classes only Contract C1 is available and can only be used inside Key used apps.
Hope this will help people who are looking for options to call their custom logic inside In-App web editor.
Keep learning & Keep Sharing!!
Good one Vijay.
I think i was able to use Custom CDS views in web based editor(not sure though), but i see to have the ability to use BAPIs / FMs in web based editor as a very useful feature. Thanks for sharing! It will increase the usability of key user extensibility manifold.
I guess you are talking about custom CDS views created using apps like Custom business Objects or Custom CDS view Fiori app. Those we can use, but if there custom views created using eclipse ADT , i guess are not available for usage.
Yes, I was talking about those only as i had used it for S/4HANA ES solution.
That makes sense 🙂
Thanks for the blog. This is applicable only for S/4HANA on-premise right? Is it possible for S4 Public cloud? If yes, how?
Hi Venkatesh Pendekanti,
This is applicable only to On-Premise..
Is this a SAP recommended approach .?