A CDS entity buffer temporarily caches the data retrieved from a CDS view entity into the shared memory of the current AS ABAP instance.
Starting with the following ABAP releases,
buffering of CDS view entities is supported:
- SAP BTP, ABAP Environment 2202
- ABAP platform cloud 2202
This new object type (R3TR/DTEB) marks the last step towards feature completeness comparing the new CDS view entities with CDS DDIC-based views.
Please refer to the related blog posts for further information on
CDS view entities and
migrating from CDS DDIC-based views.
Additionally, please get informed what objects are typical candidates for buffering and check the content of
ABAP table buffering.
What's different?
The following table contrasts
buffering of CDS DDIC-based views and new CDS view entities:
Attribute |
CDS DDIC-based view |
CDS view entity |
Buffered Object |
CDS-managed DDIC view |
CDS view entity |
Definition of Buffer |
Using annotations |
Real syntax |
Change of SAP-delivered objects |
Requires modification |
Defines additional buffer object |
Generic Buffer: Number of key elements |
Client column (MANDT) counts |
Client column (MANDT) does not count |
Prepare CDS View Entity for Buffer Definitions
The following annotation makes sure your CDS view entity is prepared for buffer definitions:
@AbapCatalog.entityBuffer.definitionAllowed: true
This annotation is required as a first step to allow subsequent creation of buffer definition objects. The annotation itself does not lead to a buffer, but ensures the following restrictions apply:
- Views with parameters are not supported
- Views with unstable calculations are not supported (e.g. utcl_current, tstmp_current_utctimestamp)
- Session variables (other than client) can not be used
- Base objects have to be tables
- Key length > 900 bytes is not supported
- LOB key fields are not allowed
- Views without key fields can not be buffered
- Data aging in base tables is not allowed
Syntax
DEFINE VIEW ENTITY BUFFER ON <entity_name>
TYPE SINGLE|GENERIC|FULL
LAYER CORE|LOCALIZATION|INDUSTRY|PARTNER|CUSTOMER
[NUMBER OF KEY ELEMENTS <number>] // Needed for buffer type "GENERIC"
Attribute Name |
Description |
LAYER |
Multiple buffers on the same entity can be defined on different layers. Thus, it is allowed to overrule a buffer definition of a previous software layer. E.g. a buffer definition in layer CORE can be disabled by a buffer definition in layer CUSTOMER. |
TYPE |
The buffer definition types are identical to the buffering type specifications in SE11 / technical settings or values of @AbapCatalog.buffering.type. Additionally, type NONE can be specified to disable an existing buffer definition. |
NUMBER OF KEY ELEMENTS |
The key element specification is required for generic buffering, as set for CDS DDIC-based view buffering with annotation @AbapCatalog.buffering.numberOfKeyFields.
The client column is not taken into account. |
Layering relevance
Example
Right click on the CDS view entity and choose "New Entity Buffer"
Specify the Name, Description and Package of the buffer definition
Edit the buffer definition source code
After activating the DTEB object ZDEMO_BUFFER, queries to entity DEMO_CDS_FULL_BUFFERED_VIEW are buffered on the application server.
News with 2022 / 2208
With the following releases, functional scope of DTEB buffer definitions has increased:
- SAP BTP, ABAP Environment 2208
- ABAP platform cloud 2208
- S/4HANA 2022
The restriction "
Base objects have to be tables" is not valid anymore. Base objects of type CDS view entity are now supported in addition to tables.
To allow a CDS view entity to function as a base object for buffering, it is required this base CDS view entity specifies annotation @AbapCatalog.entityBuffer.definitionAllowed : true.
Schema of View on View buffering
In case of questions, please feel free to leave a comment.