SAP NEWS-610-TABELLEN

Get Example source ABAP code based on a different SAP table
  



Internal Tables in Release 6.10

In Release 6.10, the following enhancements have been made to internal table functions:

1 Creating a table object
2 Checking the convertibility of key fields
3 Duplicate or overlapping key specifications
4 Support for accessing attributes
5 Table categories for text pools and IN conditions
6 Handling overflows in COLLECT and SUM
7 Additions ASSIGNING and REFERENCE INTO
8 Uppercase and lowercase spelling in dynamic components
9 Combined key specifications with table_line
10 Establishing the number of rows in an internal table
11 Optimization when accessing internal tables
12 Offset and length declarations for the table definition

ABAP_MODIFICATION_1 Creating a table object


You can create any table objects at runtime by using the CREATE DATA statement. If the table type is known in full then this is taken into account by the syntax check.

ABAP_MODIFICATION_2 Checking the convertibility of key fields


In the case of the statements READ TABLE itab WITH KEY k1 = v1 .... kn = vn and DELETE TABLE itab WITH KEY = v1 .... kn = vn, the system already checks whether the key values are convertible to the component type in the syntax check. This convertibility check is also effective for the newer variant READ ... WITH TABLE KEY .... Previously, the runtime error MOVE_NOT_SUPPORTED was triggered if the conversion was not possible.

ABAP_MODIFICATION_3 Duplicate or overlapping key specifications


In the case of duplicate or overlapping key specifications, the statement READ TABLE itab WITH KEY k1 = v1 .... kn = vn now triggers a syntax error instead of a syntax warning. If specified dynamically, it was previously the case that the last key specification was used; now the runtime error DYN_KEY_DUPLICATE is triggered.

ABAP_MODIFICATION_4 Support for accessing attributes


The ... COMPARING o->attr addition now lets you access the attributes of objects that are components of internal tables, similar to when reading, changing, deleting, or sorting internal tables.

ABAP_MODIFICATION_5 Table categories for text pools and IN conditions


Alongside standard tables, the tables categories HASHED and SORTED are supported for the statements READ , DELETE, and INSERT TEXTPOOL .... The IN conditions for SELECT ... WHERE and LOOP ... WHERE are now also independent of the table category.

ABAP_MODIFICATION_6 Handling overflows in COLLECT and SUM


Previously, fields of type f were only checked for possible overflows in the case of arithmetic additions. When using COLLECT and SUM, the addition was terminated in accordance with IEEE standards and a runtime error was triggered as soon as the overflow limit (Infinity ) was reached. Now this raises the exception CX_SY_ARITHMETIC_OVERFLOW, which can be caught using TRY.

ABAP_MODIFICATION_7 Additions ASSIGNING and REFERENCE INTO


The additions ASSIGNING and REFERENCE INTO are now available for the statements READ, LOOP, INSERT , APPEND, MODIFY , and COLLECT. Previously, only the ASSIGNING addition for the keywords LOOP and READ was available.

ABAP_MODIFICATION_8 Uppercase and lowercase spelling in dynamic components


Previously, the field content of a dynamic component always had to written in capitals, for example SORT ... BY ('COMP'). Now lowercase spelling is valid in specifications for all internal table commands.

ABAP_MODIFICATION_9 Combined key specifications with table_line


Now there are additional key specifications for the pseudo component table_line. Previously, it was not possible to have a key specified in the form READ ... WITH KEY table_line->attr = ... table_line = ... BINARY SEARCH , for example, where both the value of the attribute ATTR and the value of the reference itself were the key.

ABAP_MODIFICATION_10 Establishing the number of rows in an internal table


You can establish the number of rows in an internal table using the LINES function. For consistency, this function is intended to replace the statement DESCRIBE TABLE in the long term, since you cannot describe all ABAP types using DESCRIBE.

ABAP_MODIFICATION_11 Optimization when accessing internal tables


For Release 6.10, optimized access to tables of the types SORTED and HASHED has been introduced. For more details, see the section on Optimized Key Operations.

In addition, in the case of assignments between internal tables of the same type, data is now only copied if changes were made to these tables. This table sharing has a positive effect on runtime and the memory required.

Until now, these optimizations had to be carried out explicitly using field symbols. Now you can work normally with a work area, because no table is copied when reads are performed.

ABAP_MODIFICATION_12 Offset and length declarations for the table definition


Previously, components of the table key could be specified with offset and length declarations, which resulted in undefined runtime behavior. This is no longer possible and a syntax error is triggered instead.