Internal
Table:
|
In real time different modules e.g. MM , FI , CO , SD etc. hits the
database to update the values so that they want to see the values in particular
way such as for SD – Sales related details, for FI – Financial related details
etc. that may change the database value.
So, instead of hitting the database and changing the values at
the database level SAP come up with a concept known as internal table.
Internal table is a variable which is used to extract the
records from the database table and process the records. Internal table is like
temporary table.
So, now different departments can make a copy of the
database table , process them according to their requirements by using internal
table without changing the database table.
Properties of internal table:
1. The data that is copied from database table is copied
record by record and in the same sequence. So accessing data from internal
table will also be done record by record and in the same sequence.
2. Internal table is a collection of group of structures and
structure is a group of fields.
3. Internal table stores the records, manipulate and format
the records according to user requirement.
4. Memory allocation of internal table is done at runtime as
internal tables can store any number of records (may be 1 million or 1
billion).
5. The line type of an internal table can be any ABAP data
types – elementary, structured or internal tables.
Steps to
declare internal table:
1.Declare the structure of the internal table.
TYPES : BEGIN OF ty_mara_t,
matnr TYPE mtart,
maktx TYPE maktx,
matkl TYPE matkl,
END OF ty_mara_t.
DATA : BEGIN OF ls_mara_d,
matnr TYPE mtart,
maktx TYPE maktx,
matkl TYPE matkl,
END OF ls_mara_d.
DATA : ls_mara_3 TYPE ty_mara_t.
DATA : ls_mara_4 LIKE ls_mara_d.
matnr TYPE mtart,
maktx TYPE maktx,
matkl TYPE matkl,
END OF ty_mara_t.
DATA : BEGIN OF ls_mara_d,
matnr TYPE mtart,
maktx TYPE maktx,
matkl TYPE matkl,
END OF ls_mara_d.
DATA : ls_mara_3 TYPE ty_mara_t.
DATA : ls_mara_4 LIKE ls_mara_d.
Types – it is used to define user defined data types.
Data - it is used to
defined user defined data objects.
2.Declare internal table using the structure.
DATA : lt_mara_1 TYPE TABLE OF ty_mara_t,
lt_mara_2 LIKE TABLE OF ls_mara_d,
lt_mara_3 LIKE TABLE OF ls_mara_3,
lt_mara_4 LIKE TABLE OF ls_mara_4.
lt_mara_2 LIKE TABLE OF ls_mara_d,
lt_mara_3 LIKE TABLE OF ls_mara_3,
lt_mara_4 LIKE TABLE OF ls_mara_4.
Thanks a
lot again friends for reading this tutorial. If you find this is useful and
helpful to you, please consider it sharing to your friends using the social
buttons below.
Thanks for Sharing such a good article For SAP ABAP Training
ReplyDeleteAny one looking SAP ABAP Online training click on below link
http://www.retorslernenlabs.com/sap-abap-online-training/