Internal table is a temporary storage location which is only available at
runtime.
Now we are defining one internal table IT_KNA1 using the database table KNA1.
DATA : BEGIN OF IT_KNA1 OCCURS 0,
CUST_NO LIKE KNA1-KUNNR,
NAME LIKE KNA1-NAME1,
CNTRY LIKE KNA1-LAND1,
END OF IT_KNA1.
With the above statement internal table is created with body and work area.
Now we have populated the IT_KNA1 using select statement.
Select ... from KNA1 into IT_KNA1 where.....
append IT_KNA1.
Endselect. (or)
select... from KNA1 into table IT_KNA1 where.....
The total number of records statisfying the where condition will enter into
the internal table. First one record enters work-area of the internal table then
it gets appended into the body of the internal table, same procedure repeats for
all the records.
For displaying the data which is in the internal table.
Loop at IT_KNA1.
WRITE :/IT_KNA1-CUST_NO, IT_KNA1-NAME, IT_KNA1-CNTRY.
ENDLOOP.
Similarly as mentioned above for entering data, for displaying also. The
first record from the body of the internal table is fetched into the work-area
and then output is displayed, and procedure repeats for all the records in the
internal table.