Ansicht
Dokumentation

ABENCDS_F1_VIEW_ENTITY_ANNOTATIONS - CDS F1 VIEW ENTITY ANNOTATIONS

ABENCDS_F1_VIEW_ENTITY_ANNOTATIONS - CDS F1 VIEW ENTITY ANNOTATIONS

Fill RESBD Structure from EBP Component Structure   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- DEFINE VIEW, view_annot

... @annotation ...

Effect

Specifies an annotation annotation as a view annotation in the definition of a CDS view in front of the statement DEFINE VIEW. The character @ must be placed directly in front of the name annotation of the annotation. The annotation should be defined as a CDS object in a CDS annotation definition and the annotation definition annotation @Scope should be specified here using the value #VIEW.

Note

Alongside the view annotations shown here, the globally valid entity annotations can also be specified for a CDS view.

AbapCatalog Annotations

Technical settings of a CDS view.
AbapCatalog.buffering.status,,Activates and deactivates table buffering for the CDS view,, #ACTIVE:\lbr table buffering active \lbr\lbr #SWITCHED_OFF:\lbr table buffering allowed but not active \lbr\lbr #NOT_ALLOWED:\lbr table buffering not allowed,, #SWITCHED_OFF,,#SWITCHED_OFF,,CDS DDIC-based view
AbapCatalog.buffering.type,,Buffering type in table buffering,, #SINGLE:\lbr Single records \lbr\lbr#GENERIC:\lbr Generic area \lbr\lbr#FULL:\lbr Full \lbr\lbr#NONE:\lbr None,, #NONE,,#NONE,,CDS DDIC-based view
AbapCatalog.buffering.numberOfKeyFields,,Number of key elements in table buffering of generic areas,,Number between 0 and k-1, where k is the number of key elements,,0,,0,,CDS DDIC-based view
AbapCatalog.compiler.compareFilter,,Defines the evaluation of filter conditions in path expressions of the CDS view,, true:\lbr The filter conditions of CDS associations occurring more than once in path expressions are compared and, if they match, the associated join expression is created only once. \lbr\lbr false:\lbr For each CDS association with a filter condition, a separate join expression is created and evaluated.,,false,,true,,CDS DDIC-based view
AbapCatalog.dbHints[ ].dbSystem,,Obsolete: Database system for which a database hint is specified (evaluated using SADL). \lbr \lbr Consumption.dbHintsCalculatedBy should be used instead.,,#ADA:\lbr SAP MaxDB \lbr\lbr#DB2:\lbr IBM DB2 \lbr\lbr#DB4:\lbr IBM DB2 for AS/400 \lbr\lbr#DB6:\lbr IBM DB2 UDB \lbr\lbr #INF:\lbr Informix \lbr\lbr#MSS:\lbr Microsoft SQL Server \lbr\lbr#ORA:\lbr Oracle DB \lbr\lbr #HDB:\lbr SAP HANA database \lbr\lbr#ASE:\lbr Sybase ASE \lbr\lbr#ALL:\lbr all database systems,,-,,-,,CDS DDIC-based view
AbapCatalog.dbHints[ ].hint,,Obsolete: Database hint (evaluated using SADL). \lbr \lbr Consumption.dbHints[ ] should be used instead.,,Platform-dependent database hint,, -,,-,,CDS DDIC-based view
AbapCatalog.preserveKey,,Specifies the definition of the key fields in the CDS managed DDIC view of the CDS view.,,true:\lbr The key fields of the CDS managed DDIC view are defined as determined by the addition KEY. \lbr\lbrfalse:\lbr The key fields of the CDS managed DDIC view are determined as for DDIC database views in ABAP Dictionary, regardless of the addition KEY.,,false,,true,,CDS DDIC-based view
AbapCatalog.sqlViewName,,Name of the CDS managed DDIC view of the CDS view,,Character string with a maximum of 16 characters consisting of letters, numbers and underscores and that starts with a namespace prefix.,,-,,-,,CDS DDIC-based view
AbapCatalog.viewEnhancementCategory[ ],,Specifies how the CDS view is extended using CDS view enhancements. A comma-separated list of values can be specified in the square brackets of the annotation array.,,#PROJECTION_LIST:\lbr Extensions of the SELECT list and additional CDS associations are allowed; extensions of CDS views whose SELECT lists contain aggregate expressions or have a UNION clause must be permitted using further values \lbr\lbr #GROUP_BY:\lbr Aggregated or non-aggregated elements are allowed to be added to a SELECT list with aggregated expressions and the associated extensions of the of the GROUP-BY clause are also permitted; can only be specified together with #PROJECTION_LIST \lbr\lbr#UNION:\lbr Extensions of the SELECT list of a CDS view with a UNION clause are allowed; can only be specified together with #PROJECTION_LIST \lbr\lbr#NONE:\lbr No extensions allowed; cannot be specified together with other values,, #PROJECTION_LIST,,#PROJECTION_LIST,,CDS DDIC-based view\lbr \lbr CDS projection view

