What difference would it make to use CDS View instead of table name in select query?
Sergio Cannelli
SAP Solutions and Innovative Design Specialist| SAP FULL STACK DEVELOPER
In our projects, possibly at the technology or functional user level we are shown data at the table level. In the developments we must evaluate what to use, depending on the scenarios, if we have the profile of analysts my suggestion is to make a data analysis and then decide whether to use table access or CDS View Entities/CDS VIEW, depending on which SAP S/4 system we work in.
CDS View Entities serve as building blocks for your application. They provide a framework for defining and consuming semantically rich data models. This means that you can use CDS, which is an enhancement to SQL, to structure your data as needed. In addition, you can use CDS to enrich your data with metadata through annotations.
CDS view entities support many features that simplify data modeling for the user. For example, users can use expressions to perform calculations and process strings or arithmetic functions. Associations are also possible and replace joins with simple path expressions. In addition, CDS view entities automatically make use of code offloading functionality, which means that all calculations are performed at the database layer (rather than at the application layer), resulting in faster data retrieval.
In terms of performance it can offer some improvements, depending on the specific scenario and usage. The advantage is that you can access all associations included in the CDS view. These associations are only built if you actually use them in your ABAP, FIORI, etc.
Both CDS views and standard SQL statements generate at the end the same SELECT statements at DB level.
Personally I have been able to build VDM from CDS views, very complex and with a very good performance, unlike if I want to obtain the same data through access to tables in individual form the performance was not good.
For example, if we talk about analytical applications and API. The VDM in SAP S/4HANA Cloud and SAP S/4HANA is represented by CDS views. The CDS views that make up the VDM follow consistent modeling and naming rules. They expose business data - stored in database tables - in a format that is based on business semantics and therefore easier to consume.
To search for CDS, we can use the TX SDDLAR
Resultado
领英推荐
Comparison of CDS DDIC-Based Views vs. CDS View Entities
The following table shows the difference between CDS view entities and CDS views:
Specific example : I_BUSINESSPARTNER
However, it's essential to note that the performance gains can vary based on the specific use case, database configuration, data volume, and the way the CDS view is implemented. It's recommended to perform performance tests and benchmarks to evaluate the actual impact of using I_BUSINESSPARTNER versus directly querying the BUT000 table in your particular scenario.
In general, using a well-designed and optimized CDS view like I_BUSINESSPARTNER can be considered a good practice as it promotes encapsulation, abstraction, and separation of concerns. It also aligns with the concept of modularization and reusability in software development.
Apart from the use of the TX SDDLAR I share a link to the HELP where we can find all Virtual Data Model and CDS Views by line of business.
SAP BW 7.31/ BW 4 Hana
7 个月I'll keep this in mind