Want to learn ABAP for FREE with direct access to community of students and ABAP experts?

Index is not Used in SELECT

If you realize that index is not used in select, you need to force database to use it. For this, you need to use database hints in your code. 

Hints depend on database server. In the following example, here is how to force database to use index when using SAP Trial system (with MaxDB):


     SELECT *
       FROM zaa_bd_wpo_vol
       INTO table lt_wpo_vol
       FOR ALL ENTRIES IN lt_name_search
       WHERE name_last lt_name_search-last
         AND name_first  lt_name_search-first )
         OR name_whole   lt_name_search-whole
       %_HINTS ADABAS 'INDEX("ZAA_BD_WPO_VOL" "ZAA_BD_WPO_VOL~NAM")'.

In this example, ‘ZAA_BD_WPO_VOL’ is the database table name and ‘NAM’ is the name of index.

Comments

Add comment

Your email address will not be published. Required fields are marked *