Tuesday, April 8, 2014

ABAP - Structure, Work Area and Internal Table


DATA : it_mara TYPE STANDARD TABLE OF mara.

DATA : wa_mara LIKE LINE OF it_mara.
OR
DATA : wa_mara TYPE mara.


Notes:
If you declare an internal table with "WITH HEADER LINE" clause the internal table itself acts as a work area.  For example, your ITAB is a work area and ITAB[] is the internal table.

Whereas work area is a variable declared with the TYPE of an internal table or a database table.  It can store only one record at a time. When you read an internal table (without header line) the line which you read must be moved somewhere, it is moved into a work area. 
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.  Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not. 

Internal table is a temporary two dimensional memory structure similar to database table.  We can store multiple records in the internal table and also using record pointers we can do the activities such as reading, appending, deleting, modifying etc.

A structure (structured type) comprises components (fields). Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth.

There are Flat, nested and deep structures. A flat structure only references elementary types. A nested structure references at least one further structure, but not a table type. A deep structure references at least one table type.

No comments:

Post a Comment