Notes

  • Each definition of a must contain the ABAP annotation AbapCatalog.sqlViewName, which defines the name of the CDS managed DDIC view in ABAP Dictionary.
  • The name given to the DDIC database view can no longer be changed after the CDS view is transported into a follow-on system.
  • In the annotation array AbapCatalog.viewEnhancementCategory[ ], #GROUP_BY and #UNION can only be specified together with the default value #PROJECTION_LIST. The value #NONE excludes any other values.
  • Extensions of a view with aggregate expressions or with a UNION clause modify the cardinality of the result set. This means that these extensions must have special permission in the view to enable consumers of the view to handle any changes to cardinalities.
  • It is advisable to use the annotation AbapCatalog.compiler.compareFilter with the value true. ADT suggests this when a new CDS view is created.

Example

Activates table buffering with single record buffering for the CDS view business_partner.

@AbapCatalog.sqlViewName:      'BPA_VW'
@AbapCatalog.buffering.status: #ACTIVE
@AbapCatalog.buffering.type:   #SINGLE
define view business_partner as
  select from snwd_bpa
         { key snwd_bpa.bp_id as id,
               snwd_bpa.bp_role as role,
               snwd_bpa.company_name,
               snwd_bpa.phone_number }

Example

For the CDS view business_partner, activates table buffering for a generic area and a key element.

@AbapCatalog.sqlViewName:                 'BPA_VW'
@AbapCatalog.buffering.status:            #ACTIVE
@AbapCatalog.buffering.type:              #GENERIC
@AbapCatalog.buffering.numberOfKeyFields: 1
define view business_partner as
  select from snwd_bpa
        { key snwd_bpa.bp_id as id,
              snwd_bpa.bp_role as role,
              snwd_bpa.company_name,
              snwd_bpa.phone_number }

AccessControl Annotations

Defines access control for the CDS view.
AccessControl.authorizationCheck,,Defines implicit access control when is used to access the CDS view,,#CHECK:\lbr If is used to access the view, access control is performed implicitly if a CDS role is assigned to the view. If there is no role for the view, a syntax check warning occurs. \lbr\lbr #NOT_REQUIRED:\lbr Like #CHECK, but there is no syntax check warning. \lbr\lbr#NOT_ALLOWED:\lbr No access control is performed. This produces a syntax check warning in the DCL source code of a role for the view. \lbr\lbr#PRIVILEGED_ONLY:\lbr Privileged CDS association (evaluated by SADL).,, #CHECK,,#CHECK,,CDS DDIC-based view\lbr \lbr CDS projection view

Notes

  • Value #NOT_REQUIRED is recommended for CDS views that no access control is provided for when they are created, but which roles can be defined for later on.
  • The value #NOT_ALLOWED disables implicit access control when the CDS view is accessed in . The addition WITH PRIVILEGED ACCESS can be used in the FROM clause to disable access control for views not annotated with this annotation. In the case of views too, the authorization check with the addition WITH PRIVILEGED ACCESS must be disabled in updates in ABAP SQL statements. If not, a runtime error occurs.
  • CDS access control does not work for cross-client access. This is why in , the addition USING and the obsolete addition CLIENT SPECIFIED can only be used when accessing CDS entities where access control is disabled. It is recommended that the annotation AccessControl.authorizationCheck:#NOT_ALLOWED is only specified for CDS views that are subject to cross-client access.

