Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How we will decide which INTERNAL TABLE should be used What is the criteri

Former Member
0 Kudos

How we will decide which INTERNAL TABLE should be used What is the criteria to decide such?

1 REPLY 1

Former Member
0 Kudos

based on table type.

select db table.

TYPES - TABLE OF

Syntax

TYPES dtype { {TYPE tabkind OF [REF TO] type}

| {LIKE tabkind OF dobj} }

[WITH key] [INITIAL SIZE n].

Addition:

... INITIAL SIZE n

Effect

This statement defines a table type dtype with a specific row type, a table type tabkind, and a table key key.

The row 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 the ABAP Dictionary, a non-generic public data type of a global class, a non-generic program-local data type, or any ABAP type from the table of predefined ABAP types. The generic ABAP types c, n, p, and x are implicitly extended to the standard length without decimal places from the table of predefined ABAP types.

If the addition REF TO is specified before type or dobj, then the row type is a reference type. The information specified in section reference types can then be entered for type and dobj.

dobj can be a data object visible at this point, whose type is adopted as the row type. Within a procedure, you cannot specify a generic typed formal parameter for dobj.

Addition

... INITIAL SIZE n

Effect

After the optional addition INITIAL SIZE, you can specify a number of rows n as a numeric literal or numeric constant to adjust the size of the first block in the memory that is reserved by the system for an internal table of the table type. Without this addition, if the number 0 is entered, or the value of n exceeds a maximum value, the system automatically allocates an appropriate memory area. If this is no longer sufficient, the system creates an additional block twice the size of the first block as long as this size does not exceed 8 KB. Additional areas are created where necessary with a size of 12 KB. The maximum value is calculated as 8 KB divided by the memory required for a row. In the case of larger values, a block size of 12 KB is automatically selected.

Note

You are advised to specify the initial memory requirements only when the number of entries in the table has already been specified and the initial main memory requirement has an adequate value. This can be especially important for internal tables that are components of table types and only contain a few rows.

Example

Definition of a non-generic sorted table type. The row type corresponds the structure of the database table SPFLI. Two key fields are defined for the table key.

TYPES spfli_sort TYPE SORTED TABLE OF spfli

WITH UNIQUE KEY carrid connid.