Sunday, March 22, 2020

CDS Annotations



                            

                           SAP CDS Annotations

 SAP offers a lot of CDS View annotations.
  • All annotations begin with the @ sign.
  • Annotations allow for specifying ABAP-specific additional information, such as how records of the view should be buffered by the ABAP table buffer, or whether the view is client-dependent or not. Note that, by default, CDS views are considered client-dependent; you do not have to include client fields explicitly in the field list or in the join conditions.
  • Annotations are used to enrich the data models with additional domain-specific metadata, for example, UI, OData, search, and planning. Specialized metadata for these other domains can be added via annotations without impacting or changing the underlying core model. The annotation unknown to a domain will be ignored by the domain-specific engine.
  • Core annotations specify metadata that influences and is relevant for all kind of scenarios.
  • Domain-specific annotations are required for dedicated domains, like hierarchy handling, Analytics, OData, or SAPData.


Kinds of Annotations
• AbapCatalog Annotations
• AccessControl Annotations
• Analytics Annotations
• AnalyticsDetails Annotations
• ClientDependent Annotations
• Consumption Annotations
• DataAging Annotations
• DefaultAggregation Annotations
• EndUserText Annotations
• EnterpriseSearch Annotations
• Environment Annotations
• Hierarchy Annotations
• MappingRole Annotations
• ObjectModel Annotations
• OData Annotations
• Search Annotations                                                                                                   
• SearchIndex Annotations
• Semantics Annotations
• UI Annotations
• VDM Annotations

AbapCatalog Annotations

Define technical settings of CDS entities in the ABAP dictionary.
• AbapCatalog.sqlViewName: Database view in ABAP dictionary that is generated at activation
• AbapCatalog.sqlViewAppendName: Database view for CDS extension
• AbapCatalog.buffering.numberofkeyFields: Number of key elements for buffering generic areas (Default 000)
• AbapCatalog.buffering.status :
  1. #ACTIVE: SAP Buffering active
  2. #SWITCHED_OFF: SAP buffering allowed but not active (Default)
  3. #NOT_ALLOWED: SAP buffering not allowed.
• AbapCatalog.buffering.type:
  1. #SINGLE: Buffering type- single records
  2. #GENERIC: Buffering type- generic area
  3. #FULL: Buffering type- full
  4. #NONE: Buffering type- none (Default)
• AbapCatalog.compiler.compareFilter: (Default: true)
  1. true : the filter conditions of the path expressions of the view are compared. If the same filter condition occurs, the associated join expression is only evaluated once.
  2. false : a separate join expression is created and evaluated for each filter condition.
ClientDependent Annotation
Defines the client handling when Open SQL is used to access a CDS entity
ClientDependent: (Default: true)
true : The CDS view is client-specific. The view fields of the CDS entity do not cover a client
column, from the perspective of an ABAP program. When accessed using SELECT,
automatic client handling is performed.
false : The CDS view is a cross-client view. No automatic client handling is performed.
EndUserText Annotations
Enable an intuitive consumption of the data model in User Interfaces
EndUserText.label:
Defines a human-readable text that is displayed besides input fields or as column headers.
EndUserText.quickInfo:
Defines a human-readable text that provides additional information compared to the label text. The quickInfo element is used for accessibility hints or the mouse over function.
Example