‎2007 Feb 12 4:26 PM
When the following SELECT SENTENCE is executed:
SELECT DISTINCT bukrs vbeln kunag fkart waerk fkdat
FROM vbrk CLIENT SPECIFIED
INTO TABLE ti_factura
WHERE mandt = '400' and fkart IN p_fkart
AND fkdat between p_budat1 and p_budat2
it alway performs a sequential search dispite we've created and activated an index with these fields:
MANDT
FKART
FKDAT
What can I do to get the SELECT use the index ?
Regards,
‎2007 Feb 12 4:31 PM
Hi,
1)
Make sure you have value in P_FKART
2)
To force index to a sql use the following..
Example if you have created index name as Z01...Changes marked in bold..
SELECT DISTINCT bukrs vbeln kunag fkart waerk fkdat
FROM vbrk CLIENT SPECIFIED
INTO TABLE ti_factura
WHERE mandt = '400' and fkart IN p_fkart
AND fkdat between p_budat1 and p_budat2
<b>%_HINTS oracle 'INDEX("&TABLE&" "VBRK~Z01" "VBRK^Z01")'</b>
Thanks,
Naren
‎2007 Feb 12 5:17 PM
HI,
You need to write the secondary indes like
SELECT * FROM spfli
<b>%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'</b>
...
ENDSELECT.
<b>SPFLI~001 is the index</b>
‎2015 Jun 27 5:44 AM
‎2015 Jun 27 4:27 PM
Pls check that the index really exist in the DB.
In the SE11 when you go the the indexes choose it and make sure that the index exist in the DB
"Index VBRK~ZFA exists in database system ORACLE"
The index being activated is not the same that exists in the DB. You can have an index activated that says that it doesn't exist in the DB.
So make sure it rlly exist.
Regards
‎2015 Jun 27 6:26 PM
Hello Leonardo,
1) If you want to hit your index on SELECT statement exactly, specify index name like %_HINTS ORACLE 'INDEX("KNA1" "KNA1~001")'.
SELECT KUNNR
FROM KNA1
INTO TABLE lt_kunnr
%_HINTS ORACLE 'INDEX("KNA1" "KNA1~001")'..
2) Even your index is not hit on your select exactly,ask your basis consultants run DBSTAT on table. It adjust index and table.
Thanks,Sateesh K
‎2015 Jun 28 1:04 AM
HI
You can use an index with the statement
%_HINTS oracle 'INDEX("<index name>")'
example:
SELECT DISTINCT bukrs vbeln kunag fkart waerk fkdat
FROM vbrk CLIENT SPECIFIED
INTO TABLE ti_factura
WHERE mandt = '400' and fkart IN p_fkart
AND fkdat between p_budat1 and p_budat2
%_HINTS oracle 'INDEX("Z01")'.
look to this document, may help you.
Performance Improvement using Indexes and ABAP Hints
Regards
Ibrahim
‎2015 Jun 28 10:38 AM