Sunday, 13 May 2012

How to declare an internal table? | SAP ABAP

=>  An internal table comprises a body and a header line that is optional. The body contains the rows of internal table.
 The header line can hold only single row. Header line is like a field string that has same structure as row of the body.
For example:
Declaration of internal table with header line option I
DATA : BEGIN OF ITAB OCCURS 0,
NAME(10),
DEPT(10),
END OF ITAB.
Declaration of internal table with header line option II:
TYPES : BEGIN OF FS,
NAME(10),
DEPT(10),
END OF FS.
DATA ITAB TYPEFS OCCURS 0 WITH HEADER LINE.

The following figure shows diagrammatically the header line and body of an internal table.
   
Figure : Header line and body of an internal table.Declaration of internal table without header line:
TYPES : BEGIN OF FS,
NAME(10),
DEPT(10),
END OF FS.
DATA ITAB TYPEFS OCCURS 0