Get Example source ABAP code based on a different SAP table
ABAP_CDS - Table Buffering of CDS View Entities The following CDS annotation> defines whether table buffering> is allowed for a CDS view entity> or not: @AbapCatalog.entityBuffer.definitionAllowed: true$|false>> If buffering is allowed, the actual buffering type > can be defined by a separate ABAP tuning object> called CDS entity buffer> with the DDL statement: DEFINE VIEW ENTITY BUFFER ON cds_view_entity ...>> The CDS entity buffer relates the buffering type to one of the layers core, localization, industry, partner and customer. For each layer, one buffering type can be defined for a CDS view entity. A view entity buffer needs a unique key, specified using the keyword ABAP Addition multiple records have identical key values, unexpected buffer behavior might occur.
ABAP_RESTRICTIONS If the @AbapCatalog.entityBuffer.definitionAllowed> is set to true>, the following restrictions apply to the CDS view entity:
Only the following data sources> are possible:
DDIC database tables>
CDS view entities> annotated with the annotation @AbapCatalog.entityBuffer.definitionAllowed: true>. A CDS view entity used as data source must allow buffering itself and must therefore meet all requirements listed here. In a CDS data model with multiple layers, each CDS view entity must allow buffering as a prerequisite for the upper layer to allow buffering.
There must be at least one key element and the combined length of the key elements must not be greater than 900 bytes. Key elements cannot be LOBs >.
No input parameters> are allowed.
No calculations are allowed that have results that do not depend on database content only, for example time stamp functions> that return or depend on the current time stamp.
No session variables> other than $session.client> are allowed.
No database tables can be accessed where data aging> is enabled,
No customer extensions are allowed. Annotations AbapCatalog.extensibility.extensible>> or AbapCatalog.viewEnhancementCategory> > cannot be used to enable extensions.
If a CDS view entity uses UNION $[ALL$]>>, a syntax check warning occurs. Reason:
UNION> removes duplicate records considering all columns, not just key fields. Therefore, UNION $[ALL$] >> might return duplicate records with regard to the key built by the fields declared as key fields. In other words, UNION $[ALL$]> might return multiple rows with identical key values.
The buffer considers the key built by the key fields. In some scenarios, the buffer content is managed with uniqueness constraints.
When a union view returns records with duplicate key values, unexpected buffer behavior might occur.
The application developer must ensure that the key attributes are specified correctly. ABAP_RESTR_END
Latest notes:
The annotations @AbapCatalog.buffering.status>>, @AbapCatalog.buffering.type >>, and @AbapCatalog.buffering.numberOfKeyFields>> are not supported in CDS view entities. They are only valid for CDS DDIC-based views>.
Other than for ABAP_CDS_V1_VIEWS >, where the buffering is defined for the respective ABAP_CDS_MNG_VIEW >, the table buffering of CDS view entities is defined for the CDS entity itself.
In contrast to table buffering of CDS DDIC-based views> where ABAP SQL bypasses the table buffer if the prerequisites are not met, the restrictions are checked directly for the view in case of CDS view entities. For a view that does not meet the prerequisites, table buffering cannot be enabled.
A CDS data model with multiple layers that has buffering defined on multiple layers (for example, table buffers > and CDS entity buffers>) stores data redundantly as soon as the buffers are accessed. Non-redundant storage is currently not supported. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Allowing buffering for a CDS view entity. The actual buffering is defined with the DDL for an entity buffer as shown under DEFINE VIEW ENTITY BUFFER> >. DDLS DEMO_CDS_GEN_BUFFERED_VIEW ABAP_EXAMPLE_END