SAP SAP PUFFERING



Get Example source ABAP code based on a different SAP table
  



AB_SQL - Table Buffering
Table buffering buffers data from the database in a table buffer in the shared memory of the current ABAP_ASINSTANCE . Table buffering is possible for the following objects and takes place when they are accessed using AB_SQL :
DDIC database tables For more information, see DDIC - Table Buffering of Database Tables.
DDIC database views defined in the ABAP Dictionary For more information, see DDIC - Database Views.
CDS view entities defined in ABAP CDS For more information., see ABAP CDS - Table Buffering of CDS View Entities.
ABAP_CDS_V1_VIEWS defined in ABAP CDS For more information., see ABAP CDS - Table Buffering of CDS DDIC-Based Views.
The definitions determine whether and how a DDIC database table, DDIC database view or CDS view entity is buffered. Using buffering generally improves performance (by factors of between 50 and 500), since the data does not need to be transported between the AS ABAP and the database server each time and because process changes can be prevented.
When a DDIC or CDS object for which table buffering is defined is accessed using AB_SQL , table buffering is active by default. Table buffering is performed by the database interface when buffered tables or views are accessed using AB-SQL statements. If a program uses AB_SQL to read data in a buffered table or view, the table or view is accessed using the table buffer, with some exceptions. To do this, the database interface determines whether this data is in the table buffer of the current ABAP_ASINSTANCE . If this is the case, the data is read directly from the buffer. If the data is not contained in the buffer of the ABAP_ASINSTANCE , the data is read from the database and loaded into the buffer. This means the data can accessed from the buffer next time. Writes cause asynchronous buffer synchronization.
The buffering type defines which records are loaded into the buffer when it is accessed. There are also, however, variants of AB-SQL statements that cannot be executed using the table buffer and which therefore bypass table buffering.
BEGIN_SECTION VERSION 5 OUT Native SQL access or
END_SECTION VERSION 5 OUT AMDP methods are applied to the database directly and therefore always bypass table buffering.
Buffering type
Buffer synchronization
Buffer management
Restrictions
SQL expressions



Latest notes:

Typical candidates for buffering are customizing tables and system tables. In certain cases, customizing-like tables with master data can also be buffered. If it is vital that current data is accessed from a buffered table, the addition BYPASSING BUFFER of the statement SELECT can be used. If this addition is used a lot, the table should be checked for its suitability for buffering or whether the current data is really always required.
Buffering is not recommended for tables in the following cases:
The application must always have access to the current data and the delay caused by asynchronous synchronization is not acceptable.
Many writes are performed on the tables. If more than one percent of the accesses are writes, buffering should be avoided, so that the extra work caused by synchronization does not outweigh the benefits of buffering.
Null values are handled as null values in the table buffer. They are not transformed to type-dependent initial values.
When accessing data clusters in export/import tables using the statements EXPORT ... TO DATABASE and IMPORT ... FROM DATABASE, table buffering is not supported.
If table buffering is enabled for a ABAP_CDS_V1_VIEWS , it is implicitly applied to its ABAP_CDS_MNG_VIEW . For CDS view entities, table buffering is applied directly to the CDS entity.
Tables or views that can also be accessed using AMDP should not be buffered. If AMDP methods modify data in buffered tables or views, this is ignored by the database interface and the buffers are not synchronized accordingly. This can cause inconsistencies between the data in the buffers and on the database.
NON_V5_HINTS
The latter is also true if the tables views can be accessed using Native SQL and if native SQL statements modify data in buffered tables or views.
Except in the case of AB_SQL database access, table buffering also applies to database access from classic dynpros .
A user-defined buffering of formatted data in the shared memory is possible using shared objects.
ABAP_HINT_END