‎2006 Oct 20 3:54 PM
DATA ITAB LIKE STANDARD TABLE OF LINE WITH UNIQUE KEY COL2 .
In which scenario we need to use standard, sorted & hashed type internal table.
‎2006 Oct 20 4:01 PM
Hi:
STANDARD table
Key access to a standard table uses a linear search. This means that the time required for a search is in linear relation to the number of table entries.
You should use index operations to access standard tables.
SORTED table
Defines the table as one that is always saved correctly sorted.
Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.
HASHED table
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 oe INSERT itab within a LOOP) are not allowed.
INDEX table
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 index tables.
Regards,
Sookshma.
‎2006 Oct 20 4:04 PM
Hi,
DATA itab {TYPE tabkind OF linetype|LIKE tabkindOF lineobj} WITH [UNIQUE|NON-UNIQUE] keydef
[INITIAL SIZE n] [WITH HEADER LINE].
Effect
Creates an internal table in the program with the type tabkind. Since there are no genericfield definitions, you cannot use the table types ANY TABLE or INDEX TABLE.
The structure of the table lines is defined by the type linetypeif you use a TYPE reference) or by the type of the referredobject lineobj (when you use a LIKE reference).
The same rules apply to the UNIQUE and NON-UNIQUEadditions in the DATA statement as in a TYPES definition. You may only omit the definition when defining astandard table.
If you do not specify the INITIAL SIZE the system uses a defaultinitial size of 0.
DATA itab {TYPE TABLE OF linetype|LIKE TABLE OFlineobj}.
Effect
This is a shortened form of the definition of a standardtable. It corresponds to
DATA itab {TYPE STANDARD TABLE OF linetype|
LIKE STANDARD TABLE OF lineobj} WITH DEFAULT KEY.
or the old definition (compare variant 4)
DATA itab {TYPE linetype|LIKE lineobj} OCCURS 0.
Madhavi
‎2006 Oct 20 4:06 PM
hi,
Standard tables are managed system-internally by a logical index. New rows are either attached to the table or added at certain positions. The table key or the index identify individual rows.
Sorted tables are managed by a logical index (like standard tables). The entries are listed in ascending order according to table key.
Hashed tables are managed by a hash algorithm. There is no logical index. The entries are not ordered in the memory. The position of a row is calculated by specifying a key using a hash function.
Standard tables are managed system-internally by a logical index. New rows are either attached to the table or added at certain positions. The table key or the index identify individual rows.
Sorted tables are managed by a logical index (like standard tables). The entries are listed in ascending order according to table key.
Hashed tables are managed by a hash algorithm. There is no logical index. The entries are not ordered in the memory. The position of a row is calculated by specifying a key using a hash function.
Standard tables are managed system-internally by a logical index. New rows are either attached to the table or added at certain positions. The table key or the index identify individual rows.
Sorted tables are managed by a logical index (like standard tables). The entries are listed in ascending order according to table key.
Hashed tables are managed by a hash algorithm. There is no logical index. The entries are not ordered in the memory. The position of a row is calculated by specifying a key using a hash function.
just go thru this link for some more information...
http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm
‎2006 Oct 20 4:17 PM
Hi
It usually depends on the number of records it has to elaborate and whick kind of reading needs.
STANDARD TABLE has good performance if the table is read by index, so or:
LOOP AT ITAB.
ENDLOOP.
READ TABLE ITAB INDEX <INDEX>.
If it has to use a LOOP with WHERE condition the performance can get worse, this is true if the internal table has a very large number of records.
So in this situation is better to use SORT table.
Max