You use generic buffering to load in the buffer all the records whose generic key fields match with the accessed record of the table. The generic key is a part of the primary key of the table that is left-justified.
In this example, a program reads the record highlighted in red from table SCOUNTER. If the table is generically buffered, all records whose generic key values (MANDT and CARRID) agree are loaded into the buffer. This is shown in the figure below.
When To Use Generic Buffering:
You must generically buffer a table if only certain generic areas of the table are needed for processing.
Client-specific, fully-buffered tables are automatically generically buffered since it is not possible to work in all clients at the same time on an application server. The client field is the generic key.
Language-specific tables are another example when we recommend you use generic buffering. In most cases, only records of one language are needed on an application server. In this case, the generic key includes all the key fields up to and including the language field.
Defining the Generic Key
In generic buffering, it is crucial to define a suitable generic key.
If the generic key is too small, the buffer contains a few large areas. During access, too much data can be loaded in the buffer.
If the generic key is too large, the buffer contains too many small generic areas. These can reduce buffer performance since there is an administrative entry for every buffered generic area. It is also possible that too many accesses bypass the buffer and go directly to the database, since they do not fully define the generic key of the table. If there are only a few records in each generic area, we recommend you to fully buffer the table.
Access to Buffered Data
We recommend you to generically buffer a table if the table is accessed with fully-specified generic key fields. If a field of the generic key is not assigned a value in a SELECT statement, it is read directly from the database, bypassing the buffer.
If you access a generic area that is not in the buffer with a fully-specified generic key, you directly access the database to load the area. If the table does not contain any records in the specified area ("No record found"), this area in the buffer is marked as nonexistent. It is not necessary to access the database if this area is needed again.