Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
AndreaUS
Product and Topic Expert
Product and Topic Expert

With ABAP release 7.55, a new type of CDS view is available: in official terminology, it's called CDS view entity. And it has come to replace the "classic" CDS DDIC-based views that have been around for years.


This blog post provides the following information:

  1. Motivation: why has SAP developed a new type of CDS view?
  2. Key differences between DDIC-based views and CDS view entities
  3. Outlook: transition from DDIC-based views to CDS view entities

Motivation: why has SAP developed a new type of CDS view?

A CDS DDIC-based view is defined using the statement DEFINE VIEW. This kind of CDS view was first released with release 7.40, SP05 and it was for many years the only available kind of CDS view.
Since release 7.55, CDS view entities are available. They are defined using the statement DEFINE VIEW ENTITY. They have evolved from CDS DDIC-based views, serve the same purpose and have the same structure as their predecessor. But they offer several advantages over the "classic" CDS DDIC-based views, such as the following:

  • No additional ABAP Dictionary view is created on activation.
  • Improved performance during view activation.
  • Optimization and simplification of syntax.
  • Stricter syntax checks indicate problematic situations more explicitly, for example, annotation checks.

Key differences between DDIC-based views and CDS view entities

CDS view entities are a new and improved version of CDS DDIC-based views. Although very similar, CDS view entities are easier to use, and offer many small improvements and enhanced features.
Here are some principal ways in which CDS view entities differ from CDS DDIC-based views:

  • There’s no DDIC view. The annotation @AbapCatalog.sqlViewName is not required and each view has only one name.

Please note that the name of the annotation is a bit misleading. Of course, a view entity has an SQL view on the database, but now the intermediate DDIC view is not needed any more.

  • Fewer annotations are required. For example, client handling takes place implicitly and doesn't require any development effort.
  • Overhauled buffer handling by means of CDS tuning objects offers more flexibility (see Buffering CDS View Entities | SAP Blogs for further details).
  • Overhauled extension concept with CDS view entity extends (EXTEND VIEW ENTITY) offers much faster activation performance, see ABAP Core Data Services: New syntax for extending CDS entities | SAP Blogs for further details.
  • Annotations are checked to ensure that only annotations defined as CDS objects in a CDS annotation definition can be used.
  • Expressions can be nested within each other. Situations that previously required a view stack can now be implemented within a single view.
  • Operand positions, such as the WHERE-clause, allow a greater variety of operands.
  • Some features that haven't been widely used are no longer supported in view entities. Here are some examples (but the list is not exhaustive):
    • In DDIC-based views it is possible to assign alternative element names to elements of a SELECT-list using a name list. CDS view entities don't support name lists.
    • The syntax SELECT * to select all elements from the data source is supported in CDS DDIC-based views, but not in CDS view entities.
    • Domain fixed values in front of literals cannot be defined in CDS view entities.

Additional features, such as typed literals to enhance type safety, and optimized buffer handling, are planned for future releases.
The following example compares a CDS DDIC-based view with a CDS view entity:

CDS DDIC-based viewCDS view entity

@AbapCatalog.sqlViewName: 'DEMO_CDS_JOIN'

@AbapCatalog.compiler.compareFilter: true

@ClientHandling.algorithm: #SESSION_VARIABLE

@AbapCatalog.preserveKey: true

@AccessControl.authorizationCheck: #NOT_ALLOWED 

define view demo_cds_scarr_spfli

  as select from spfli

    join scarr on scarr.carrid = spfli.carrid

{

  key spfli.carrid     as id,

  key scarr.carrname   as carrier,

  key spfli.connid     as flight,

        spfli.cityfrom as departure,

        spfli.cityto   as destination

}




.

.

.

.

@AccessControl.authorizationCheck: #NOT_ALLOWED

define view entity demo_cds_scarr_spfli_2

