Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

create index

Former Member
0 Likes
478

Hi all,

how to create index for table GLPCA for fields RYEAR and POPER and how to write select statement using those indexes.

3 REPLIES 3
Read only

Former Member
0 Likes
446

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.

Read only

Former Member
0 Likes
446

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

Read only

Former Member
0 Likes
446

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