Indexes in SAP

You can search a table for data records that satisfy certain search criteria faster using an index.

An index is a copy of a database table data reduced to certain fields. This copy is always in sorted form which provides faster access to the data records of the table.The index also contains a pointer to the corresponding record of the actual table so that the fields not contained in the index can also be read.

There are 2 types of Indexes in SAP:
1) Primary Index
2) Secondary Index

The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.

Secondary Indexes are created by the user if one require faster search access through non primary keys. It is created by clicking Indexes in the table.
<<Need a SS of secondary index >>

Secondary indexes should be created only after in-depth assessment. Vague creation of secondary indexes will result in slower search and worsens the report performance.

To make use of secondary index in our program we need to alter the select statements little bit. The new addition to select statements depends upon the underlying database. In case of SQL we can use %_HINTS ORACLE 'INDEX("TABLENAME" "TABLENAME~INDEXNUMBER")'


In the above example, 002 is the secondary index of the table MARA.