02-13-2008 3:15 AM
Hi friends,
In what are the ways can we construct the internal table ? Can you tell me the advantages and disadvantages ?
02-13-2008 3:19 AM
02-13-2008 3:54 AM
Hi ,
Please tell me that How many methods can we construct the internal table......
02-13-2008 4:05 AM
HI
data:begin of st_itab,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of st_itab.
types : it_itab type standard table of st_itab,
wa_itab type st_kna1.
data: begin of it_itab occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of it_itab.
types it_kna1 type kna1 occurs 0.
02-13-2008 4:04 AM
hi,
Like all local data types in programs , you define internal tables using the TYPES statement. If you do not refer to an existing table type using the TYPE or LIKE addition, you can use the TYPES statement to construct a new local internal table in your program.
TYPES <t> TYPE|LIKE <tabkind> OF <linetype> [WITH <key>]
[INITIAL SIZE <n>].
After TYPE or LIKE, there is no reference to an existing data type. Instead, the type constructor occurs:
<tabkind> OF <linetype> [WITH <key>]
The type constructor defines the table type <tabkind>, the line type <linetype>, and the key <key> of the internal table <t>.
ex:
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
for more details,check the site:
http://help.sap.com/saphelp_nw04/helpdata/en/79/c5547cb3dc11d5993800508b6b8b11/frameset.htm
02-13-2008 4:24 AM
Hi,
You can define internal tables either with (WITH HEADER LINE addition) or without header lines.
An internal table with header line consists of a work area (header line) and the actual table body. You address both objects
using the same name. The way in which the system interprets the name depends on the context. For example, the MOVE statement applies to the header line, but the SEARCH statement applies to the body of the table.
To avoid confusion, you are recommended to use internal tables without header lines. This is particularly important when you use nested tables. However, internal tables with header line do offer a shorter syntax in several statements
( APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, LOOP ).
Within ABAP Objects, you can only use internal tables without a header line. You can always address the body of an internal table <itab> explicitly by using the following syntax: <itab>[]. This syntax is always valid, whether the internal table has a header line or not.
Example
DATA itab1 TYPE TABLE OF i WITH HEADER LINE.
DATA itab2 TYPE TABLE OF i WITH HEADER LINE.
itab1 = itab2. " Only header lines will be copied
itab1[] = itab2[]. " Copies table body
Regards,
Bhaskar
02-13-2008 4:28 AM
hi kumar,
you can declatre internal tables in two ways:
occurs N with header line (N is a integer)
without header line
syntax 1: begin of internal table name occurs N with
header line,
filed declarations,
end of internal table name.
syntax 2: begin of internal table name,
filed declarations,
end of internal table name.
if you want copy data base table as internal table,
syntax3: itab like DBtable.
reward if useful
02-13-2008 4:34 AM
hi kumar,
this is possibly the best link you can get for the INTERNAL TABLEs...it's advantages...the ways of creation etc..
http://venus.imp.mx/hilario/Libros/TeachYrslfAbap4/ch11.htm
give credit if helpful
rohan malik