‎2007 Jul 19 10:08 AM
‎2007 Jul 19 10:10 AM
An internal table is a temporary storage in the program memory which lasts only till the execution of the program. It can stored two dimensional data.
There are no alternatives for internal tables and hence i don't see any disadvatages for Internal tables,(Even if internal tables have some limitations, i don;t think they can be disadvantages).
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
‎2007 Jul 19 10:12 AM
Hi,
See the Following documents :
http://www.sapmaterial.com/internal_tables_all.html
Reward points if helpful
Regards
Srikanta Gope
‎2007 Jul 19 10:13 AM
Hi,
Internal table in ABAP
*An internal table is a run time instance. It get created when program starts execution.
*It get destroyed when program terminates. it has two different parts. HeaderLine(optional) & Body(Compulsory).
*Any value that comes to or goes from interanal table , that travels through headerline.\
*
A related program is .
*declaration.
data: begin of inernaltable occurs 0,
x type c,
y type i,
end of itab.
*initializing headerline
internaltable-x = 'd'.
internaltable-y = 34.
*storing value into internal table
appene internaltable .
appene internaltable .
appene internaltable .
*reading internal table
loop at itab .
write: / internaltable-x, internaltable-y. "writes to output list
endloop.
<b>TYPES</b>
<b>STANDARD table</b>
Key access to a standard table uses a linear search. This means that the time required
for a search is in linear relation to the number of table entries.
You should use index operations to access standard tables.
<b>SORTED table</b>
Defines the table as one that is always saved correctly sorted.
Key access to a sorted table uses a binary key. If the key is not unique, the system takes
the entry with the lowest index. The runtime required for key access is logarithmically
related to the number of table entries.
<b>HASHED table</b>
Defines the table as one that is managed with an internal hash procedure
You can only access a hashed table using the generic key operations or other generic
operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as
LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.
<b>
INDEX table</b>
A table that can be accessed using an index.
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.
Standard tables and sorted tables are index tables.
<b>Syntax :</b>
DATA itab TYPE table type of line type [WITH UNIQUE/NON-UNIQUE KEY ]
[Iinitial size n] [WITH HEADER LINE]
<b>Internal table declaration</b> - various ways of declaring an internal table
Declaring internal tables is an essential part of writing ABAP code as this is where most of the data retrieved
from database tables will be stored. During the select statement you retrieve data from a database table into
an internal table (multiple rows) or a work area or header line (single row).
REPORT ZTYPES .
* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0, "itab with header line
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
END OF tab_ekpo.
*Table declaration (new method) "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0, "itab
wa_ekpo TYPE t_ekpo. "work area (header line)
* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0, "old method
wa_datatab LIKE LINE OF tab_ekpo.
* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!!
TYPES: bukrs TYPE ekpo-werks,
bstyp TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0, "itab
wa_repdata TYPE t_repdata. "work area (header line)
<b>Reward pts for usefull answers :)</b>
Regards
Sathish
‎2007 Jul 19 10:18 AM
hi
Internal table in ABAP
*An internal table is a run time instance. It get created when program starts execution.
*It get destroyed when program terminates. it has two different parts. HeaderLine(optional) & Body(Compulsory).
*Any value that comes to or goes from interanal table , that travels through headerline.\
*A related program is .
*declaration.
data: begin of inernaltable occurs 0,
x type c,
y type i,
end of itab.
*initializing headerline
internaltable-x = 'd'.
internaltable-y = 34.
*storing value into internal table
appene internaltable .
appene internaltable .
appene internaltable .
*reading internal table
loop at itab .
write: / internaltable-x, internaltable-y. "writes to output list
endloop.
Fields of Internal Tables
SY-TABIX
Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.
APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.
SY-TFILL
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
SY-TLENG
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the length of the lines in the relevant internal table.
SY-TOCCU
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the initial amount of memory allocated to the relevant internal table.
regards
dinesh
‎2007 Jul 19 10:18 AM
Hi,
Check this URL.
http://www.sap-img.com/ab009.htm
http://www.itsmarc.com/crs/Clas0302.htm
http://www.sapdevelopment.co.uk/tips/tips_itab.htm
http://searchsap.techtarget.com/search/1,293876,sid21,00.html?query=whatisinternaltable&bucket=ALL
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
<b>Reward points if useful</b>
Regards
Ashu
‎2007 Jul 19 11:13 AM
Hi,
In the following link, you can download "Abap Programming Complete Guide", inthat you can go to page no: 251.
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/ABAP_tutorial.html
Regards,
Bhaskar
‎2007 Jul 19 11:28 AM
hi
Internal table in ABAP
*An internal table is a run time instance. It get created when program starts execution.
*It get destroyed when program terminates. it has two different parts. HeaderLine(optional) & Body(Compulsory).
*Any value that comes to or goes from interanal table , that travels through headerline.\
*A related program is .
*declaration.
data: begin of internaltable occurs 0,
x type c,
y type i,
end of itab.
*initializing headerline
internaltable-x = 'd'.
internaltable-y = 34.
*storing value into internal table
appened internaltable .
appened internaltable .
appened internaltable .
*reading internal table
loop at itab .
write: / internaltable-x, internaltable-y. "writes to output list
endloop.
follow this link: http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
reward if useful
‎2007 Aug 11 2:32 PM