Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP and SAP HANA 

Cached Views in SAP HANA

The SAP HANA database supports the concept of cached views. Subject to certain prerequisites, the results of reads of a view are cached in a cache to avoid repeated aggregation. For more information, see the SAP HANA documentation.

Caching can also be used for such views in read ABAP SQL statements. The following conditions must be met:

  • The type of an ABAP Dictionary view known in ABAP SQL (classic database view or CDS view) must be defined for the caching. There is no tool support for this at present. Instead, the SQL statement ALTER TABLE (described in the documentation for HANA-specific SQL) can be used with the addition ADD CACHE.

If these prerequisites are met and a suitable cache exists, queries of the same type read from the cache. To find out whether a cache was used, how old its data is, and the maximum lifetime of the data in the cache, the addition EXTENDED RESULT of the INTO clause can be used to provide the result object with the corresponding information. To do this, the value ABAP_TRUE must be passed to the parameter IV_CACHED_VIEW of the instance constructor of the class CL_OSQL_EXTENDED_RESULT when the object is created. The methods for reading the relevant values start with the prefix CVIEW_.

Other versions: 7.31 | 7.40 | 7.54


Note

For cached views, an alternative for handling the exception CX_OSQL_EXTENDED_RESULT is to execute the method CVIEW_VALID for the result object of EXTENDED RESULT to determine the validity of the extended result.