ClientDependent Annotations (Obsolete)

Defines client handling for the CDS view (obsolete).
ClientDependent,,Defines client handling when is used to access the CDS view (obsolete).,,true:\lbr 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, implicit client handling is applied. \lbr\lbrfalse:\lbr The CDS view is a cross-client view. No implicit client handling is applied.,,-,,true,,CDS DDIC-based view

Notes

  • The obsolete annotation @ClientDependent is replaced by the annotations @ClientHandling.type and @ClientHandling.algorithm.
  • The obsolete annotation @ClientDependent does not have a default value if it is not used. If neither of the annotations @ClientDependent or @ClientHandling are specified, the default values of the @ClientHandling annotations apply.
  • The obsolete annotation @ClientDependent cannot be specified together with the annotation @ClientHandling.

ClientHandling Annotations

Defines client handling for the CDS view.
ClientHandling.type,,Defines the client dependency when is used to access the CDS view.,,#CLIENT_DEPENDENT:\lbr The CDS view is client-specific. When accessed using SELECT, implicit client handling is applied. \lbr\lbr#CLIENT_INDEPENDENT:\lbr The CDS view is a cross-client function. When accessed using SELECT, no implicit client handling is applied. \lbr\lbr#INHERITED:\lbr The client dependency of the CDS view is determined by the data sources used. If a data source is client-specific, the CDS view is too. ,,#INHERITED,,#INHERITED,,CDS DDIC-based view
ClientHandling.algorithm,,Defines client handling when is used to access the CDS view.,,#NONE:\lbr No implicit client handling takes place. \lbr\lbr#AUTOMATED:\lbr The joins of the CDS view are modified implicitly. \lbr\lbr #SESSION_VARIABLE:\lbr The joins of the CDS view are modified implicitly and the session variable $session.client is used implicitly to improve performance. ,,#AUTOMATED,,#AUTOMATED,,CDS DDIC-based view

Note

An annotation @ClientHandling cannot be specified together with the obsolete annotation @ClientDependent.

DataAging Annotations

Defines data aging for the CDS view.
DataAging.noAgingRestriction,,Defines how data aging is respected on a SAP HANA database when the CDS view is accessed using . ,,true:\lbr reads all data \lbr\lbrfalse:\lbr reads current data only ,,false,,true,,CDS DDIC-based view

Example

When the CDS view sales_order_12 is accessed, all data is read on SAP HANA databases and not just data flagged as "HOT" in the DDIC database table snwd_so.

@AbapCatalog.sqlViewName: 'SALES_ORDER_2012'
@DataAging.noAgingRestriction:true
define view sales_order_2012 as
  select from snwd_so
         { key snwd_so.so_id,
               snwd_so.buyer_guid as customer_guid }
  where snwd_so.created_at >= 20120101000000.0
    and snwd_so.created_at  20130101000000.0;

Metadata Annotations

Defines the handling of metadata from the CDS view.
Metadata.ignorePropagatedAnnotations,,Defines whether analysis of annotations is possible using the annotation API CL_DD_DDL_ANNOTATION_SERVICE.,, true:\lbr Only direct and derived annotations of the current CDS entity are respected. \lbr\lbr false:\lbr Inherited annotations of CDS entities used are also respected.,, false,,true,,CDS DDIC-based view\lbr \lbr CDS projection view

ObjectModel Annotations