as select from spfli

      join scarr on scarr.carrid = spfli.carrid

    {

      key spfli.carrid      as id,

      key scarr.carrname    as carrier,

      key spfli.connid      as flight,

             spfli.cityfrom as departure,

             spfli.cityto   as destination

    }

Differences:

  • The view entity doesn't require the annotation @AbapCatalog.sqlViewName.
  • The view entity doesn't require the annotation @AbapCatalog.compiler.compareFilter: true, because the filter is implicitly and automatically compared.
  • The view entity doesn't require the annotation @ClientHandling.algorithm, since client handling takes place implicitly.
  • The view entity doesn't require the annotation @AbapCatalog.preserveKey: true, because there's no ABAP Dictionary view attached to a CDS view entity.
  • The view entity is defined using the statement DEFINE VIEW ENTITY.

For a comprehensive description of CDS view entities, refer to ABAP Keyword Documentation (F1 Help in SAP GUI and ADT).

Outlook: transition from CDS DDIC-based views to CDS view entities

Since ABAP Release 7.56, ABAP Platform 2021, it is possible to migrate existing DDIC-based views to CDS view entities. Details are described in the following blog post: A new generation of CDS views: how to migrate your CDS views to CDS view entities. Migration is voluntary and can be done to benefit from the enhanced functionality of CDS view entities. "Classic" CDS DDIC-based views are supported, but not further developed. For new development scenarios, it is recommended to create only CDS view entities.
Info: SAP will continue to support classic CDS DDIC-based views. CDS DDIC-based views will not be retired, and customers will not be forced to use CDS view entities. SAP protects investments.

Update May 2022: Since ABAP release 7.88, CDS view entities are feature complete. An overview of all new features, improvements, and differences is provided in the blog series CDS view entities are feature complete. Overview of new features, improvements, and differences | SA....

Further information:

 

83 Comments
SyambabuAllu
Contributor
Hi Andrea,

much awaited info.Thanks for sharing info.

Thank you,

Syam
I079659
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thanks Andrea, One thing which i want to clarify "Nested Expressions", will it includes Subqueries also?
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Tarun, no, subqueries are not supported in view entities and they are currently not planned.

