‎2006 Aug 21 3:22 PM
Hi all,
how to create index for table GLPCA for fields RYEAR and POPER and how to write select statement using those indexes.
‎2006 Aug 21 3:24 PM
Use transaction SE11. There is a pushbutton 'INDEXES'. To use it, the SQL optimizer should use it itself.
However, there is an abap command in which you can force the index to be used. Will try and find out. Can't remember it.
‎2006 Aug 21 3:31 PM
Generally, and specifically with Oracle, if you include the fields of the index in the where clause of your SQL, the index will be chosen as part of the plan. But the optimizer makes the final decision.
After you create your index, ask your DBA to create statistics for it, so that the optimizer knows all about it. Generally, you should let the optimizer decide the best course of action, and avoid "Hints"
Look for function modules like "DBEXPLAIN" that will give you an idea of what the optimizer will do.
e.g.
SELECT...
FROM GLPCA
WHERE RYEAR = l_var1
and POPER = l_VAR2
‎2006 Aug 21 4:19 PM
If you know the controlling area (KOKRS), you can add that to the select statement. That should speed it up.
It's not generally a good idea to add a custom index to a standard SAP table to speed up a single custom report.
Rob