SAP TYPES ITAB ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• TYPE TABLE OF TYPES

TYPES, TABLE OF
Short Reference

ABAP_SYNTAX
TYPES table_type ${ ${TYPE tabkind OF $[REF TO$] type$}
$| ${LIKE tabkind OF dobj$} $}
$[tabkeys$]
$[INITIAL SIZE n$].


ABAP Addition
... INITIAL SIZE n

What does it do?
This statement defines a table type table_type with a specific line type, a table category tabkind, and table keys tabkeys .
The line type is determined by entering the data type type after TYPE and data type dobj after LIKE:
type can be a non-generic data type from ABAP Dictionary, a non-generic public data type of a public data type of a global class, a non-generic data type local to a program, a CDS simple type, or any ABAP type from the tables of built-in ABAP types. The generic ABAP types c, n, p, and x are extended implicitly to the standard length without decimal places from the tables of built-in ABAP types. If the addition REF TO is specified before type or dobj, the line type is a reference type. The information specified in the section reference types can then be specified for type and dobj.
The same applies to dobj as to TYPES ... LIKE.

ABAP_EXAMPLE_VX5
Definition of a non-generic sorted table type. The line type corresponds to the structure of the database table SPFLI. Two key fields are defined for the primary table key.
ABEXA 00724
ABAP_EXAMPLE_END
• INITIAL SIZE TYPES

ABAP Addition

What does it do?
The optional addition INITIAL SIZE has two meanings:
Initial Memory Requirement The addition INITIAL SIZE affects the initial memory requirement of an internal table of the table type. A number of lines n can be specified directly as a positive number without +/- sign or as a numeric constant to give the ABAP runtime framework a hint for the size of the initial memory requirement. In the following cases, the ABAP runtime framework allocates the initial memory area fully by itself:
The addition INITIAL SIZE is not used.
A value of 0 is specified for n.
If the value of n would cause the initial blocks to become too big.
Size of Ranking Lists To create a ranking list in the internal table using the addition SORTED BY of the statement APPEND, a value greater than 0 must be specified after INITIAL SIZE. This value determines the size of the ranking list.

ABAP_PGL
Modify the initial memory requirement only for nested tables
ABAP_PGL_END



Latest notes:

Specifying the initial memory requirement is only recommended if the number of entries in the table has been determined in advance and the initial main memory requirement is to be dimensioned in the most suitable way. This can be especially important for internal tables that are components of table types and only contain a few lines.
Instead of APPEND SORTED BY, the statement SORT should be used so that the addition INITIAL SIZE is no longer necessary.
NON_V5_HINTS
ABAP_HINT_END

Return to menu