Product Information
CDS view entities – The new CDS views
What is new?
Key terminology:
Core data services (CDS) are the well-established technology to define a semantic data model that is optimized for fast execution on the underlying SAP HANA database. Since the introduction of CDS many features have been added consecutively that offer rich data modeling capabilities.
Presently, creation of a CDS DDIC-based view (DEFINE VIEW) always generates a CDS-managed DDIC view which is the corresponding SQL database view. This was always very tedious as you must create an additional artefact name using annotation @AbapCatalog.sqlViewName: ‘SQL_DATABASE_VIEW’ and is also quite limited from a namespace perspective. In addition, complex view hierarchies can lead to long activation times and are difficult to maintain. To overcome these limitations a new generation of CDS views have been introduced with version 2008.
You probably would like to know, why new CDS view entities are introduced and what are new features and improvements….
CDS view entity without SQL database view and with some of the new features
Why there are new CDS view entities at all?
With the support of “CDS View Entities” some significant optimizations which were not possible with the existing CDS DDIC-based views are delivered. Those optimizations are the following:
Simplified Definition, Consumption & Management of “View Entities”
- There will be only ONE name for CDS View Entities (and not three names anymore). This name defines both the CDS Design-Time Object (Transport object: DDLS), the generated CDS Runtime Object (Transport object: STOB) and the SQL View in HANA
CDS view entity without SQL database view and with some of the new features
Important facts
- There will be two CDS views in parallel (until CDS view entities are fully compatible):
-
- CDS View entities will be new version of the CDS DDIC-based views
- CDS DDIC-based views (to be continued) is the “old” version you were using before
- The “old” CDS DDIC-based view is still available and can be used without any restrictions. You will find all the views you have created and will be able to work with them
- In some cases, due to incompatible changes complete migration may not be possible.
- There will be a possibility to convert your views from the “old” CDS DDIC-based view to the new one in the future.
What are the constraints???
- You cannot create a new CDS view entity with same name as an existing CDS DDIC-based view
- You can convert a CDS DDIC-based view to new CDS view entity by using a new name and delete the existing CDS DDIC-based view
- Currently, you cannot use UNION, case-join in CDS view entity modeling
- Special case:
- Explicit JOINs to CDS entities with only client key field would require
- either a JOIN without an ON clause in the syntax/grammar
- usage of “always true” predicates (1 = 1) as a workaround
What are the improvements???
New Architecture
Improvements to previous “Design decision” and corresponding implementations
Speed & Simplicity
Optimized CDS Activation & performance
- For CDS “View Entities” no CDS-managed DDIC view will be generated anymore but only the CDS Runtime Object (STOB) and the corresponding SQL View in HANA. Consequently, the activation performance on ABAP-level can be significantly improved as only one object (STOB) needs to be created & activated on DDIC level and not two (STOB, VIEW) as in the past
- Keys: instead of having 2 sets of key fields have only a single set of key fields
- The handling of cyclic dependencies could be reworked significantly
What about my existing CDS Views?
- There will be NO automatic (respectively implicit) conversion of existing CDS DDIC-based Views to “CDS View Entities”!
- In order to ease the migration from existing CDS DDIC-based view to the new “CDS View Entities”, dedicated migration support is planned
- But even with this migration support it will be your explicit decision as the owner of a concrete CDS DDIC-based view if you want to migrate to CDS Views Entities
- In order to ease the conversion/migration of existing CDS DDIC-based view to “CDS View Entities”, it will be possible that the “CDS View Entities” and existing CDS DDIC-based views can be arbitrarily nested
- Now, for view entities analytical query name will be 2C<CDS-Viewname in UpperCase>.
- As the BW name should not be longer than 30 characters, CDS-view name should be less than 28 characters.
What’s next?
- The “old” CDS DDIC-based views will not be removed even after a conversion report is available
- General availability of the creation of newCDS View Entities including the support to extend those new CDS View Entities via “CDS View Entity Extends”
- Allow migration of CDS Views that are registered for “Data Source Extensibility”
- In future, the migration of “classic” CDS DDIC-based views to CDS View Entities will eased by dedicated migration tooling
In future releases for “CDS View Entities” the following aspects will be optimized:
- Checks of “Key”-Elements
- Amount/Quantity Handling
- Buffer Handling
- Improved type-safety through type literals
Finally, close remaining functional gaps compared to
“classical” CDS DDIC-based views
you are always welcome to leave comments & ask questions right here!
For more technical information and code snippets,
refer to: Technical article-A new generation of CDS views: CDS view entities
Images: The key terminology table -self and the CDS view entities image -Harish Mehta(SAP)
Here comes the million dollar question.
In the past if someone asked "Are CDS Views faster than SQL statements?" the answer would be - of course not - after all the SQL statement is just generated using the generated DDIC VIEW on the ABAP side.
Will that change now? If there is no DDIC view, will a CDS view be able to take advantage of some native HANA magic?
Second question.
CDS views were database agnostic i.e. you could define a CDS view even if you had an Oracle database. Are these new entities HANA specific?
Hi Paul,
CDS view entities are HANA only.
Due to the new improvements, better support from HANA side is possible.
Regards,
Harish
Just want to clear my understanding - earlier i developed few HANA CDS Views - i see it totally similar - is my understanding correct ?
Thanks,
Shivam
Hi Shivam,
In comaparision with CDS views,there is no change in semantics with regards to CDS view entities. The new view entities provide more possiblilities to integrate new HANA features in ABAP CDS
Gretings,
Harish
Hi Harish,
thanks a lot for the information.
You mentioned, that the feature will be available starting from 2008, so I expect you are referring to the ABAP Environment within the SAP Cloud Platform.
Do you know, if the CDS Entities will also be available in the upcoming On-Premise Release 2020 or do we have to wait until the 2021 On-Premise Release?
Best regards,
Sebastian
Hi Sebastian,
Available with ABAP release 7.55
Greetings,
Harish B
Hi Harish,
Thanks for very detailed and valuable information.
Is it possible to extend the CDS entities like we do for old CDs views?
Thanks and regards,
Avinash
Hi Avinash,
Extends also work with view entities-release 7.55
Even if a CDS view is switched to view entity old extends will continue to work
Greetings,
Harish B
Hi Harish,
Thanks for sharing such an interesting content. I have a doubt which is that I'd like to create a new custom app based on the content of CDHDR and CDPOS DB tables. There is an existing view (old one) called C_ChangeDocuments and was wondering to create a new Projection View or a View Entity but I have not been able to do so (as per what you describe on your blog).
Also, I was not able to define basic new View Entities for both tables so I am trying to understand which is the (new) right approach in order to handle this kind of scenarios?
Thanks and regards.
Alejandro.
Hi Alejandro,
Use of CDHDR and CDPOS is not permitted in cloud systems. Same with the I-View.
It is possible to use the projection view as source for new view entity and expose only the needed fields in field list.
Hope this helps,
Greetings,
Hi Harish,
I am on an OnPremise system. But realized that I am on a version which is prior to 2008 so will work based on DDIC-based view C_ChangeDocuments.
Regards.
Alejandro.
Hi, Harish,
thanks for the explanation of this new concept. This is all good, but this makes a lot more confusion.
Hi Pavel,
You can use view DDCDS_ENTITY_HEADER in your system where vieew entities are allowed.
Then the source type is V for view and W for view entity
Thanks,
Harish B
Hi Harish,
thanks for the beautiful explanation!
One question--> can we use SQL view in reports instead of CDS view, if yes then what is the difference between using CDS view and SQL view at report level?
Gretings,
Harish Bokkasam
Hi,
Requesting to provide more details on below. If possible with example
Thanks,
Sampat
Hi Harish Bokkasam , can we implement variant using this cds annotations?
What would be the procedure to extend "Root Custom Entity".
"EXTEND VIEW ENTITY" doesn't seem to work.
I am just trying to add extra fields in the entity provided by SAP
Hi Harish,
Thanks for the information. I believe the constraints are more than the ones listed in this approach primarily when creating Analytical queries/cubes using these. We recently moved to S/4HANA 2020SP1 (OP) and started exploring CDS View Entities, below are few obstacles we came across:
So overall i think you should get it clarified if CDS Entity can be used for Analytical Queries or we should continue using CDS DDIC based Views instead.
PS: Kindly note i will follow-up with sap support channel as well on these issues but wanted to get this clarified over here as well so that others can learn from our experience as your blog covers limited constraints.
Regards,
Deo
Hi Deo,
Hello Harish Bokkasam,
any more official info on CDS View Entities as Analytical Queries?
Regards
Daniel
Hi Harish, it's quite an old blog but I found myself missing standard CDS entities in the Query Browser app with S/4 2021. I debugged the code and found out the class CL_VDM_CDSVIEW_BROWSER_DPC_EXT is reading the list of analytical CDS from the view QB_CDSVIEWS_QUERY, which only contains DDIC CDS...
S/4 2021 comes with some standard Analytical View Entities that I can't use in the query browser because of this limitation. I tried to find SAP notes to fix this or validate if this will be supported by upgrading to S/4 2022, but I couldn't find any details.
So hopefully you have some feedback.
Regards,
M. Oliveras
Hi Harish,
Earlier we used to get the CDS fieldnames using DD03L table. With CDS entities ,Is there a way to get the fieldnames ?
Thanks,
Lakshmanan
Hi Harish, good article.
I've found ABAP views created using annotation @AbapCatalog.sqlViewName lack full information of fields that have been calculated or derived in the HANA DDL SQL definition.
This becomes apparent when viewing the view under transaction code SE16N or including it on an ALV grid.
Under SE16N a derived field lacks a non-technical field name, or if it has a non-technical field name, this is something like "Char Column" or "Generated Column for", rather than the value prescribed for the field under the annotation @EndUserText.Label.
An ABAP dictionary data element contains three text heading; short, medium and long, which can be associated with a HANA CDS View using the CAST operation and casting the derived field as the data dictionary element. This then shows the Data Dictionary column headings on an ALV grid that is using the view. Without the CAST operation being used, the column on the ALV grid simply has no heading, so in order to get headings the ABAP developer must modify the field catalogue, which is not ideal. Using the cast operation also corrects the non-technical field name to that prescribed in the data dictionary.
One further thing that the data dictionary field headings caters for is language independence, yet I don't see this being handled by the @EndUserText.Label annotation, or am I mistaken?
Are these issues being addressed?
Thanks
Stephen
Hi,
Can we use these new CDS views in AMDP?
Thanks,
Csaba