ABAP Keyword Documentation → ABAP - Release-Specific Changes → Changes in Release 4.6A
Internal Tables in Release 4.6A
In Release 4.6A, the following new features have been introduced in internal tables:
1. New key specification for unstructured internal tables
4. Key definition for tables in the ABAP Dictionary
5. Key for unstructured tables
6. Changes to the internal structure
7. Sort without specifying the sort key
8. Access to write-protected tables
9. Index areas in table extensions
10. IS REQUESTED
with TABLES
parameters
11. Tables as attributes of object types
13. Multiple identical key specifications
Other versions: 7.31 | 7.40 | 7.54
Modification 1
New Key Specification for Unstructured Internal Tables
If the line type of an internal table has no structure, you can use the
pseudo component
table_line to specify or address the entire table line as the key. The previous specification, the form TABLE LINE
is now obsolete. If a
structure contains a component called table_line
, this leads to a warning in the syntax check.
Modification 2
References as Table Key
References are now allowed in the key of an internal table.
Modification 3
Strings as Table Key
Strings
are now allowed in the key of an internal table. This applies to all table types.
Modification 4
Key Definition for tables in the ABAP Dictionary
If you define an internal table in the ABAP Dictionary, it is now possible to specify the table key explicitly.
Modification 5
Default Key of Unstructured Tables
The default key of an internal table without a line structure always consists of the whole line. The exception is a table of a table, which has an empty key.
Modification 6
Change to the Internal Structure
Previously, internal tables have been represented at runtime using a structure 256 bytes long. This has now been replaced by a reference that is only 8 bytes long. This means that structures containing tables as components or tables that contain other tables can now be stored far more efficiently, since an empty table now only requires 8 bytes of memory instead of 256. This is particularly noticeable with structures with only a few entries. Furthermore, the header of a filled table now only requires approximately half of the 256 bytes previously required (the actual figure depends on the platform).
Remember to adjust any structures in the ABAP Dictionary with a field of length 256 bytes intended to accommodate a table header.
Modification 7
Sorting Without Specifying the Sort Key
Sorting an internal table with type STANDARD
or HASHED
using the
SORT
sort statement now returns a correct result, even if you do not specify the sort key in the BY
addition.
Modification 8
Accessing Write-Protected Tables
In the DELETE
,
INSERT
, and MODIFY
statements,the system returns a syntax error if you specify a write-protected table. This error used to result in a runtime error.
Modification 9
Index Areas with Table Extensions
The statements INSERT LINES OF itab ...
and APPEND LINES OF
itab ... return syntax errors if the source table has the type HASHED
or ANY
andyou use the FROM
and TO
additions to specify an index range. This error used to result in a runtime error.
Modification 10
IS REQUESTED
with TABLES
Parameters
When you use the relational operator IS
REQUESTED in connection with TABLES
parameters in update function modules, the syntax check issues a
warning. These parameters are always supplied.
Modification 11
Tables as Attributes of Objects
The LOOP
,
READ
, SORT
,
DELETE
, and
MODIFY
statements now support access to the attributes of objects as the key of an internal table.
If the line type of an internal table contains object reference variables from
ABAP Objects as the component comp
,
you can use the attributes attr
of the object to which the reference is pointing
as key values when reading, sorting, and changing the table. This is possible in the following statements:
LOOP AT itab ... WHERE comp->attr ...
READ TABLE itab ... WITH [TABLE] KEY comp->attr = ...
SORT itab BY comp->attr ...
DELETE itab WHERE comp->attr ...
MODIFY itab ... TRANSPORTING ... WHERE comp->attr ...
Modification 12
References as Line Type
In the declarative statements DATA
,
STATICS
, and
TYPES
, you may use object and data references as the line type of an internal table.
Modification 13
Multiple Identical Key Specifications
Identical key specifications that occur more than once in the READ
statement lead to a
warning.