1. Primary Index
-
Created automatically when you create a table in SE11.
-
Based on the primary key fields of the table.
-
Always unique.
-
Cannot be deleted.
-
Used whenever you do a
SELECT ... WHERE
on the primary key.
Example:
For table MARA, the primary index is on MATNR
(Material Number).
SELECT * FROM mara WHERE matnr = ‘MAT001’.
2. Secondary Index
-
Created manually in SE11 (or SE14) for performance optimization.
-
Can be unique or non-unique.
-
Useful when you frequently query on non-primary key fields.
-
Stored in the database dictionary as
Z
indexes (MARA~Z01
, etc.). -
Too many indexes = bad performance on
INSERT/UPDATE/DELETE
(because index maintenance consumes resources).
Example:
If you often query MARA by MTART
and MBRSH
, you might define a secondary index on those fields.
3. Unique Index
-
Ensures that no duplicate values exist for the indexed fields.
-
Primary indexes are always unique, but you can also define unique secondary indexes.
Example:
On MARC
, you might create a unique secondary index on (MATNR, WERKS)
to ensure material–plant combination is unique.
4. Non-Unique Index
-
Allows duplicate values for the indexed fields.
-
Used mainly for improving performance, not data consistency.
5. Bitmap Index (special, DB-dependent)
-
In SAP on Oracle, bitmap indexes may be created automatically for fields with low cardinality (few distinct values, e.g., “Gender”).
-
Rarely created manually in ABAP Dictionary, but worth knowing.
Summary table:
Index Type | Created By | Based On | Uniqueness | Example |
---|---|---|---|---|
Primary | Auto | Primary Key | Unique | MARA~MATNR |
Secondary | Manual | Any fields | Unique / Non-Unique | MARA~Z01 on MTART+MBRSH |
Unique | Manual | Any fields | Unique only | MARC~MATNR+WERKS |
Non-Unique | Manual | Any fields | Duplicates allowed | Index on MTART |
Bitmap | DB-specific | Low-cardinality fields | Depends | Oracle-specific |