Skip to Content
Product Information
Author's profile photo Harish Bokkasam

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%20view%20entity%20without%20SQL%20database%20view%20and%20with%20some%20of%20the%20new%20features

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)

Assigned tags

      21 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Paul Hardy
      Paul Hardy

      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?

       

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      Hi Paul,

      CDS view entities are HANA only.

      Due to the new improvements,  better support from HANA side is possible.

      Regards,

      Harish

      Author's profile photo Shivam Shukla
      Shivam Shukla

      Just want to clear my understanding -  earlier i developed few HANA CDS Views -  i see it totally similar -  is my understanding correct ?

       

      Thanks,

      Shivam

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      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

      Author's profile photo Sebastian Freilinger-Huber
      Sebastian Freilinger-Huber

      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

       

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      Hi Sebastian,

      Available with ABAP release 7.55

      Greetings,

      Harish B

      Author's profile photo Avinash D M
      Avinash D M

      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

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      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

      Author's profile photo Alejandro Kinsbrunner
      Alejandro Kinsbrunner

      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.

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      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,

      Author's profile photo Alejandro Kinsbrunner
      Alejandro Kinsbrunner

      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.

      Author's profile photo Pavel Astashonok
      Pavel Astashonok

      Hi, Harish,

      thanks for the explanation of this new concept. This is all good, but this makes a lot more confusion.

      • 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

      Is there any way we can distinguish them from the first sight (e.g.from UI5 side), any system table of all views with a “Type” attribute?

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      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

      Author's profile photo Viren Sharma
      Viren Sharma

      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?

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author
      Hi Viren,
      Use of SQL View in coding is not recommended for follwing reasons:
      1. Migration of View to View Entity will remove the SQL View. During upgrade, inconsistencies may come up.
      2. DCLs are not executed when SQL View is used to fetch the data.

      Gretings,

      Harish Bokkasam

      Author's profile photo Sampat Tandon
      Sampat Tandon

      Hi,

      Requesting to provide more details on below. If possible with example

      • Keys: instead of having 2 sets of key fields have only a single set of key fields

      Thanks,

      Sampat

      Author's profile photo Shilpa R
      Shilpa R

      Hi Harish Bokkasam , can we implement variant using this cds annotations?

      Author's profile photo Sai Reddy
      Sai Reddy

      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

      Author's profile photo Deodutt Dwivedi
      Deodutt Dwivedi

      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:

      1. Basic Semantics Not supported in Query
      2. Exception Aggregation is Not Supported
      3. Unable to release Entities with C1 Contract for external consumption. This means we can only run the Analytical Query in RSRT but not in other reporting tools like SAP Analysis for Office, SAC, Power BI etc.
      4.  The CDS View Entities are not supported in View Browser and Query Browser so even out of the Box reporting options in Fiori are not supported

        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

      Author's profile photo Harish Bokkasam
      Harish Bokkasam
      Blog Post Author

      Hi Deo,

      @Analytics.dataExtraction is supported starting with a future release.
      @annotation @semantics.currencycode.. not supported
      This is a  deliberately implemented check in View Entity.The annotation Semantics.unitOfMeasure (and also @Semantics.currencyCode) can be removed  and does not bring any additional value in our metadata.
      We calculate this information based on the annotation @Semantics.quantity.unitOfMeasure (as an example) where this unit field name is also specified.
      Regarding Query browser, I will follow up with more information.
      thanks,
      Harish B.
      Author's profile photo Lakshmanan Subramanian
      Lakshmanan Subramanian

      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