Technical Articles
CDS view entities are feature complete, Part lll: Differences
Since ABAP release 7.88, SAP BTP ABAP Environment 2205, CDS view entities are feature complete. In this blog series, you find a complete list of new features, improvements, and differences of CDS view entities compared to CDS DDIC-based views.
Part lll: Differences
Part lll: Differences
- Features and syntax not supported in CDS view entities
- Differences in header annotations
- New syntax requirements
1. Features and syntax not supported in CDS view entities
The following features and syntax elements are supported in CDS DDIC-based views, but not in CDS view entities:
- The built-in function DECIMAL_SHIFT is not supported in CDS view entities.
- Post element annotations, using the syntax @<anno, are not supported. Element annotations must be specified before the element in a CDS view entity.
Example: The following post annotation is valid in a CDS DDIC-based view, but not in a CDS view entity.
...
element
@<EndUserText.label: 'anno',
next_element,
...
- The syntax $EXTENSION.* is not supported in CDS view entities.
- SELECT * to select all elements from a data source is not supported in CDS view entities.
- Name lists are not supported in CDS view entities.
- @Semantics.currencyCode and @Semantics.unitOfMeasure are not required and not supported in CDS view entities.
- Parameters can be accessed only via $parameters.pname in a CDS view entity. Using the syntax :pname to access a parameter is not supported.
- Domain fix values as literal prefix are not supported in CDS view entities.
2. Differences in header annotations
The following header annotations are supported in CDS DDIC-based views, but not in CDS view entities:
- @AbapCatalog.sqlViewName: CDS view entities do not have a DDIC view attached.
- @AbapCatalog.sqlViewAppendName: CDS view entities do not have a DDIC view attached.
- @Client.Dependent: Client handling is done automatically and implicitly in CDS view entities.
- @AbapCatalog.buffering.status: Entity buffering works via CDS tuning objects in CDS view entities.
- @AbapCatalog.buffering.type: Entity buffering works via CDS tuning objects in CDS view entities.
- @AbapCatalog.buffering.numberOfKeyFields: Entity buffering works via CDS tuning objects in CDS view entities.
- @AbapCatalog.compiler.compareFilter: In CDS view entities, the filter is implicitly and automatically compared.
- @AbapCatalog.dbHints: In CDS view entities, this annotation was replaced by the framework-specific annotation @Consumption.dbHints.
- @AbapCatalog.preserveKey: This annotation serves the definition of key fields of the CDS-managed DDIC view in CDS DDIC-based views. Since there is no CDS-managed DDIC view in CDS view entities, it is obsolete here.
3. New syntax requirements
The following syntax elements have been reworked or stricter checks have been introduced:
- Prefixing: if a CDS view entity selects data from more than one data source (by means of a join or an association), each single element in the SELECT list must have a source prefix. Otherwise, a syntax check error occurs. Each element must be uniquely identifiable to avoid later inconsistencies, for example in an extension scenario.
- Average function: The average function has the following syntax in a CDS view entity:
AVG( [DISTINCT] operand AS dtype )
In a CDS DDIC-based view, the addition AS dtype is optional. In a CDS view entity, it is mandatory.
- The DDLS name and the STOB name must be identical: In a CDS DDIC-based views, the name of the DDL source and the name after the DEFINE VIEW statement may be different. In a CDS view entity, they must be identical.
- In a CDS view entity, the annotation @Semantics.amount.currencyCode is mandatory for elements of data type CURR. The annotation @Semantics.quantity.unitOfMeasure is mandatory for elements of data type QUAN. In a CDS DDIC-based view, both annotations are optional.
- Alias names must be specified using AS. AS must not be left out.
- The annotation @Metadata.ignorePropagatedAnnotations: true is mandatory in union views.
- In a union view, the key elements of all SELECT lists must match. Otherwise, a syntax check error occurs.
- In a union view, element annotations are allowed only in the SELECT list of the first SELECT statement. In all subsequent branches, element annotations are forbidden.
Further information
Migration: A new generation of CDS views: how to migrate your CDS views to CDS view entities | SAP Blogs
A new generation of CDS views: CDS view entities | SAP Blogs
ABAP Keyword Documentation: ABAP CDS – View Entities
Thanks for the info, very interesting!
How is the availability in the customer world (S/4 on premise)? I think I saw somewhere that Basis 7.56 (S/4 Release 2021) corresponds to 7.87?
Hi,
CDS view entities have been available since 7.55, which corresponds to ABAP Platform 2020, kernel release 7.81, S4HANA 2005. In this first release, not all features are available (the exact scope is documented in the ABAP Keyword Documentation).
ABAP release 7.56 corresponds to 7.85, S/4 2021.
Best
Andrea
Thank you for sharing! This is very helpful.
Hi Andrea,
I have recently started using CDS entity and found a major challenge when associating with existing DDIC based CDS view( while extending standard views ),
If Association with DDIC view is not supported, how to leverage existing DDIC based standard CDS views.
Regards,
Sumit.
Hi Sumit,
you can define an association from a CDS view entity to a CDS DDIC-based view with the name of the CDS entity. The only limitation is that you cannot address the DDIC-based view via its DDIC name.
This works in a view entity:
association of many to one DDIC_based_view on ...
This is not supported in a view entity
association of many to one sqlViewName on ...
You can also wrap a DDIC-based view with a view entity. That means you can define a view entity and in the SELECT FROM clause, use a DDIC-based view. But again, you should address the DDIC-based view via its CDS name, not via the name defined as sqlViewName.
define view entity entity name
as select from DDIC_based_view_name
Hope this helps.
Best regards
Andrea
Hi Andrea,
Thank you so much for your response.
Our intention was to add custom field in Standard CDS based Fiori App.
For this we used extend view and associate with custom CDS view entity association [0..1].
If We use CDS view entity there was an error showing as CDS view entity is not active, but if we use based CDS view, it is working as expected.
I believe this is not supported in CDS view entity yet.
Thanks,
Sumit.
Hi Sumit,
so the scenario is as follows: you want to extend a DDIC-based view with an association to a view entity using the statement EXTEND VIEW.
It works for me in the current release:
To my knowledge, this is supported as of 7.55....