‎2007 Dec 28 10:30 AM
Hi,
What is the use of table types?In which situation we are using the standard table ,sorted table and hashed table?Any body explain with example.
Regards,
Srihitha
‎2007 Dec 28 10:33 AM
table types can be used for defining tables in reports ,function modules,etc.
standard is most commonly used.
hashed is used only in case of very large tables.
sorted usage depends on whether the table is sorted on key fields etc
‎2007 Dec 28 10:35 AM
Hi,
Table type
A table type is a type that describes the structure and functions of an
internal table in the ABAP program. It can be used in the ABAP program
analogously to types that are predefined in the ABAP program or defined
directly in the ABAP program to define data objects and types.
Table types can be used in the ABAP Dictionary to define structures
(structured types) and other table types:
o A component of a structure can have a table type as type. This
defines a structured type with a component that is a table.
o A table type can be used as the row type of another table type. This
defines a table of tables.
A table type describes the following attributes of an internal table:
o The structure and data type attributes of the table row are defined
by the row type.
o The key definition describes the structure of the table key.
o The key category defines whether the key is unique, that is if all
the records of the table have different key values.
o The access mode defines how the table is accessed and how its
records are managed internally.
Regards,
Pankaj
‎2007 Dec 28 10:36 AM
Hi
There are 3 types of internal tables.
internal tables can be classified like below.
INDEX NON-INDEX
STANDARD and SORTED HASHED
Standard and sorted use indeces while hashed will not use index.
http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm
declaration:
TYPES: BEGIN OF TY_STUDENT,
SNO TYPE I,
SNAME(5),
END OF TY_STUDENT.
DATA: IT_STUDENT TYPE TABLE OF TY_STUDENT (STANDARD TABLE DECL)
DATA: IT_STUDENT TYPE SORTED TABEL OF TY_STUDENT (SORTED)
DATA: IT_STUDENT TYPE HASHED TABLE OF TY_STUDENT WITH KEY... (HASHED)
TYPES - tabkind
Syntax
... { {STANDARD TABLE}
| {SORTED TABLE}
| {HASHED TABLE}
| {ANY TABLE}
| {INDEX TABLE} } ... .
Effect
Definition of the table type in an internal table.
You can specify the non-generic table types standard table ( STANDARD TABLE), sorted table ( SORTED TABLE), and hashed table (HASHED TABLE), as well as the generic table types ANY TABLE and INDEX TABLE. The addition STANDARD is optional for standard tables.
The non-generic table types determine the internal administration and access type in the ABAP program for an internal table:
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.
The generic table types define a generic table type that can only be used for typing formal parameters and field symbols:
ANY TABLE includes all table types.
INDEX TABLE includes all standard tables and sorted tables.
Regards
Lalit
‎2007 Dec 28 10:55 AM
‎2007 Dec 28 10:58 AM