Search for existing CDS views

Photo of Stijn Mertens

Written by Stijn Mertens in SAP S/4HANA

 

Thanks to SAP HANA new powerful tools became available for developers to retrieve data from the database: ABAP CDS. With the advent of SAP S/4HANA, even more CDS views are now available as standard SAP objects.

For developers, these CDS views are an important resource:

  • A lot of these standard CDS views are exposed via OData services and available for lookup via the SAP API Business Hub. This makes them a great resource for Front-end (UI5/Fiori) developers.
  • ABAP developers can re-use the existing CDS logic in a powerful and modular way. Finding the right CDS view can be dead easy or a challenge...

CDS View Types

In SAP S/4HANA the VDM (virtual data model) forms the basis for data access and consists of CDS views. These views follow consistent modeling and naming rules, for example you'll recognize following prefixes during your search:

CDS views1

SAP API Business Hub

Your first resource should be the SAP API Business Hub, which can be used to find CDS views:

CDS views2

The only thing you need is a good search term. For example when looking for (product) characteristics:

CDS views3

The result of the search will be a number of available CDS views. When clicking on a tile, more details are displayed:

CDS views4
  • ID: The name of the development object. Notice that the prefix is I_, meaning that is an interface view.
  • Supported Capabilities: These are the uses SAP supports for this view.
  • Fields: The fields the CDS view returns.

Remark: all CDS views found on the SAP API Business Hub are all listed in the SAP S/4HANA Cloud solutions only. At this point in time, it is not clear if the usage is also supported on SAP S/4HANA on-premise systems. But when searching for some samples on an on-premise SAP S/4HANA system, they will exists depending on the installed product:

CDS views5

Transaction SDDLAR

If you can't find what you are looking for on the SAP API Business Hub, this is a final option: transaction SDDLAR. This transaction allows you to search in the DDL (Data Definition Language) of the CDS views:

CDS views6

After pressing Analyse, following input form is shown:

CDS views7

Warning: the search may take a while, depending on the performance of the system and your search terms. If all goes well, you'll end up with a list of DDL sources that have the given pattern in their definition.

The output contains:

  • The SAP object definition in the Dictionary, together with the complete CDS view DDL:
CDS views8
  • And at the bottom of each DDL source, the ABAP Catalog View Name and in what other DDL sources this CDS view is used:
CDS views9

Summary

In search for the correct CDS view, always start on the SAP API Business Hub. These are publicly shared and supported by SAP. When building a future/upgrade prove solution, this should be your starting point.

If that is not enough, it can be useful to dive deeper in the system by searching for a CDS view with transaction SDDLAR. But be warned:

  • Don't get lost in the CDS view spaghetti.
  • There is no guarantee at future upgrades.
  • Sometimes the search will feel like looking for a needle in a haystack.

About the author

Photo of Stijn Mertens
Stijn Mertens

Community Lead SAP Development at Expertum Belgium.

Read more articles by Stijn Mertens