Application Development and Automation 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: 
Read only

internal tables types

Former Member
0 Likes
583

how mant types of internal tables r there?

what r the syntaxes of their?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
547

hi ...

data: begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

end of itab.

or

types: begin of ty_mara,

matnr type mara-matnr,

meins type mara-meins,

end of ty_mara.

data: it_mara type standard table of ty_mara with header line.

or

data: beign of itab occurs 0.

include structure <mara>.

data: end of itab.

regards,

venkat.

4 REPLIES 4
Read only

Former Member
0 Likes
548

hi ...

data: begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

end of itab.

or

types: begin of ty_mara,

matnr type mara-matnr,

meins type mara-meins,

end of ty_mara.

data: it_mara type standard table of ty_mara with header line.

or

data: beign of itab occurs 0.

include structure <mara>.

data: end of itab.

regards,

venkat.

Read only

vinod_vemuru2
Active Contributor
0 Likes
547

Hi Sridhar,

Mainly there are 3 types of internal tables out of which we will generally use 2 types.

1. STANDARD TABLE

2. SORTED TABLE

3. HASHED TABLE

STANDARD AND SORTED tables works on INDEX mechanism(generally used ones) and HASHED table works on internal hash algorithm defined by SAP.

Most effective way of defining an internal table.

Defining types

TYPES: BEGIN OF t_vbak,

vbeln TYPE vbak-vbeln,

erdat TYPE vbak-erdat,

.

.

END OF t_vbak.

Defining internal table.

DATA: i_vbak TYPE STANDARD/SORTED/HASHED table of t_vbak.

Defining explicit work area.

DATA: wa_vbak TYPE t_vbak.

Check below link for more information on internal tables

http://help.sap.com/saphelp_470/helpdata/EN/fc/eb35de358411d1829f0000e829fbfe/frameset.htm

Thanks,

Vinod,

Read only

Former Member
0 Likes
547

Hi Sridar,

Different Types Of Internal Tables and Their Usage

Standard Internal Tables

Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.

This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to

the number of table entries.

Sorted Internal Tables

Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.

This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of

table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.

Hashed Internal Tables

Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.

This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and

using internal tables that are similar to database tables.

Index Tables

Index table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type INDEX.

Internal tables are not DB tables. Standard and Sorted tables in combined are basically called as Index tables and there nothing else. Here is the hierarchy

ANY TABLE

-


Index Tables Hashed Table

-


Standard Table Sorted Table

Thanks&Regards,

Phani,

Points If Helpful.

Read only

prasanth_kasturi
Active Contributor
0 Likes
547

hi,

there are three types of internal tables...

Standard

Sorted

hashed

TYPES: BEGIN OF LINE,

COLUMN1 TYPE I,

COLUMN2 TYPE I,

COLUMN3 TYPE I,

END OF LINE.

TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.

The program defines a table type ITAB. It is a sorted table, with line type of the structure LINE and a unique key of the component COLUMN1.

TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.

TYPES: BEGIN OF LINE,

COLUMN1 TYPE I,

COLUMN2 TYPE I,

COLUMN3 TYPE I,

END OF LINE.

TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.

TYPES: BEGIN OF DEEPLINE,

FIELD TYPE C,

TABLE1 TYPE VECTOR,

TABLE2 TYPE ITAB,

END OF DEEPLINE.

TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE

WITH DEFAULT KEY.

reward if helpful

prasanth