The following subannotations of ObjectModel characterize CDS views with respect to the data they deliver.
ObjectModel.usageType.dataClass,,Specifies the data category of the CDS view.,,A CDS view can be assigned to one of the following data categories: \lbr\lbr#TRANSACTIONAL: \lbr The CDS view delivers data written or modified in high volume transactions or in background transactions. \lbr\lbr #MASTER: \lbr The CDS view delivers master data. The master data is read in high volume transactions or background transactions, but not written or modified. \lbr\lbr #ORGANIZATIONAL: \lbr The CDS view delivers data that describes organizational structures and customer processes. \lbr\lbr#CUSTOMIZING: \lbr The CDS view delivers data that describes customizing data. \lbr\lbr #META: \lbr The CDS view delivers technical system configuration data or the structure of entities. \lbr\lbr#MIXED: \lbr The CDS view delivers data of mixed data categories.,,#MIXED,, #MIXED,,CDS DDIC-based view\lbr \lbr CDS projection view
ObjectModel.usageType.serviceQuality,,The quality of the service with respect to the performance that can be expected by the consumer of the CDS view.,,A CDS view can be assigned to one of the following quality categories: \lbr\lbr#A: \lbr The CDS view can be used for high volume transactions or for background transactions. \lbr\lbr #B: \lbr The CDS view can be used for transactions or for background transactions. \lbr\lbr #C: \lbr The CDS view can be used to query individual objects in transactions. \lbr\lbr #D: \lbr The CDS view can be used for analytical queries. \lbr\lbr #X: \lbr The CDS view is designed for special application cases, such as data migration. \lbr\lbr #P: \lbr The CDS view is used to structure hierarchies of CDS entities and must not be used outside of such a hierarchy.,,#X,, #X,,CDS DDIC-based view\lbr \lbr CDS projection view
ObjectModel.usageType.sizeCategory,,Specifies the size of the data volume that must be scanned to return the result. This usually corresponds to the largest underlying table.,,A CDS view can be assigned to one of the following size categories: \lbr\lbr#S: \lbr The expected size of the data volume that needs to be scanned is less than 1000. \lbr\lbr #M: \lbr The expected size of the data volume that needs to be scanned is less than 100,000. \lbr\lbr#L: \lbr The expected size of the data volume that needs to be scanned is less than 10,000,000. \lbr\lbr #XL: \lbr The expected size of the data volume that needs to be scanned is less than 100,000,000. \lbr\lbr#XXL: \lbr The expected size of the data volume that needs to be scanned is 100,000,000 or greater.,, #S,,#S,,CDS DDIC-based view\lbr \lbr CDS projection view

Notes

  • With the above subannotations of ObjectModel it can be documented for a view for which kind of application it is intended and which kind of data are to expected. This information is especially important in regards of performance that can be expected by the consumer of the view. For the quality categories annotated with ObjectModel.usageType.serviceQuality, the following rules apply:
  • A CDS view with the quality category A should access no more than three DDIC database tables, must not call any functions, must not aggregate a large number of table rows for direct access, and must not access DDIC database tables with mixed data categories. If the underlying tables are buffered, the CDS view should be buffered too. The runtime for reading a single line with a fully specified key must be less than 1 ms for selecting fields from a field list or 2 ms for selecting all fields with *.

  • A CDS view with the quality category B should access no more than five DDIC database tables, must not call any functions, must not aggregate a large number of table rows for direct access, and must not access DDIC database tables with mixed data categories. If the underlying tables are buffered, the CDS view should be buffered too. The runtime for reading a single line with a fully specified key must be less than 2 ms for fields from a field list or 5 ms for selecting all fields with *.

  • A CDS view with the quality category C should access no more than 15 DDIC database tables, must not aggregate a large number of table rows for direct access, and must not access DDIC database tables with mixed data categories. The runtime for reading a single line with a fully specified key must be less than 10 ms for fields from a field list or 20 ms for selecting all fields with *.

  • A CDS view with the quality category D should access no more than 100 DDIC database tables. The performance should be checked and monitored with realistic data by a test framework.

  • A CDS view with the quality category X can access more than 100 database tables. The performance must be checked and monitored with realistic data by a test framework.

  • A CDS view with the quality category P is not intended for usage in business applications. Performance checks by a test framework are not required.

  • For all quality categories, the subannotations sizeCategory and dataClass should be specified. Only for quality category P, they do not need to be specified.

These rules can be checked in the ABAP Test Cockpit (ATC) by tests delivered by SAP.
  • Generally, a CDS view used in an application should not access more than 100 DDIC database tables and should have a quality category between A and D.





General Material Data   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 39149 Date: 20240328 Time: 122356     sap01-206 ( 517 ms )