SAP - MM
SAP Inventory Management Tutorial: Movement Types {OMJJ}
Inventory management is used to manage the inventory for the goods. It is based on several key...
INTERNAL TABLE are used to obtain data from a fixed structure for dynamic use in ABAP. Each line in the internal table has the same field structure. The main use for internal tables is for storing and formatting data from a database table within a program.
In this tutorial you will learn:
Work areas are single rows of data. They should have the same format as any of the internal tables. It is used to process the data in an internal table one line at a time.
A picture says a thousand words :-)
There are two types of internal tables.
Internal Tables with Header Line
Internal Tables without Header Line :
There are many ways to create an Internal Table. Lets look at them one by one-
1.By Using the Type Statement
Let us now create a Internal table itab using the TYPE statement.
The syntax is -
Types : begin of line, column1 type I, column2 type I, end of line.
Example:
TYPES : begin of line, empno type I, empname(20) type c , end of line.
The TYPES statement creates a structure line as defined.
To actually create an Internal Table itab use the following command-
Data itab type line occurs 10.
An internal table itab is created with the structure of line.Besides declaring the structure of an internal table, the OCCURS clause also defines how many table entries are maintained in main storage(in this case 10). Extra records are written out to paging area and can effect performance
2.By referring to another Table
You can create an internal table by referring to an existing table. The existing table could be a standard SAP table, a Z table or another internal table.
Syntax-
Data <f> <type> [with header line].
Example-
DATA itab TYPE line OCCURS 10 with header line.
Here an internal table itab is created of the type line with a header line. Please note "with header line" is optional
3.By referring to existing Structure
Syntax-
Data <f> LIKE <struct> occurs n [with header line].
Example-
DATA itab LIKE sline OCCURS 10.
Here a table itab is created having a structure same as that of sline
4.By creating a new Structure
Let us now create an internal table with a structure of our own. Here the table is created with an Header line, by default.
Syntax -
Data : Begin of <f> occurs <n>, <component declaration>, ................................., End of <f>.
Example -
Data : Begin of itab occurs 10, column1 type I, column2(4) type C, column3 like mara-ernam, End of itab.
Internal table itab is created
APPEND [<wa> TO / INITIAL LINE TO] <itable>.Here work area <wa> or the Initial Line is appended to the internal table <itable>.
Data: Begin of itab occurs 10, col1 type C, col2 type I, end of itab. Append initial line to itab.
COLLECT [<wa> INTO] <itable>.
INSERT [<wa> INTO / INITIAL LINE INTO] <itable> [index <idx>].
MOVE <itab1> To <itab2>. OR <itab1> = <itab2>.
itab1[] = itab2[].
LOOP AT <itable> [INTO <wa>] ................................... ENDLOOP.
READ TABLE <itable> [INTO <wa>] INDEX <idx>.
DELETE <ITABLE>.
DELETE <ITABLE> INDEX <IDX>.The line with the index <IDX> is deleted. The index of the following line is decremented by 1.
Inventory management is used to manage the inventory for the goods. It is based on several key...
Overview SAP CRM has many standard roles defined (for e.g., Sales Professional) and applications...
EDI, stands for Electronic Data Interchange, is the electronic exchange of structured business...
Though SAP provides a wide array of reports to view your OM related data, the best and easiest of...
What is Business Blueprint in SAP? The SAP Blueprint is a detailed description of a company's...
Purchase Info Record Purchase info records are information about terms for purchasing a specific...