‎2005 Dec 15 9:54 PM
Hi Gurus,
I am new to ABAP. Could any one tell me what is an internal table and what does it do, and how many types of internal tables are there.
Thanks in advance,
Kiran
‎2005 Dec 15 10:20 PM
Hi,
Internal table is a standard data type object, which exists only during the runtime of the program
There are 3 types of Internal tabeles
<b>1) Standard Internal Tables</b>
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.
<b>2) Sorted Internal Tables</b>
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.
<b>3) Hashed Internal Tables</b>
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.
Use this link either :
http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm
Regards
Sudheer
‎2005 Dec 15 10:01 PM
In internal table is a program entity that can hold data in a table like fashion during runtime of the program. Say if you want to store data from a database table in your program and manipulate it, then you will want to use an internal table. THere are 3 kinds. Standard, Sorted, and Hashed. Here is the help on internal tables.
http://help.sap.com/saphelp_470/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
Regards,
Rich Heilman
‎2005 Dec 15 10:04 PM
Internal table is a defined structured object wherein we can store data temporarily and process the data as per our requirement. They will be defined as
DATA itab TYPE itabtype WITH HEADER LINE
where itab is the internal table and itabtype is the structure of the internal table.
The other way of defining an internal table is
data: Begin of itab occurs 0,
field1 type xxxx,
field2 type yyyy,
---
--
end of itab.
Hope this gives you some idea.
‎2005 Dec 15 10:20 PM
Hi,
Internal table is a standard data type object, which exists only during the runtime of the program
There are 3 types of Internal tabeles
<b>1) Standard Internal Tables</b>
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.
<b>2) Sorted Internal Tables</b>
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.
<b>3) Hashed Internal Tables</b>
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.
Use this link either :
http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm
Regards
Sudheer
‎2005 Dec 15 10:20 PM
HI Kiran,
SAP R/3 is a real time 3 tier systems, follows as
Presentation server: GUI.
Application server: Architecture followed by an Organization.
Database server: Database of an Organization.
INTERNAL TABLES in ABAP can be defined as a temporary table stored in RAM on the Application Server. Its populated during the execution of the program and discarded when the program end. It requires nearly 8KB memory.
In other words, it acts a Bridge or as an Interface between the Program and database. Any operations such as addition, deletion or modification of records in a database are run through by these internal tables.
Internal table can be divided in to two segments.
1. Header
2. Body.
Like Database table, an internal table consists of one or more rows with an identical structure, but unlike a database table it cannot hold data after the program ends.
The Header acts a buffer with an entry point as well as an exit point for the datas when added or retrieved.
The Body is a mandatory segment, which is used to hold the rows of the internal tables.
Both the Header and Data have an identical structure.
Internal Tables can be declared with headers or without headers.
With Header Line: begin of to be included during declaration.
Without Header Line: like to be included during declaration.
To define an Internal body, use occurs on the definition. Occurs creates the body of the internal table. Occurs creates the number of rows in the internal table as it is specified during declaration.
For example Begin of i_marav occurs 10 , allocates 10 rows in the internal table. It does not limit the number of rows to be added, if it specified as occurs 0, the system allocates 8kb memory for the internal table.
Transaction Code for ABAP EDITOR : SE38.
Creation of Internal tables: SE38
Declaration of an internal table should always be initialized with I_ Internal table name
<b>
Example for With Header:</b>
report ztx1101.
data: begin of it1 occurs 10, "has a header line"
f1,
f2,
f3,
end of it1.
<b>
Example for without Header</b>
Data i_mara like Ztx1fa1 occurs 100.
Here, it defines an internal table i_mara. It has the same component as DDIC structure Ztx1fa1.
There are 3 types of internal tables.
Standard Internal Tables: These tables have a linear index and can be
accessed using the index or the key. The response time is in linear
relationship with number of table entries. These tables are useful when user
wants to address individual table entries using the index.
2.Sorted Internal Tables: These tables also have an index and the key. But,
the response time is in logarithmic relationship with number of table
entries, since it uses binary search algorithm instead of linear search.
These tables are useful when user wants the table to be sorted while
additional entries have to be added.
3.Hashed Internal Tables: These tables have no index, but have the key. The
response time is constant irrespective of number of table entries, since it
uses a Hash algorithm. These tables are useful when user wants to access the
entries with key only.