Skip to Content
Product Information
Author's profile photo Andreas Riehl

Custom CDS Views – FAQ

Frequently asked Questions
on the Custom CDS Views Key User app

This blog post will be continuously enhanced. Feel free to add comments when you think your question should be mentioned here as well.


Configuration

Product Information

Modeling Tipps & Tricks


The create button is not enabled

In a cloud system, the create button is only active in the new Custom CDS Views app. The old version cannot be used to create new Custom CDS Views any more.

You can only create custom CDS views in your development system. In the productive system (as well as in the test system in a 3 system landscape), the Custom CDS Views app is in a pure display mode.

In on premise (and private cloud) systems, the system has to be configured correctly as extensibility system. The most prominent configuration problems are
1) missing ATO setup – see ATO Configuration and SAP Note 2283716
2) missing authorisations – see Custom CDS Views authorisations

Back to top


Where can I find release news?

We try to publish blog posts for each new release of the Custom CDS Views app.
Here is the most recent one for SAP S/4HANA Cloud: 2208.

For SAP S/4HANA On Premise, there are no separate What’s new blog posts, but the delta always consists of the respective cloud updates. For S/4HANA 2022, these are 2208, 2202 and 2111.

For older releases or to get an overview on all blog posts on the Custom CDS Views app, you may just want to search for the tag F1866A (and F1866). These are the Fiori IDs of the new (and the old) Custom CDS Views app.

Back to top


I cannot see the old Custom CDS Views app any more. How can I get it back?

If you joined after 2202, you already started out with only having “the new” Custom CDS Views app. In this case, this question is not relevant for you.

For all others: The old app is included in a catalog that was deprecated. The catalog was therefore also removed from the template role. If you did not copy the template role, but used the template role directly for your business users, the old app will not be visible any longer. If you still need the old app e.g., to display your custom CDS views that you did not migrate yet, you can get it back by assigning the deprecated business catalog SAP_CORE_BC_EXT to your own business role.

Back to top


I cannot choose the data source XYZ as primary or associated data source

SAP Data sources have to be explicitly released and marked as suitable for modelling so that they can be used in the Custom CDS Views app.

Data sources that are not marked as modelling data sources, will initially be filtered out by the Custom CDS views app. You can remove the filter “suitable data source” in the data source selection dialog and still choose this data source at your own risk.

Data sources that are not released at all by SAP cannot be chosen. If you are missing a data source or feel that a data source should be released by SAP, you can request this via ticket at the application component that provides the data sources. A good place to start investigations on data sources is the View Browser app, which also displays more details on unreleased data sources.

Some scenarios do also have stricter rules on the data sources that can be used or on how its data sources are allowed to be used. This will be specified in the documentation of the scenario. Prominent examples are:

  • Custom CDS Views with the OData scenario cannot be used as associated or primary data sources in other custom CDS views at all.
  • Custom CDS Views of the scenario Cube cannot have CDS views of type dimension as primary data source.

Back to top


Where is the preview for SAP data sources in the new Custom CDS Views app?

The old custom CDS views app had a preview not only for the custom CDS views, but also for released SAP views. This functionality is still available in the old app, but it will move to the Customer Data Browser app in the mid term that is be specialised in previewing data sources and also provides advanced preview functionality like filtering or sorting.

The Customer Data Browser app will also be integrated with the new Custom CDS Views app as well as with the View Browser app soon, so you will not lose this functionality when the old Custom CDS Views app will be removed.

For the time being, previewing is still possible in the old Custom CDS Views app although it is deprecated.

Apart from that, all customers that do already have the three system landscape with developer extensibility can as well use the ABAP development tools (ADT) for previewing CDS views.

This is also covered in the blog post on the new Custom CDS Views app.

Back to top


What are the differences between CDS views in the developer extensibility and Custom CDS Views in the key user extensibility?

the Custom CDS Views app creates ABAP CDS Views as well. The main differences are the targeted personas (developer vs. key user) and therefore the different approaches:

The Custom CDS Views app is aimed at Key Users and typical, predefined, light-weighted business use-cases, the so called scenarios (e.g. building an External API, Cube, etc.). Therefore it takes a form based, guided and scenario centric approach. The app has advanced, scenario specific rules, checks and automatisms that ease the workflow, guide the user and finally generate ABAP CDS source code for him.

With the ADT based tools of the developer extensibility, a developer can freely write his own ABAP CDS source code (apart from other extensibility options) with all available freedom, that the CDS language provides. This is recommended, if the scenario is not supported in the key user tools and if the project is more of the nature of a development project (scope, complexity, requirements).

ABAP CDS is a data modelling language that is extended with semantic parts in the form of annotations. Therefore it is not possible in the scope of this FAQ, to name all the options it has. Nevertheless, here are some prominent examples of the possibilities that will only work in developer extensibility, not in the Custom CDS views app:

  • Freely define own access protections (DCLs)
  • Freely define unions or explicit joins
  • Defining group by & aggregations or hierarchies
  • Doing incompatible changes (e.g. for refactoring purposes)

 

Back to top


My custom CDS view with the scenario External API has poor performance

