Generic Buffering 

With generic buffering, all the records in the buffer whose generic key fields agree with this record are loaded when one record of the table is accessed. The generic key is a part of the primary key of the table that is flush left.

In this example, the record highlighted in red is read by a program from table SCOUNTER. If the table is generically buffered, all the records read whose generic key fields (MANDT and CARRID) agree are loaded into the buffer.

When Should you Use Full Buffering?

A table should be buffered generically if only certain generic areas of the table are normally needed for processing.

Client-dependent, fully buffered tables are automatically generically buffered. The client field is the generic key. It is assumed that work is not being carried out in all clients simultaneously on an application server.

Language-dependent tables are another example where generic buffering is recommended. In general, only records of one language will be needed for an application server. In this case, the generic key includes all the key fields up to and including the language field.

How Should you Define the Generic Key?

In generic buffering, defining a suitable generic key is of decisive importance.

If the generic key is defined too small, the buffer will contain a few very large areas. During access, too much data might be loaded to the buffer.

If the generic key is defined too large, the buffer might contain too many small generic areas. These can then encumber buffer administration, as an entry is administered there for every buffered generic area. It is also possible that too many accesses will 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 per generic area, it is usually better to fully buffer the table.

Only 32 bytes of the generic key are distinguished. You can specify a longer generic key, but the part of the key exceeding 32 bytes is not used to create the generic areas.

Access to Buffered Data

It only makes sense 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 which is not in the buffer with fully-specified generic keys, there is a database access 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 non-existent. This avoids further accesses to this area in later access attempts.