‎2009 Mar 24 6:53 PM
hi frnds..
can any one tell the 3 types of internal table declarations with detailed explanation abt each type clearly...plsss
thanx in adv..
‎2009 Mar 24 6:57 PM
HI,
[Search|http://www.google.co.in/search?hl=en&q=typesofinternaltables&btnG=GoogleSearch&meta=] the SCN or Google to find the answer for your basic question.
‎2009 Mar 24 7:00 PM
read my question correctly boss....m not asking 3 types of int tables...m asking 3 types of int tab declarations
‎2009 Mar 24 7:02 PM
‎2009 Mar 24 7:04 PM
thanx mate but can u explain these below clearly plsss...
In the DATA: statement using the OCCURS clause.
DATA: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
Using the TYPES:
TYPES: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
DATA: ITAB TYPE STANDARD TABLE OF STRUCTURE
WITH KEY XXXXX
WITH HEADER LINE
INITIAL SIZE N.
‎2009 Mar 24 7:08 PM
‎2009 Mar 24 7:02 PM
hi,
For extremely large internal tables, use HASHED tables. This will increase performance by allowing a constant read access time for records. For smaller internal tables, use SORTED tables, in which binary search is used.
Do not use internal tables with header but define the header line separately.
The CLEAR statement should be used to initialize the table header line.
The REFRESH statement should be used to delete all table entries and release any paged-out area.
If you do not specify an OCCURS clause or INITIAL SIZE, it defaults to zero. OCCURS is still needed when declaring a table in the BEGIN OF u2026 statement.
STANDARD TABLES are read in linear fashion.
Using the TYPES statement to declare a structure and the DATA statement to declare an internal table will allow one to create SORTED and HASHED tables.
SORTED TABLES save records ascending by key and index.
They offer the ability to read data logarithmically decreasing read access time.
HASHED TABLES save records using a unique key, can only be read using that key, and offer a constant read access time irrelevant of how many records are stored.
There are 3 types of internal tables (standard, sorted, and hashed) and 2 categories (Index and Hashed).
Category: Index Tables
Type: Standard Tables
Standard tables cannot have a UNIQUE KEY.
Standard tables can be declared with DEFAULT KEY, which is a combination of all non-numeric fields in the record.
Standard tables searched by their key are searched in a linear fashion and therefore access time is dependent on where in the table the matching record is stored.
Standard tables can be searched by their index.
Declaring a Standard Table:
In the DATA: statement using the OCCURS clause.
DATA: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
Using the TYPES:
TYPES: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
DATA: ITAB TYPE [TABLE | STANDARD TABLE] OF STRUCTURE
WITH KEY XXXXX
WITH HEADER LINE
INITIAL SIZE N.
Type: Sorted Tables
Sorted tables must have either a UNIQUE or NON-UNIQUE key.
Sorted tables are saved in sorted order, if the key is non-unique, they are sorted from the lowest index.
Sorted tables should be read using their keys.
Sorted tables retrieve data using the binary search and the data access time is dependent on the amount of records.
Declaring a Sorted Table:
Using the TYPES:
TYPES: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
DATA: ITAB TYPE SORTED TABLE OF
STRUCTURE
WITH [UNIQUE | NON-UNIQUE] KEY XXXXX
WITH HEADER LINE
INITIAL SIZE N.
Category: Hashed Tables
Type: Hashed Tables
Hashed tables must have a unique key.
Hashed tables use a hashing algorithm to have a constant access time for the data.
It is recommended to use Hashed tables for excessively large internal tables.
Declaring Hashed Tables:
Using the TYPES:
TYPES: BEGIN OF STRUCTURE OCCURS 0,
PERNR LIKE PERNR-PERNR,
VORNA LIKE PA0002-VORNA,
END OF STRUCTURE.
DATA: ITAB TYPE HASHED TABLE OF
STRUCTURE
WITH UNIQUE KEY XXXX
WITH HEADER LINE
INITIAL SIZE N.
Regards,
Prabhudas