What are Internal Tables and Work areas ?

What is an internal table and work area in SAP ABAP ? Difference between internal table and work area

+ -
Internal Tables and Work Areas are temporary memory locations which are used to store the data of  database tables at run time and in other way we can call them as instances of database tables.

Internal tables and Work areas

Internal Tables Work Areas
  • Temporary memory locations which are used to store the data of database table.
  • Internal table is an instance of database table.
  • By default 8kb memory will be allocated and it increases dynamically( +8kb +8kb).
  • Temporary memory locations which are used to store the data of database table.
  • Work area is an instance of database table.
 Internal tables can store multiple records.
 Work areas can store only one record.
General Syntax :
 DATA : <ITAB> TYPE TABLE OF <DBTABLE> .

General Syntax:
 DATA : <WA> TYPE  <DBTABLE> .


Internal Table declaration

 DATA : <ITAB> TYPE TABLE OF <DBTABLE> .
Example :
DATA : IT_ITAB TYPE TABLE OF MARA . 

Example Explanation : Here IT_ITAB is the name of Internal table and MARA is the Database table name, after declaring, IT_ITAB will be the instance of table MARA.


An internal Table declaration with user defined types

 DATA : <ITAB> TYPE TABLE OF <userdefinedtype>. 
Example is : TYPES : BEGIN OF TY_TABLE,
               MATNR TYPE MARA-MATNR, 
               MTART TYPE MARA-MTART,
               MEINS TYPE MARA-MEINS, 
               END OF TY_TABLE.<br>
  DATA : IT_ITAB TYPE TABLE OF TY_TABLE .
Here TY_TABLE is a user defined type with 3 fields

Internal Table Deceleration Old Syntax (Obsolete Method)

Obsolete Syntax: DATA : IT_ITAB TYPE TABLE OF MARA occurs 0 with header line . 
In this example Internal Table itself acts as work area, technically a work area will be created at the first row of the internal table.
Note:

Please Sign in to ask a question

Was this lesson helpful to you? Yes No 136 People out of 141 think this lesson helpful


Lesson Navigation

Data Dictionary← Previous Lesson
Next Chapter →