Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Index not being used

Hi All,

There is a secondary index on the table PA9001 on PERNR, BEGDA and ENDDA,

but the below statement is not using the same.

SELECT PERNR ZROLE_CD FROM PA9001

INTO TABLE IT_ROLECD

FOR ALL ENTRIES IN IT_EMPDETAILS

WHERE PERNR = IT_EMPDETAILS-PERNR

AND BEGDA <= P_DATE

AND ENDDA >= P_DATE.

the below statement is what i could see in ST05

SELECT "PERNR" ,"ZROLE_CD" FROM "PA9001",( SELECT k0 = '005' ,k1 = '00000001' UNION ALL SELECT '005' , '00000003' UNION ALL SELECT '005' , '00000004' UNION ALL SELECT '005' , '00000007' UNION ALL SELECT '005' , '00000008' ) as q WHERE "MANDT" = q.k0 AND "PERNR" = q.k1 /* R3:ZHRR_ITL_01:1973 T:PA9001 */ /*Dynamic SQL statement -- no cursor, upto 0, conn. 0:1*/

SELECT

|--Nested Loops(Inner Join, OUTER REFERENCES:([Union1014]))

|--Constant Scan(VALUES:(('00000001'),('00000003'),('00000004'),('00000007'),('00000008')))

|--Clustered Index Seek(OBJECT:([DEV].[dbo].[PA9001].[PA9001~0]), SEEK:([DEV].[dbo].[PA9001].[MANDT]='005' AND [DEV].[dbo].[PA9001].[PERNR]=[Union1014]), WHERE:([DEV].[dbo].[PA9001].[PERNR]>='00000001' AND [DEV].[dbo].[PA9001].[PERNR]<='00000008') ORDERED FORWARD)

any ideas, how to make this use the index or why the table index is not being used.

Thanks in Advance,

Mohan

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question