Get Example source ABAP code based on a different SAP table
Cached Views in SAP HANA The SAP HANA database> supports the concept of cached views. Under certain circumstances, the results of reads of a view can be 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 AB-SQL statements. The following conditions must be met:
The type of a view known in AB_SQL ( DDIC database view> in the ABAP Dictionary or CDS view>) must be defined for the caching. Here, the SQL statement ALTER TABLE> (described in the documentation for HANA-specific SQL >) can be used with the addition ADD CACHE>. ABAP Dictionary> supports the concept of dynamic caches> for this purpose.
The use of the cache must be activated in the AB-SQL query> by using the database hint> %_HINTS HDB> 'RESULT_CACHE'>.
The AB-SQL query> must have aggregate expressions> and a GROUP BY>> clause. 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_ >.