You may have used a very complex or large CDS view as a data source that is not suitable or not intended to be used as an API. Check if you can find a more basic CDS view as a data source instead. You should only use data sources that are marked as modelling data source. Apart from that, advanced criteria can be checked in the View Browser app. Good indicators are

  • the View Type (“Basic” is ideal)
  • the complexity (ObjectModel.usageType.serviceQuality #A or #B are fine)
  • additionally, you can also check the size (ObjectModel.usageType.sizeCategory)

If you need to use a large data source, you should use filtering to improve the performance. Be aware that you do not filter on calculated fields though as this might have a negative impact on the performance again.

Filtering can be done in the custom CDS views app itself on the filter tab or in the consumption of your OData service using $top and $skip.

Please also note in this context, that the external API scenario is not intended for data extraction.

For further information, see the External API documentation.

Back to top


Multiple Views appear to be transported even only one was changed.

The behaviour is expected whenever SAP did changes to the access protection of the underlying SAP view of that you have used in your Custom CDS View.

When a new Custom CDFS View is published for the first time, it inherits its access protection from its primary data source. When the access protection of the underlying view is updated later on, the access protection of the Custom CDS View may need to be refreshed as well. This results in a rework task for the Custom CDS View.

When you now publish this view, the access protection gets updated and the rework task will be resolved. If you built several views on top, all of the depending views will be refreshed (and therefore published) as well for consistency reasons.

All changed views will appear in the log of the Custom CDS View that you changed (and where you started the publishing process).

You can find more details in the corresponding What’s new in 2105 blog post.

Back to top


I have parameters in my external API Custom CDS view. How can I fill them?

When calling the OData service, make sure to enter the parameters in the URL using the following schema:
https://[base url]/sap/opu/odata/sap/[custom CDS view name]_CDS/[custom CDS view name]([parameter name 1]='[parameter value]’,[timestamp based parameter name]=datetime'[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]’)/Results

Back to top


How can I find suitable data sources for my purpose?

With SAP S/4HANA Cloud, the tools of choice for getting information on CDS views and data sources are the View Browser app inside your system as well as the API Business Hub that is externally available on the web.

The View Browser app lists CDS views in your system with structural details like their elements, labels and annotations as well as relationships to other CDS views.

The view browser can also be navigated to from the Custom CDS Views app and gives you additional valuable details like the type, size as well as complexity information.

Indicators for suitable data sources are

  • the View Type (“Basic” is ideal)
  • ObjectModel.usageType.serviceQuality for the complexity (#A or #B are fine)
  • additionally, you can also check the expected size (ObjectModel.usageType.sizeCategory)

The API Business Hub helps you to explore integration or extension possibilities of SAP solutions and also has the option to list released SAP CDS views with details on the capabilities and a field search.

Back to top


I get wrong or duplicate results in my CDS view. How can I avoid this?

Usually, an unexpected result set is based on modelling mistakes when using multiple data sources. To find out where the duplicate data comes from, check all the fields of your custom CDS view, that do not originate directly from your primary data source. Either you have chosen a field from an association that is not of cardinality *..1 or you selected a field from a data source that you defined an association to and did not map all the key fields of the target data source in the association definition.

There is also a blog post about how to deal with multiple data sources and another one that helps you identifying the root cause in case of such a problem.

Back to top


I want to introduce a counter. How can I do this?

If you want to introduce a counter that shall be aggregated as a sum in the runtime of an analytical query or in an external API, you need to:
First add a calculated field (on the elements tab) with the value “cast(1 as ABAP.INT4)”,
Then give it an according aggregation “sum” (element properties tab).
The cast function makes sure that the data type INT4 is enforced. When you use a plain “1” instead, the data type would be the smallest possible ending up with a byte. As a result you will not be able to count beyond 255. Even worse, if the numbers become larger you might end up with errors or even dumps. So make sure you use a cast function and pick a data type that is large enough.

Back to top

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nausheen Minaz Abdul Hameed
      Nausheen Minaz Abdul Hameed

      Very helpful blog. Thanks, Andreas!

      Author's profile photo Andrew Saunders
      Andrew Saunders

      Thank you for this Andreas!

      If I can add another question: If I am in an application and see a field I'd like to grab via a CDS view - how can I go about finding that? (for example in Create Sales Order - VA01 - there's a header field for Delivery Plant)

      So I guess it involves a) Identifying the name of the field, then b) Seeing what CDS views include that field, and c) Previewing values of the field i've identified as easily as possible
      In on-prem we could F4 - get the field name, then look at the table. How to do I find similar information via CDS views in SAP S/4HANA Cloud?

      Author's profile photo Andreas Riehl
      Andreas Riehl
      Blog Post Author

      Hi Andrew,

      The usual procedure for the key user follows the same steps that you mentioned:

      1) Identify a suitable data source that contains the field in question: I added a question as well as an answer for that above now. The search should go over the label in case of an UI field and the tool for that would be the View Browser app or the API Hub.

      2) Preview the identified data source in order to verify: Previewing is not yet fully supported by the view browser, but this is the goal in the end. There is also a dedicated preview app planned. Until this is in place, the old Custom CDS Views app can be used as a workaround. I extended the question on that above as well.

      Technically, you can also try to use the developer tools in your browser and check the OData service that is called. This will give you an idea of the fields and data sources that are used in a Fiori UI. Usually, the "entity name" in the OData resembles the CDS view name. On the other hand this CDS view is then a consumption view and therefore not released. So you will have to use the view browser from there to drill down to the released data source again. Nevertheless this procedure is rather for the expert or developer than for a key user.

      Best Regards,
      Andreas

      Author's profile photo Prasanth Padmanabhan Menon
      Prasanth Padmanabhan Menon

      Excellent Blog Andreas. This answers a lot of FAQ's