10-11-2007 8:17 AM
hello,
please let me know how to create the internal table.
thanks
sujatha
10-11-2007 8:19 AM
Hi
creat a structure of what ever fields you want
by useing types
<b>ex</b>
TYPES : BEGIN OF ST_OBJID_SH,
OTYPE TYPE HRP1000-OTYPE,
OBJID TYPE HRP1000-OBJID,
END OF ST_OBJID_SH.
creat the internal table like this
DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
creat the work area like this
DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
this is the better way to use internal tables
<b>reward if usfull</b>
10-11-2007 8:20 AM
Hi,
e.g. DATA: BEGIN OF STRUC,
NAME(10) TYPE C,
SALDO TYPE P,
END OF STRUC,
ITAB LIKE TABLE OF STRUC.
If you need an internal table with header, you can work with "occurs 0" or "with header line"
Regards Nicole
10-11-2007 8:23 AM
hi sujatha.
1st way :-
TYPES: BEGIN OF t_table_mpla,
warpl TYPE mpla-warpl, "Maintenance Plan
topos TYPE mpla-topos, "Tolerance
abrho TYPE mpla-abrho, "Scheduling Period
hunit TYPE mpla-hunit, "Unit of Scheduling Period
END OF t_table_mpla.
Data : i_table_mpla TYPE STANDARD TABLE OF t_table_mpla.
2nd way :-
DATA: BEGIN OF i_table_final OCCURS 0,
aufnr LIKE aufk-aufnr,
ktext LIKE aufk-ktext,
ilart LIKE afih-ilart,
pdat2 LIKE aufk-pdat2,
end of i_table_final.
Rewars if useful.
10-11-2007 8:23 AM
hi
good
Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for storing and formatting data from a database table within a program. They are also a good way of including very complicated data structures in an ABAP program.
Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects A data type is the abstract description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. The data type is also an attribute of an existing data object
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
reward point if helpful.
thanks
mruytun^
10-11-2007 8:23 AM
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.
TYPES
STANDARD table
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.
SORTED table
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.
HASHED table
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.
INDEX table
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.
Syntax :
DATA itab TYPE table type of line type [WITH UNIQUE/NON-UNIQUE KEY ]
[Iinitial size n] [WITH HEADER LINE]
Internal table declaration - 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)
Reward pts for usefull answers
Regards
Shakir
10-11-2007 8:27 AM
Hi,
<b> Creating Internal Tables</b>
Like other elements in the ABAP type concept, you can declare internal tables as abstract data
types in programs or in the ABAP Dictionary, and then use them to define data objects.
Alternatively, you can define them directly as data objects. When you create an internal table as a
data object, you should ensure that only the administration entry which belongs to an internal
table is declared statically. The minimum size of an internal table is 256 bytes. This is important if an
internal table occurs as a component of an aggregated data object, since even empty internal
tables within tables can lead to high memory usage. (In the next functional release, the size of the
table header for an initial table will be reduced to 8 bytes). Unlike all other ABAP data objects, you
do not have to specify the memory required for an internal table. Table rows are added to and
deleted from the table dynamically at runtime by the various statements for adding and deleting
records.
You can create internal tables in different types.
You can create standard internal table and then make it sort in side the program.
The same way you can change to hashed internal tables also.
There will be some performance issues with regard to standard internal tables/ hashed internal
tables/ sorted internal tables.
Reward if useful.