Search for existing CDS views
This blog was first published at Expertum.net.
Introduction
Thanks to SAP HANA new powerful tools became available for developers to retrieve data from the database: ABAP CDS. With the advent of S4/HANA, 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 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:
Prefix | View Type |
I_ | Basic interface view |
I_ | Composite interface view |
C_ | Consumption view |
R_ | Basic restricted reuse views |
R_ | Composite restricted reuse views |
P_ | Private view |
A_ | Remote API view |
X_ | View extend |
E_ | Extension include view |
F_ | Derivation function |
D_ | Abstract entity |
SAP API Business Hub
You're first resource should be the SAP API Business Hub, which can be used to find CDS views:
The only thing you need is a good search term. For example when looking for (product) characteristics:
The result of the search will be a number of available CDS views. When clicking on a tile, more details are displayed:
ID
: The name of the development object. Notice that the prefix isI_
, 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 S/4HANA Cloud solutions only. At this point in time, it is not clear if the usage is also supported on S/4 HANA on-premise systems. But when searching for some samples on an on-premise S/4 system, they will exists depending on the installed product:
Transaction SDDLAR
If you can't find what your looking for on the SAP API Business Hub, these is a final option: transaction SDDLAR
. This transaction allows you to search in the DDL (Data Definition Language) of the CDS views:
After pressing Analyse
, following input form is shown:
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:
- And at the bottom of each DDL source, the ABAP Catalog View Name and in what other DDL sources this CDS view is used:
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.
Subscribe to my newsletter
Read articles from Stijn Mertens directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by