With the use of secondary index we can make a program run
faster but we are advised not to use secondary index why is
that so??

Answer Posted / saifur rahaman

INDEX

An Index is a copy of database table having few numbers of
fields. This copy is always in sorted form. As we know,
Sorted data would always have a speed access from a
database table. Hence, we use an index for the table while
reading the database records. Index also contains a pointer
pointing towards actual database table so that it can
access fields that are not contained in the Index. There
are two kinds of index for a database table:
Primary Index
Secondary Index
Primary Index:

The columns in a table have an 'X' under "KEY" in the
dictionary table/structure (SE11) for a primary index. They
always appear in the initial columns of a table. Or we can
say that primary index consists of a primary key field of a
database table.

Secondary Index:
Secondary Index is the one which we create
separately for the speed access of a database table. Go to
the Transaction SE11- enter the table name (EX: MARA)
and click on Indexes button in the top right corner.

Tables that allow Indexing:

As mentioned earlier in the abstract, not all the
tables allow you to create an Index.
They are allowed only for transparent tables. All
business data and application data are stored in
transparent tables. Ex: VBPA
(Sales Document: Partner), VLCVEHICLE (VELO: Vehicle),
MARA (General Material Data), etc..
Secondary indexes are not allowed for the below
tables but gives a message saying 'Index maintenance only
possible for transparent tables '.
-> Cluster tables. Ex: BSEG
(Accounting Document Segment), KONV (Conditions
(Transaction Data) ), etc..
-> Pooled tables. Ex:
Configuration tables, etc..
Before creating an index:

These are the points to be remembered before
creating an Index.

Create Secondary Indexes for the tables that you mainly
read. Because every time we update a database table, it
would update indexes also. Let's say there is a database
table where we create (or update) 100s of entries in a
single day. Avoid using Indexes in such cases.
We should take care that an index shouldn't have more than
4 fields and also the number of indexes should not exceed 5
for a database table. Or else, it would result in choosing
a wrong one for particular selection by an optimizer.
Place the most selective fields at the beginning of an
Index.
Avoid creating an Index for a field that is not always
filled i.e., if it's value is initial (null) for most
entries in a table.

Options:
Unique Index: If the fields chosen in an index are very
unique i.e., for each combination of fields only one entry
exists, then we chose unique index.
Non-Unique Index: If the above is not true, we choose this
option. We have 3 radio buttons under this called Index on
all database systems, For selected database systems, and No
database index. We can chose any one of them depending on
our requirement.
For client Dependent tables, we always include the
field "MANDT' under all the indexes as you can see in the
previous slide's screenshot. Or else, Optimizer might not
use the Index.
After creating an Index

These are the points to be remembered while coding
in ABAP programs for effective use of Indexes i.e., to
avoid the full table scan.

In the select statement, always put the condition fields in
the same order as you mentioned in the INDEX. Sequence is
very important here.
If possible, try to use positive conditions such as EQ and
LIKE instead of NOT and IN which are negative conditions.
Optimizer might stop working if you use OR condition. Try
to use IN operator instead of that.
The IS NULL operator can cause a problem for the Index as
some of the database systems do not store null values in
the Index structure.

Is This Answer Correct ?    22 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the t-code to display batch input sessions? : abap bdc

624


Can you delete data element, which is being used by table fields. : abap data dictionary

658


How do you retrieve the data for repetitive structures ? : abap hr

645


How would you set the formatting options statically and dynamically within a report?

650


Difference between BDC vs Direct Loads?

655






Explain the structure of a bdc sessions?

550


1. If I send 5 entries of table from one system to another system, if the only 4 entries there in the target system what I have to do? 2. If I send the customer master IDOC from one SAP system to another system, if one field is missing in target table what is the steps? 3. If I want to access the 4th row 3rd column in the hashed table how to do it? 4. Whether there is any other statement than MODIFY statement to modify the content of internal table?

1406


SAP query how to use end users?

1689


Suppose there is check box along with the rows. The requirement is, select the require check boxes and press a used defined button to save all these checked row data to another table. How can you do it?

1615


In a loop of an internal table, what is the use of at first & at last statements?

1469


Explain what is the significance of hide?

520


What is the difference between skip and new-line?

791


– Programming using BAPI : Create Debit Memo Request (DMR) with reference to Sales Order and update the delivery number and PO number in the newly created DMR. Send the spool of the report by E-mail if the E-mail option is enabled. Selection Screen Required:  Sales Org  Delivery type  Sales document type Optional:  Planned Goods movement date  Option to choose E-Mail  E-mail Address  Output device Output Output should display both successful and unsuccessful creation of DMR with the following fields,  Success/Error (S/E)  Sales Document number  Delivery number  New Debit memo request number  Error message Tables TVAK, TVCPA, VBAK, LIKP, LIPS

5520


In select-options, how to get the default values as current month first date and last date by default?

621


What is logo in sap script?

560