Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Overview 

Open SQL - SAP Buffering

When a database table or a database view is accessed using Open SQL, SAP buffering is active by default if it is defined in ABAP Dictionary for the database table or view. SAP buffering buffers data from database tables or database views defined in ABAP Dictionary in a table buffer in the shared memory of the current application server. The definition determines whether and how a database table or database view is buffered. Using buffering generally produces much improved performance (by factors of between 50 and 500), since the data does not need to be transported between the application server and the database server each time and because processes do not need to be switched.

SAP buffering is applied by the database interface when buffered tables or views are accessed using Open SQL statements. If a program uses Open SQL to read data in a buffered table or view, the table or view is accessed using the SAP buffer (with some exceptions). To do this, the database interface determines whether this data is in the SAP buffer of the current applications server. If this is the case, the data is read directly from the buffer. If the data is not in the buffer of the application server, 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 the buffer to be synchronized asynchronously.

The buffering type defines which records are loaded to the buffer when accessed. There are also, however, variants of Open SQL statements that cannot be executed using the SAP buffer and which therefore bypass SAP buffering. Native SQL access is applied to the database directly and therefore always bypasses SAP buffering.

Other versions: 7.31 | 7.40 | 7.54


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:

  • Many writes are performed on the tables. If more than one percent of the accesses are writes, buffering should be avoided. If not, the extra work caused by synchronization could outweigh the benefits of buffering.

  • Tables or views that can also be accessed using Native SQL should not be buffered. If Native SQL statements 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.

  • A self-defined buffering of formatted data in the shared memory can be produced using shared objects.

Continue

SAP Buffer - Buffering Types

SAP Buffer - Buffer Synchronization

SAP Buffer - Buffer Management

SAP Buffer - Restrictions