Friday, January 28, 2011

TYPES OF INTERNAL TABLES IN SAP ABAP

STANDARD TABLES:

Are the Default Internal Table

The key of a standard table is always non-unique so Duplicates are allowed.

DATA TYPE STANDARD TABLE OF .

Records can be accessed through both INDEX and Condition.

READ TABLE INTO INDEX .

Or

READ TABLE INTO WITH KEY .

can be sorted

Accessing/Searching time for the record depends on the No of Records because searching is either liner or binary.

SORTED TABLES

NOTE: Records are always in sorted order.

This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted table using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key.

The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search.

Note: Records can be accessed through both INDEX and with key (condition).

Note: sorted internal tables cannot be sorted again.

Sorted internal tables are always, either UNIQUE/NON UNIQUE.

I.E. Sorted Internal Tables cannot be declared without UNIQUE/NONUNIQUE keywords.

DATA TYPE SORTED TABLE OF WITH UNIQUE/NONUNIQUEKEY .

HASHED TABLES:

This is the most appropriate type for any table where the main operation is key access.

Note: Like database tables, hashed tables always have a unique key.

DATA TYPE HASHED TABLE OF WITH UNIQUE/NON-UNIQUE KEY .

Note: You cannot access a hashed table using its INDEX.

The response (Search) time doesn’t depend on the no of records; instead it is always access remains constant, regardless of the number of table entries.

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.

SPECIAL FEATURES OF STANDARD TABLES:

Sorted tables, Hashed tables are only introduced in Release 4.0, standard tables already existed several releases previously.

Defining a line type, table type, and tables without a header line have only been possible since Release 3.0, for this reason there are certain features of standard tables that still exist for compatibility reasons.