10-09-2012 5:37 AM
Sir,
I have used Table :- BKPF in my program, The program is taking more than 10 minutes to get the output.
I have used a non-key field (cpudt) , in where condition of open cursor statement to retrive data from bkpf.
can u pls explain the process of how to use the secondary index in abap-program to retrive the data faster.
Thanks & Regards.
Moderator message: please search for information before posting.
Message was edited by: Thomas Zloch
10-09-2012 5:50 AM
10-09-2012 8:52 AM
First check BKPF~5 is active in your system (and for database like Oracle check if statitics are up-to-date) - NB: You must provide values for bukrs key field.
As a last solution, if you are not able to get the correct index determined by SQL optimizer, you can use %HINTS to force use of an index. Syntax is database dependant - see Note 129385 - Database hints in Open SQL to find note for your database.
Regards,
Raymond
10-09-2012 9:57 AM
Satish,
steps:
1.Go to SE11
2.Give database table as BKPF and click on display.
3.Now click on Indexes button on right sight corner.
4.Now click on create button on popup
5.Now give the index id which is starts with Z ex:- Z4 ...
6.Give fields what ever you are using non-key fields followed by keyfields (i.e,BUKRS,BELNRGJAHR).
and save everything.
Rewards if helpful.
Thank you.
Regards,
BALAJI.
10-09-2012 5:18 PM
Hi
You can use the following code to select the index of your choice for table access:
SELECT * FROM <Table>
%_HINTS ORACLE 'INDEX("<Table Name>" "<Table Name>~<Index Id>")'
For E.g.
SELECT * FROM MARA
%_HINTS ORACLE 'INDEX("MARA" "MARA~001")'