"Nested expressions" rather refers to, for example:

  • within an arithmetic expression, a cast expression, case expression, aggregate expression or built-in function can be used (DDIC-based views don't offer the full range).


Same for aggregate expressions, case, cast, built-in functions, and so on - they all allow other expressions as operands.

Best,

Andrea
0 Kudos
HI Andrea,

Can you throw some light on what would be impact on ODP transient provider? They do require a SQL view with prefix 2C.

Thanks
Vijay
Active Contributor
Nice.. thanks for sharing !!
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Anup,

For CDS view entities, the analytical query name is the name of the view entity with the prefix 2C: 2C<name of CDS view entity in UpperCase>.

As the BW name should not be longer than 30 characters, the CDS view entity name should be less than 28 characters.

There is also the annotation @Analytics.technicalName (String(16)). If this annotation is used in a CDS view entity, then the analytical query will be „2C<technicalName>“.

This annotation should be used especially when converting a CDS DDIC-based view to a CDS view entity and when you want the BW name to stay the same and not change during conversion.

 

Best,

Andrea
0 Kudos
Thanks Andrea!

Does this also imply that (since no SQL view gets generated), CDS view entity cannot be accessed natively in HANA database? There was a note 2511210 in the past mentioning that it "Should Not Be" . But now it appears that it "cannot be".

Anup
davidalvarez2
Explorer
0 Kudos
Hallo andrea,
due to some incompatible changes, it is unlikely that all of the existing views will be migrated

In our SAP CPI-DS project, we are using CDSs to create complex logic. In this way, we release CPI-DS system of making complex calculations that could take more than 15 minutes in CPI-DS (vs seconds in CDS).

However, CPI-DS can only consume the view (database layer).

Should we get worried about it? I am afraid "Unlikely" could mean a lot of things. Removing these views or making mandatory not using them could ruin other parallel projects that cannot call to a CDS directly .

Do you have information about it or who could clarify this point?

Thanks in advance,
David
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Anup,

CDS view entities do also generate a HANA view with the name of the CDS view entity. Hence, it is possible to access a view entity natively on HANA database. However, the same restrictions apply as described in note 2511210.

Best,

Andrea
AndreaUS
Product and Topic Expert
Product and Topic Expert

Hi David,

how do you consume the CDS views? Do you use ABAP SQL? If yes, then you can use the CDS view entity directly, and not the DDIC view.

Does that help?

Best,

Andrea

davidalvarez2
Explorer
0 Kudos
Hi Andrea,

I am afraid SAP CPI-DS is not the best ETL tool in the market (but it's SAP recommendation when working with IBP).

It is only able to "see" tables or views at database level when connecting to a backend system. That means CDSs does not appear as a source object. However, we link the CDS view in CPI-DS and this is how we are working: generating complex SELECTs in CDS and linking them to CPI-DS through its view.

Our concern is:

  • If these new CDS view entity is going to replace completely classic CDS or they are going to coexist

  • No option to continue creation of classic CDSs once new CDS view entity is available 


Please, we are not asking for a work around. We need just confirmation of the roadmap to know if we need to change our way of work.

Thanks in advance,
David
AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi David,

The classic, DDIC-based CDS views will still be supported. It is not planned to deprecate them. Both types of views will coexist.

You as owner of the view can decide whether you want to migrate your existing views to view entities or not. There won't be any automatic conversion.

You can continue creating classic CDS view, even when CDS view entities are available. SAP only recommends to switch to view entities, because once they are feature complete, they are easier to work with and offer more options.

Best,

Andrea
avinashd_m
Participant
0 Kudos
Hi ,

 

Is it possible to extend the CDS Entity like we have for old CDS View?

 

Thanks and regards,

Avinash
AndreaUS
Product and Topic Expert
Product and Topic Expert

Hi Avinash,

Yes, it is possible to extend CDS view entities in the same way as CDS DDIC-based views.

Some details:

  • A boundary condition has been removed: an extend for a CDS view entity can contain only new associations. It is not required (as for the old CDS views) to include at least one field in an extension.
  • View extensions are possible with EXTEND VIEW and there's also the new statement EXTEND VIEW ENTITY. View extends created with EXTEND VIEW ENTITY don't create a DDIC view append and they have all the advantages of the new view entities, such as faster activation.

Best,

Andrea

0 Kudos
Hi aschlott

i have few queries regarding the new CDS Entity-

our system is on SAP Latest 2020

is there a way i display the DDL Source in SAP SE11 directly other than by DDL SQL View?

i see VIEW for this object in DDLDEPENDENCY


 

 

if you see there is an abap view for this


 


is there a way i can access this directly without going to view


i am able to access SQL View directly in abap as shown below


 

its also giving me data if i give cds entity as shown below


 

why is this throwing an error when i declare lt_Table as cds view and trying to access data from the same cds entity ? cds view and cds entity are related by 1:1 right, why is this discrepancy. please clarify


thanks

San
AndreaUS
Product and Topic Expert
Product and Topic Expert

Hi San,

For CDS views and CDS view entities, it is recommended to work in ABAP Development tools (ADT). Otherwise, please use transaction sddlar to display your CDS views and CDS view entities. For CDS views, you can use the view name directly, no need to use the SQL view name.

SE11 has limitations: views (classic views as well as CDS view entities) can only be displayed when their name has no more than 16 characters.
Moreover, it is not recommended to access a DDL source in SE11 using the SQL view (warning message).

Regarding your second question: The SQL view can contain an additional client field and therefore, an error message is returned. You can avoid it by using same name (either SQL view name OR DDL source name) for typing and after FROM.

You can also use an inline declaration, such as the following:

Hope this helps. If not, please contact me again.

Best,

Andrea

 

 

dmajumd
Newcomer
0 Kudos
Hi Andrea,

Nice blog!

Need some guidance in the light of CDS root view entity.

We are in S4 HANA 1909 SP02 on-prem version hosted on HEC. SAP_ABA is on 75E. SAP_BASIS is on 754.  Still, it is not giving an option to create CDS view entity. After upgrading the Eclipse version 2020-09, ADT, I somehow managed to get the CDS view entity option. However, when I am using the following code snippet to activate it, I am getting the error as 'Keyword Entity not Allowed'.

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'View '
define root view  entity Y_RPA_002
as select from  yraptesttable
{
key sonumber,
creationdate,
customer
}


I am following the below blog:

https://blogs.sap.com/2019/10/25/getting-started-with-the-abap-restful-programming-model/

My questions are :

  1. In the version provided above, thought we are in ABA 75E, would we be able to get onboarded with the RAP model provided above ? If not, can we use CDS view to serve the purpose ?

  2. Any clue why are we getting the error 'Keyword Entity not allowed' ?


Thanks for your help!
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Diptarup,


CDS view entities are available since S4HANA 2005, on premise release 7.55. To work with CDS view entities, it is necessary to update your system. But RAP works also with classic CDS views.




Hope this answers your question.


Best,

Andrea
harishbokkasam1
Employee
Employee
0 Kudos
Hallo Diptarup,

As Andrea mentioned, you can build RAP BO with classic CDS views..define CDS view syntax

Greetings,

Harish B
sebastien_phan
Employee
Employee
0 Kudos
Hi Andrea!

 

I just created my first CDS entity view. We had for regular cds view the tool "dependency  analyzer" in abap in eclipse. Now, If I try to use this tool, it says "dependency analyzer only support cds view"

 

I use abap in eclipse Version: 3.15.0.

 

Is there a similar tool for this?

Alternate question: for HANA studio, we could query the CDS view by using the DDIC name in the select. For entity view, there are no ddic. Would it be possible as well?

 

Best regards,

 

Sebastien
AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Sebastien,

dependency analyzer is currently not available for CDS view entities. Development is working on it, hopefully it will be available soon. There's no alternative tool, unfortunately.

CDS view entities can be accessed in HANA Studio by their DDLS name (same as the entity name). Like for classic DDIC-based views, it might be required to specify the schema.

Best,

Andrea
0 Kudos

hi Andrea,

It's a while since we've got view entities at our disposal and to most case I found them fully functional. However recently I accidentally faced restriction to migrate CDS which includes $session in the conditional expression:

case when ( UserRole.ValidFromDate <= $session.system_date and
UserRole.ValidToDate >= $session.system_date ) then 'X' else '' end as IsValid,

The original DDIC-base CDS was fully functional, same syntax with view entity results in the error message: "Expression type SESSION_VAR_EXPR not allowed in expression context COMPARISON, clause type COMP_RIGHT".

I was lucky to overcome this case with $parameters, though result is not as elegant as originally and generally this was unexpected obstacle for migration from legacy.

So my question would be - is there any reference of the restrictions (not supported syntax, pending features) associated to new view entities?

 

Thank you in advance.

Mirosław

 

AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Mirosław,

your conditional expression should work in CDS view entities. I've tested it and tried to reproduce the error, but in my example, there is no error message.

The topic about CASE WHEN in the ABAP Keyword Documentation lists all possible operands and it says the the right side of CASE WHEN can be a session variable.

So this looks like a bug, please open an incident to component BC-DWB-DIC if you would like this to be further investigated.

The ABAP Keyword Documentation (F1 Help) describes all supported syntax and all restrictions compared to CDS DDIC-based views. That's the only externally  available source.

Best,

Andrea
0 Kudos
Thank you for quick answer! 🙂 Will follow as you advise.
kyo_choi2
Participant
0 Kudos
I am getting same message for ABAP version 7.5E.  Is this lower than 7.55?
AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Kyo Choi,

yes indeed. SAP_ABA 7.5E is ABAP Platform Release 1909 (see ABAP Platform – Part 1 – Evolution from SAP Netweaver | SAP Blogs) and 7.55 is ABAP Platform Release 2020 (see ABAP Keyword Documentation (sap.com)).

Best,

Andrea
kyo_choi2
Participant
0 Kudos
On BO Project View, "entity" worked fine.  Not sure why CDS view has issue.  BTW. I am using the developer edition 1909.

 

AndreaUS
Product and Topic Expert
Product and Topic Expert
CDS projection views have been available since ABAP release 7.76, which is the same as ABAP Platform clout 1905. In on-premise, they have been available since S/4HANA 1909.

See New type of CDS entity available: CDS projection views | SAP Blogs.

shil123
Participant
0 Kudos
Hi aschlott, this blog is really helpful, and even I have used this cds view entities in web ide and I am using s/4 hana databse for the same, but can we implement variant using this cds view entity?

AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Shilpa R,

as far as I know, implementing variants is not possible using CDS annotations.

For further questions, please open a BCP incident on component BC-ESI-ESF-GW.

Best,

Andrea

 
shil123
Participant
0 Kudos
Ok thank you so much for your reply aschlott
amit_kumar100
Explorer
0 Kudos
Hi Andrea,

 

I tried to go through the given blog or help page you mentioned above but not sure how to co-relate ABAP release 7.55 with ABAP platform 1809,1909, 2020 etc or SAP_ABA 7.5D, E, F etc? if you could help us understanding this connection and where do we see ABAP release 7.55 etc in the system?

 

Thanks,

Amit Kumar
amit_kumar100
Explorer
0 Kudos
Hi Andrea,

 

I tried to go through the given blog or help page you mentioned above but not sure how to co-relate ABAP release 7.55 with ABAP platform 1809,1909, 2020 etc or SAP_ABA 7.5D, E, F etc? if you could help us understanding this connection and where do we see ABAP release 7.55 etc in the system?

 

Thanks,

Amit Kumar
AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Amit,

The on-premise docu on SAP Help Portal contains a table that maps ABAP releases to ABAP Platform releases, SAP S/4HANA on premise releases and kernel releases: ABAP Keyword Documentation (sap.com) 


Regarding your second question:

  • do you mean where you can see the ABAP release information in your system? You find this information under System > Status > section SAP System Data > Product Version > tab Installed Product Version.

  • are you looking for a version history of the ABAP Keyword Documentation? Here's the URL to a specific version: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm. Just replace "755" with the version you would like to see.

  • to see a different version of the documentation in your system, the only way I know is to log on to a corresponding system.


Best

Andrea
amit_kumar100
Explorer
0 Kudos
Thanks for the details.

Regarding the second point, yes...I meant to ask ABAP release information in the system- I see only S4HANA release (Not the ABAP release 7.55). Here is the screenshot of what I see if I follow the steps System > Status > section SAP System Data > Product Version > tab Installed Product Version.


Tab Installed Product Version


 

I was hoping to see ABAP release 7.55 somewhere directly in the system. But mapping table you provided (via help link) is also fine. Thanks!
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Maybe check tab Installed Software Component Versions. I find the required information there:


 
shil123
Participant
0 Kudos
Hi aschlott,

I wanted to make name field as non editable inside the object page in my capm project



 

How can I achieve using CAP annotations?
AndreaUS
Product and Topic Expert
Product and Topic Expert
Hi Shilpa R,

thanks for your message.

Unfortunately, I can't answer this question. My area of expertise is ABAP Core Data Services, basis development. This question seems to be related to a specific application and to UI design. UI annotations are not part of basis development.

Please check the corresponding product documentation.

Best

Andrea
shil123
Participant
0 Kudos
Hi aschlott Thank you so much for your reply
virenp_devi
Contributor
0 Kudos
Hello Andrea,

 

During migration will SAP keep name of the SAP provided extraction enabled CDS's views same? Or  names will change ?

Thank you.

 
AndreaUS
Product and Topic Expert
Product and Topic Expert

Hi Viren Devi,

the name stays the same during the migration. As a precondition for the migration, the name of the DDLS source and of the CDS entity must be identical. The newly generated view entity has the name of this CDS entity on the database.

The name of the DDIC view is dropped during the migration. Currently, it is not recommended to reuse the name of the DDIC view of a migrated view for another CDS object.

Documentation regarding the migration will be released soon.

Best

Andrea

Balu483
Participant
0 Kudos

hi aschlott,

The syntax SELECT * to select all elements from the data source is supported in CDS DDIC-based views, but not in CDS view entities

we have S4HANA1909 so can't test above statement perhaps i just wanted to cross check if my understanding is correct or not.

as per the above statement if i want to use all the fields from CDS view entity then i have to mention all the fields separately like below?

SELECT  Field1,

Field 2,

Field 3,....

FROM <CDS ENTITY NAME>

INTO TABLE ........

 

rather than

SELECT *

FROM   <CDS ENTITY NAME>

INTO TABLE ........

Regards,

B@lu.

AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi B@lu,

 

yes, exactly, your understanding is correct.

SELECT * is not supported in CDS view entities. You need to formulate an explicit element list instead, like in your example above.

Further differences between CDS views and CDS view entities are listed in this blog post about migration from CDS view to CDS view entity.

Best,

Andrea
rajesh_paruchuru
Active Participant
Hi Andrea - we are on OP 2020 FPS 01 and running into syntax error(maximum data type can't be determined) while returning a quantity field from a searched case statement, can you please let us know if its a known limitation?

 


cds_code


 

Thank you

-Rajesh
AndreaUS
Product and Topic Expert
Product and Topic Expert

Hi Rajesh,

this is a known limitation. There was a very limited support for currencies and quantities in expressions with the first delivery. With Release 7.57, OP 2022, new currency and quantity handling has been introduced and it works since then.

Documentation is available here:

Best

Andrea

lauraquinterosa
Participant
0 Kudos
Hi miroslaw_grygolec , aschlott

Did you get a resolution for this?

I'm facing the same issue in my S/4H 2020 OnPrem system and can't find any OSS notes related to this. Below are the system details:


S4H 2020 OP Product Versions



S4H 2020 OP Software Component Versions


 

As per the documentation this should work in a CDS view entity but I'm getting the same exception you were getting:

"Expression type SESSION_VAR_EXPR not allowed in expression context COMPARISON, clause type COMP_RIGHT".

 

My conditional expression is as follows -

case
when datbi <= $session.system_date
then 1 // Expired (Red)
else 0 // Valid (Grey)
end as ValidToCriticality,

 

Thanks and regards,

Laura
MEffinger
Newcomer
0 Kudos
Hi Andrea,

just wanted to check the status of delivering the Dependency Analyzer for CDS View Entities. Any news when this will be available?

thanks

Martin
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Martin, Dependency Analyzer is not yet available, but delivery is already planned. I will write a new reply here once it's available.

More specific communication about planned features is not possible.

Best

Andrea
soren_hansen
Explorer
0 Kudos
Hello Andrea

 

Thank you for the blog. I have, with great thanks, embraced the new syntax, with challenges here and there. Now I have a question. I've created a CDS view with @ANALYTICAL.QUERY: TRUE. A co-worker of my have done the same but using the old CREATE VIEW - Both queries show up and can be used in RSRT, but only the query/CDS with the DDIC view shows up in the "Query Browser" app. Are there any limitations in the analytical usage of the CREATE ENTITY VIEW syntax? Best regards Søren Hansen, Denmark
AndreaUS
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Søren,

I checked with the dev team, they told me: Query browser app supports both CDS views and CDS view entities. There are no known limitations in the analytical usage of view entities.

Could you provide an example of which is not supported in query browser app?

This might be a bug and you might open a ticket on BC-DWB-DIC.

Best

Andrea