ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Overview → ABAP SQL - Table Buffering
Table Buffering - Restrictions
Only transparent tables can be buffered. Global temporary tables cannot be buffered. There is no special restriction on the key length of the table when buffering, which means that keys in buffered tables can be up to 900 bytes long. The table buffer is not used on principle in the case of database reads using Native SQL and AMDP.
Any writes access the data in the database table directly and entail asynchronous buffer synchronization. After the invalidation of an entry in the buffer using a write statement, the next five reads that should have accessed the entry bypass the buffer of the current AS Instance by default. The next read performed on the changed entry reloads it into the buffer and removes the invalidation. The number of reads that bypass the buffer before the reload is specified in the profile parameter zcsa/sync_reload_c.
The fact that certain operations can only be performed on the database and not in the table buffer produces the further restrictions for reads listed below. If these restrictions are not respected, read ABAP SQL statements bypass the table buffer implicitly and access the database tables or views directly.
- The following reads always bypass the table buffer:
- Use of subqueries, more specifically the statement
WITH
.
- The ABAP SQL language element
GROUPING SETS
.
- The ABAP SQL language element
UNION
.
- Reads on a database table or database view for which a replacement object is defined.
- Reads using a database
connection specified explicitly using the addition
CONNECTION
. This also applies when the standard connection is specified explicitly.
- Reads redirected using the class CL_OSQL_REPLACE during a unit test.
- Reads on a CDS view that does not meet the prerequisites for buffering.
- The following applies in a main query:
- No aggregate expressions can be used in the
SELECT
list.
- Only specific SQL expressions can be used.
- The additions
DISTINCT
andFOR UPDATE
cannot be used.
- No
JOIN
expressions can be specified.
- The
ORDER BY
clause cannot be used in cases where single columns are specified as sort keys and these columns are not a left-aligned subset of the primary key (in the correct order) or if the additionDESCENDING
is specified in a column.
- The obsolete addition
CLIENT SPECIFIED
can be specified to disable implicit client handling in client-specific data sources only if their client column is specified in aWHERE
condition.
- Restrictions on the SQL condition in the
WHERE
clause:
- When a table or view with single record buffering is accessed, all key fields of the primary key must be specified using equality conditions joined using
AND
.
- When a generically buffered area is accessed, it must be specified in full using equality conditions joined using
AND
.
- Only specific SQL expressions can be used on the left side of a relational expression.
- Only host variables or
host expressions can
be used on the right side of a relational expression used to identify a single record or a generically buffered area. In any other relational expressions of a condition, columns too can be specified in
comparisons or when
BETWEEN
is used. This applies in cases where neither (numeric) operand has the type DF16_DEC or DF34_DEC, both operands are character-like, or both operands have the type RAW with the same length.
- No column can be compared with another column in a data source specified after
FROM
.
- If
FOR ALL ENTRIES
is used when accessing a table or view with generic buffering, the generic area must be specified exactly and multiple generic areas cannot be joined usingOR
.
- The variant of the operator
IN
with an operand list on the left side cannot be used.
Other versions:
7.31 | 7.40 | 7.54
Notes
- For performance reasons, the fact that the table buffer is bypassed when these restrictions are not met should always be remembered when accessing buffered database tables or views.
- To bypass the table buffer in the statement
SELECT
explicitly, the additionBYPASSING BUFFER
should always be used. It is not enough to rely on the implicit behavior itself.
- In cases where an internal table is used as a data source of a query, the read restrictions also determine whether the table can be evaluated on the AS ABAP or whether its content needs to be transported to the database.