Technical Articles
SAP CDS hints annotation & its application in ABAP
Hi All,
SAP CDS HINTS
Introduction
Hints can be used to influence preparation, optimization, and execution of SQL statements. Hint can be modeled on view level using annotations, While working with CDS hints we learned few things. |
Problem Statement
Following blog Optimize CDS views using dbHints annotation | SAP Blogs we ran into a scenario as below:
CDS Hint annotation:
@AbapCatalog.dbHints: [{dbSystem: #HDB, hint: ‘<hint_name>’}] .“→ which is now deprecated annotation
SELECT *
FROM Z<CDS View>
WITH HINT ( USE_ESX_PLAN )
We faced below error by after calling the CDS in abap statement:
SAP CDS HINTS GRAMMAR ERROR
Solution
Hence we have to use the up-to-date annotation as below:
@Consumption.dbHints: ['HINT1', 'HINT2'] ."→ up-to-date annotation
example as shown below:
CDS hints annotation (old and new)
Further calling the above sample CDS into ABAP code as below for successful usage, and found significant performance increase in testing environment.
SELECT * FROM zckub %_HINTS HDB 'USE_OLAP_PLAN' INTO TABLE @DATA(lt_tab).
Conclusion
This is example on how to use and apply CDS dbHints into existing SAP ABAP program.
My Other Blogs:
- Exploring SAP BTP ABAP Environment – Step by Step blog for SAP BTP ABAP Environment (including Eclipse and ABAP instance setup). Its awesome blog with 5 YT series
- SAP BTP ABAP Environment and ADT Troubleshooting Guide | SAP Blogs – SAP BTP ABAP Environment and ADT Troubleshooting Guide
Share & Connect
Useful? like and share on social media.
Connect with me on :
- LinkedIn > linkedin.com/in/sapparamount
- Email > sapparamount@gmail.com
Thank you,
Pavan Golesar
Why do you show the source code of a CDS view in SAPGUI and not in ADT 😉 ?
Hi Andre,
Nice spot, I have other reason however I've replaced that image with ADT
Thanks,
Pavan Golesar
Much nicer :-).