CDS Annotations for – New And Experienced professionals- 3
There are many SAP blogs out there that explains inner working of CDS views or core data services in SAP’s S/4 boxes. But there are still struggle among experienced professionals who is switching from ECC system to S/4.
This blog is dedicated towards experienced professionals working on ECC systems for many years and yet to jump to S/4.In the next few min, we will look at a very basic concept of a CDS view and try to evaluate inner working of the CDS using classic SAP tools.
You have read / understood / Prototype items on Previous blogs.
Lets Start –
At this point you have understood CDS views a little better. Just to recap CDS views are not a single object but an Entity consist of a SQL view and a Data Definition.
While creating our first CDS view we didn’t change the annotations written on top of CDS views.
The annotations are always start with “@” and there are few several pre-defined annotations.
What are CDS annotations?
Annotations are properties of a CDS entity. A way to enrich the CDS entity. These annotations are evaluated at the run time to decide the behaviour of a CDS entity.
Lets try to decode some Header Annotations –
@AbapCatalog.sqlViewName: ‘ZVSQL_TRAVEL’ – Defines the SQL View name for the CDS entity.
@AbapCatalog.compiler.compareFilter: true – CDS view specifies how filter condition (Where condition) is evaluated at run time.
@AbapCatalog.preserveKey: true –
Specifies the definition of the key fields in the CDS database view of the CDS view. (Whether to use keys defined in the original data base table or the one defined in CDS views).
@AccessControl.authorizationCheck: #CHECK –
Authorization check for CDS. Defines the implicit access control when Open SQL is used to access the CDS view.
@EndUserText.label: ‘CDS View for Travel Data’-
Description of the CDS view for end users.
Common Questions related to Annotations-
- Is CDS Annotations a way to manage technical settings in SE11 and buffering?
- Answer: Annotations are a way to control technical settings, buffering as those are also properties of data dictionary object in S/4. But Annotations are way more there are several other properties that annotations can control.
- Where can I see all SAP annotations for my current S/4 level?
- Answer: SAP Annotations are available in help document I have added as a reference to this blog but also you can search annotation using SE16 from table – ABDOC_CDS_ANNOS. Remember in this table you will see different kind of annotations, not only related to ABAP CDS but others please refer to the references for more just to give a little bit of more understanding see the categories as below.
- Analytics Annotations
- AnalyticsDetails Annotations
- Consumption Annotations
- DefaultAggregation Annotations
- EnterpriseSearch Annotations
- Hierarchy Annotations
- ObjectModel Annotations
- OData Annotations
- Search Annotations
- Semantics Annotations
- UI Annotations
- VDM Annotations
- Important Tip – Take a look at table – CDSVIEWANNOPOS all the annotations related to a CDS view can be found here. Also check CDS* in SE16 for other CDS views in your S/4 system.
Lets us add @AbapCatalog.buffering then press “.” to look at further options or hit CTRL+SPACE from eclipse.
select status: #swtiched_off.
Let us try to change the property of the buffering status from switched off to something else. You can only allow pre-defined values for buffering status so check the reference ABAP Keyword Documentation (sap.com) you will notice the different values are explained by SAP. Also you can remove the #SWITCHED_OFF and use CTRL+SPACE to find applicable values.
In this case we choose -@AbapCatalog.buffering.status: #ACTIVE
When you add the buffering type active and try to activate you might get an error. requesting to specify a buffering type.
Lets us also add a buffering type.
Now lets look at the SQL view technical settings after this change. You would notice the buffering is activated and fully buffered.
Remember not all annotations around CDS entity is visible in SE11 or SE12 as many of these properties are at data base level. Lets add another Annotation against Data Aging.
Defines the handling of obsolete data on a SAP HANA database when Open SQL is used to access the CDS view – If we set this to True then open SQL will read all data and can lead to performance problems if the database is really old and huge.
Where as if you set this to false then Open SQL will read only current data.
Annotations are properties of CDS entity that allows us to pre-define behaviour of the CDS entity at runtime. Congratulations now you know Annotations. Keep learning.
See you in the next blog – CDS in Real life requirements – New And Experienced professionals- 4 | SAP Blogs
All About – CDS Annotations (sap.com)
ABAP CDS Annotations – ABAP Keyword Documentation (sap.com)
Examples – ABAP Keyword Documentation (sap.com)
CDS Annotation Grouping – ABAP Keyword Documentation (sap.com)