Application Development 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: 

secondary index

Former Member
0 Kudos

Hi,

what is a secondary index,where u create that and wat is the diff of index and secondary index?

plz help

5 REPLIES 5

Sm1tje
Active Contributor
0 Kudos

In transaction SE11 enter the table name, go to change and click button INDEX to create secondary index.

Primary index is the key of the table.

Secondary index is also a 'key' but this time on the fields you choose. This way the data will be stored on the database sorted by the fields of your secondary index.

Former Member
0 Kudos

Hi,

Creating Secondary indexs

goto to se11 & enter table name & display(f7),

->then press indexes.. button on the application toolbar,

->if secondary indexes already exist, a list of them will

be displayed in a dialog box named indexes for table

xxxxx.to create an index,press the create(f5) button.the

create index dialog box will be displayed.

->if no secondary indexes exist,you will not see a list of

indexes.Instead, you will see the create index dialog box

immediately.

->enter an index id in the index id field.customer indexes

should begin with y or z,although the system does not

enforce this.

->press the continue button.the abap/4 dictionary:table

maintain index screen is displayed.

->in the short text field,type a description of the index.

->in the fld name column,type the fields that should

comprise the index in the order that they should be sorted.

->if the values in these fields when taken together must

always be unique be unique,tickmark the unique index check

box.

->press the save button on the application toolbar.the

values in the status fields are now NEW & SAVED & directly

below them the message Does not exist in the database

appears.Also, the message Index xxx to table xxxxx was

SAVED appears at the bottom of the window in the status bar.

->press the Activate button on the Application toolbar.The

system generates SQL & sends it to the RDBMS,creating the

index in the database.If successful,the status fields read

ACTIVE & SAVED, & below the satus fields the message EXISTS

IN THE DATABASE appears.The DB Index Name field will

contain the name of the index in the database.Also, in the

status bar, the message INDEX xxxxx was successfully

activated , is displayed.

->press Back. The Indexes for Table xxxxx screen is

displayed.

->press Cancel to return to the Dictionary:

Table/Structure: Display Fields screen.

CAUTION: if you tickmark the Unique Index checkbox, the

combination of fields in the index is guaranteed to be

uniwue; this is enforced by the RDBMS. An insert or modify

statement will fail if the combination of values in index

fields is already present in the table.

Thanks&Regards,

Phani,

POINTS HELPFUL.

Former Member
0 Kudos

Hi,

PLease refer the link below:

http://www.saptechnical.com/Tutorials/ABAP/SecondaryIndex/Create.htm

Thanks,

Sriram Ponna.

Former Member
0 Kudos

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

An index can be considered a copy of a database table that has been reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example using a binary search. 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.

The primary index is distinguished from the secondary indexes of a table. 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.

You can also create further indexes on a table in the ABAP Dictionary. These are called secondary indexes. This is necessary if the table is frequently accessed in a way that does not take advantage of the sorting of the primary index for the access. Different indexes on the same table are distinguished with a three-place index identifier.

Creating Secondary Indexes

Procedure

In the maintenance screen of the table, choose Indexes.

If indexes already exist on the table, a list of these indexes is displayed. Choose enter .

In the next dialog box, enter the index ID and choose

The maintenance screen for indexes appears.

Enter an explanatory text in the field Short text.

You can then use the short text to find the index at a later time, for example with the R/3 Repository Information System.

Select the table fields to be included in the index using the input help for the Field name column.

The order of the fields in the index is very important. See What to Keep in Mind for Secondary Indexes.

If the values in the index fields already uniquely identify each record of the table, select Unique index.

A unique index is always created in the database at activation because it also has a functional meaning (prevents double entries of the index fields).

If it is not a unique index, leave Non-unique index selected.

In this case you can use the radio buttons to define whether the index should be created for all database systems, for selected database systems or not at all in the database.

Select for selected database systems if the index should only be created for selected database systems.

Click on the arrow behind the radio buttons. A dialog box appears in which you can define up to 4 database systems with the input help. Select Selection list if the index should only be created on the given database systems. Select Exclusion list if the index should not be created on the given database systems. Choose enter.

Choose !(activate).

Result

The secondary index is automatically created in the database during activation if the corresponding table was already created there and index creation was not excluded for the database system.

You can find information about the activation flow in the activation log, which you can call with Utilities ® Activation log. If errors occurred when activating the index, the activation log is automatically displayed.

Former Member
0 Kudos

Hi Veera,

There are two types of indexes: Primary index and secondary index. Primary index is automatically created using the primary keys defined.

Secondary index could be created as per the user requirement.

These are the steps for creating a secondary index.

Go to transaction SE11.

Open a table.

To know if there are any secondary indexes available, click on Goto à Indexes

If no indexes occur, then

Click on Create a Create Index

Enter the name of the index.

Fill in the details – Short description and the fields in the index.

Save and activate.

Now you can observe the index created above in the list now:

Maximum number of secondary indexes we can have are 9.

Reward points if helpful.