SAP CDS DEFINE VIEW ENTITY BUFFER



Get Example source ABAP code based on a different SAP table
  


• DEFINE VIEW ENTITY BUFFER ABAP_CDS_DDL_STATEMENT
• TYPE SINGLE ABAP_CDS_DEF_VIEW_BUF
• TYPE GENERIC ABAP_CDS_DEF_VIEW_BUF
• TYPE FULL ABAP_CDS_DEF_VIEW_BUF
• TYPE NONE ABAP_CDS_DEF_VIEW_BUF
• LAYER CORE ABAP_CDS_DEF_VIEW_BUF
• LAYER LOCALIZATION ABAP_CDS_DEF_VIEW_BUF
• LAYER INDUSTRY ABAP_CDS_DEF_VIEW_BUF
• LAYER PARTNER ABAP_CDS_DEF_VIEW_BUF
• LAYER CUSTOMER ABAP_CDS_DEF_VIEW_BUF
• NUMBER OF KEY ELEMENTS ABAP_CDS_DEF_VIEW_BUF

ABAP_CDS_DDL - DEFINE VIEW ENTITY BUFFER

ABAP_SYNTAX
DEFINE VIEW ENTITY BUFFER ON cds_view_entity
LAYER CORE
$| LOCALIZATION
$| INDUSTRY
$| PARTNER
$| CUSTOMER
TYPE SINGLE
$| ${GENERIC NUMBER OF KEY ELEMENTS number$}
$| FULL
$| NONE

What does it do?
Defines a CDS entity buffer in the CDS DDL.
A CDS entity buffer is an ABAP tuning object that specifies a layer dependent buffering type for the table buffering of a CDS view entity cds_view_entity. As a prerequisite, the definition of the CDS view entity must contain the following annotation:
@AbapCatalog.entityBuffer.definitionAllowed:true.
This annotation entails additional syntax checks. It is only allowed if the CDS view entity in question fulfills certain prerequisites. These prerequisites are described in topic ABAP CDS - Table Buffering of CDS View Entities.
If a CDS entity buffer is active for a CDS view entity, the annotation cannot be removed there.
The buffering type is set as follows:
TYPE SINGLE defines single record buffering.
TYPE GENERIC defines generic buffering. The number of respected key fields must be set by number behind NUMBER OF KEY ELEMENTS. number must be a positive numeric literal that is not greater than the number of key elements of the CDS view entity cds_view_entity.
TYPE FULL defines complete buffering.
The addition LAYER defines the layer for which the buffering type is valid. The layer determines the priority if there are multiple entity buffers for one CDS view entity. The priority is as follows, where the list starts with the lowest and ends with the highest priority: CORE - ABAP_PLATFORM LOCALIZATION - SAP application component INDUSTRY - SAP industry solution PARTNER - partner CUSTOMER - customer
It is not possible to define multiple entity buffers with the same layer for one CDS view entity.
The addition TYPE NONE can be used to switch off buffering explicitly. This is especially useful for switching off buffering in a higher layer that was defined in a lower layer.



Latest notes:

The name of a CDS entity buffer is not reflected in its definition. It only occurs as the name of the repository object in ADT.
The layers specified with LAYER are the same as in the definition of a CDS metadata extension with ANNOTATE ENTITY.
Only the explicitly defined key fields of a CDS entity must be respected behind NUMBER OF KEY ELEMENTS. Unlike ABAP_CDS_V1_VIEWS , there is no client column to be respected for client-dependent views.
A CDS entity buffer fulfills the same task as the respective technical settings of a DDIC database table. Both can be activated and transported separately from the buffered entity. But compared to buffering DDIC database tables, the buffering type for a CDS view entity has the additional feature of being layer-specific.
NON_V5_HINTS
ABAP_HINT_END


ABAP_EXAMPLE_VX5
The following definitions demonstrate the three kinds of table buffering for three different CDS entities in the layer core. define view entity buffer on DEMO_CDS_FULL_BUFFERED_VIEW
layer core
type full define view entity buffer on DEMO_CDS_GEN_BUFFERED_VIEW
layer core
type generic number of key elements 1 define view entity buffer on DEMO_CDS_SINGLE_BUFFERED_VIEW
layer core
type single
The three CDS entities DEMO_CDS_FULL_BUFFERED_VIEW, DEMO_CDS_GEN_BUFFERED_VIEW, and DEMO_CDS_SINGLE_BUFFERED_VIEW all contain the annotation @AbapCatalog.entityBuffer.definitionAllowed: true.
ABAP_EXAMPLE_END