-->

Thursday, October 25, 2012

SAP INTERNAL TABLE TYPES


Types of Internal Table

1.      Standard Table.
2.      Sorted Table.
3.      Hashed Table.

Standard Tables
The most appropriate type if one is going to address the individual table entries using the index or key. Index access is the quickest possible access. Standard tables have an internal linear index. The indexes of internal tables are administered as trees.
If you need key access, standard tables are particularly useful if you can fill and process the table in separate steps. Key access to a standard table uses a linear search. The response time for key access is proportional to the number of entries in the table. The key of a standard table is always non-unique. If no key is specified, the standard table receives the default key, which is a combination of all character-like fields.
You cannot specify a unique key. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries.

Sorted Tables
The most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
If the key is not unique, the system takes the entry with the lowest index. Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique or non-unique. When you define the table, you must specify whether the key is to be unique or not.

Hashed Tables
The most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.
Defines the table as one that is managed with an internal hash procedure. You can only access a hashed table using the generic key operations or other generic operations (SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM or INSERT itab within a LOOP) are not allowed. Hashed tables have no linear index. The key of hashed tables must be unique.

Index Tables
A table that can be accessed using an index. Index table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type INDEX.
Standard tables and sorted tables are also referred to as index tables because both
tables can be accessed using the table index.
Standard tables and sorted tables are known generically as index tables.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.