2007 Jul 26 7:21 AM
hi experts,
thanq all
but how to use primary index and secondary indexes in select statment .shall we use both at same time in select staament .please explaine me with examples.
thanks in advance.
radhakrishna.
2007 Jul 26 7:27 AM
Hi,
primary index will be used by default in all the Select statments, if you do not specify in INDEX with the select statment, then the primary index will taken by SAP automatically.
If the underlying database is ORACLE, then you can specify the secondary index to be used by the following statement:
SELECT * FROM SPFLI
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'
.......
ENDSELECT.
You can also check:
http://www.saptechnical.com/Tips/ABAP/SecondaryIndexes.htm
Regards
Sudheer
Regards
Sudheer
hi experts,
thanq all
but how to use primary index and secondary indexes in select statment .shall we use both at same time in select staament .please explaine me with examples.
thanks in advance.
radhakrishna.
2007 Jul 26 7:25 AM
Hi,
You cannot force the use of INDEX, its upto the Database Optimizer in the Workprocess to decide weather to use the INDEX or NOT.
BUT INDEX will be used when your SELECT query's WHERE CLAUSE has as many fields of INDEX as possible. Also you need to put the fields in the SAME ORDER as they appear in the INDEX.
So if your index is on FLD1 FLD2 and FLD3
then in your query use SELECT * FROM TAB WHERE FLD1 = and FLD2 = and FLD 3.
Regards,
Sesh
2007 Jul 26 7:27 AM
Hi,
primary index will be used by default in all the Select statments, if you do not specify in INDEX with the select statment, then the primary index will taken by SAP automatically.
If the underlying database is ORACLE, then you can specify the secondary index to be used by the following statement:
SELECT * FROM SPFLI
%_HINTS ORACLE 'INDEX("SPFLI" "SPFLI~001")'
.......
ENDSELECT.
You can also check:
http://www.saptechnical.com/Tips/ABAP/SecondaryIndexes.htm
Regards
Sudheer
Regards
Sudheer
2007 Jul 26 8:07 AM
Hi,
We can use both secondary index and primary index in a single select statement. First we need to use secondary index in where condition then we can use primary index after that non primary keys. if secondary index is not there we will use primary index directly.
Reward points if useful.
Thanks & Regards,
Vasudeva Rao