CDS View Extensibility in SAP S/4HANA: Key watch outs while extending CDS Views
In SAP S/4HANA On Premise, you can also extend the CDS views in 2 ways – One using Key User Extensibility and other using manual Eclipse editor
In SAP S/4HANA you should use first option if possible, to extend the CDS view. You can add the custom fields to Extensible CDS Views using Key User Extensibility. Only views available in transaction SCFD_REGISTRY get extended; else you must manually extend CDS view using Eclipse editor.
Below screen shot of SCFD_REGISTRY transaction shows extensible CDS views; for example, let’s take the case of CDS View C_SALESORDERQUERY
Now using Fiori app Custom Field and Logic you can extend the CDS view with the custom field. Now for the CDS View where UI and Report is X; same can be enabled for example here we have extended the view with Custom field ZZ1_ZORIGIN
Now in Eclipse if you open the CDS view; you will find the extension that got created automatically when you extended the CDS view using Fiori app “Custom Field and Logic”
Same can be checked in SE11 as well as shown below
Now in case extension of CDS view is not possible with Key user Extensibility; you will go for the manual extension of the CDS view. Same has been explained very well in the blog listed here
But did you ever notice that activating Extension on certain CDS Views takes very long time?
For example, activating extension on CDS View I_SUPPLIER with just one field took more than 90 minutes for me! Now in this case lot of dependent views must be activated so the activation of I_SUPPLIER took a long time. In general, activation of a single DDL source queries and updates a lot of meta data tables on the database and that’s there most of the activation time is spent.
For comparison, if we run program RUTDDLSACTSINGLE for CDS view I_SUPPLIER_CDS: The activation should take only two-three seconds. This will just show that the performance is in fact due to the huge amount of dependencies.
The next question that will cross your mind is how to handle deployment of extension in Prod for such cases?
Well the best scenario to deploy such changes to production is during downtime. If not possible, perform it during the lowest possible usage, otherwise you may be seeing Mismatch* related dumps, due to the numbers of view regenerated, it is very likely that at least of user is using it at that time.
I also recommend that prior to importing the TR to Production, we should check if there are any views that are already missing, because the TR will try to activate it as well, which can increase the duration. Refer KBA 2793766
How do I estimate activation of extension over such CDS views?
Using the FM DD_DDIC_DEP_GET. In SE37, execute the FM and put the following parameters in E071TAB:
PGMI = R3TR
OBJE = DDLS
OBJ_NAME = I_SUPPLIER
The output will be in the DEPTAB. You can see that from I_SUPPLIER, the result is 6.956 entries. (In the activation, only 2934 were re-activated due to different levels of dependency, nevertheless, this can give you a prediction on the time it will take).
As of today, SAP doesn’t offer any solution to speed up activation in such cases; so, the only advise is to handle such cases carefully.
Before concluding; I would also like to mention about newly released SAP note 2964047 – Error during syntax check of CDS views. Have you ever noticed errors in Standard CDS views when you do syntax check in Eclipse over standard CDS Views ? Like I_SALESDOCUMENT, solution for same has been provided in this OSS Note
Summary: In this blog post I covered what all should be taken care while extending CDS views so that you are aware of the performance issues that are being faced while extending CDS Views.