Академический Документы
Профессиональный Документы
Культура Документы
kvn.sunny@gmail.com
Internal tables
By definition, Internal tables and Field strings
are user defined structured data types.
Internal tables
Basically there are 2 types of Internal tables.
Internal tables with header line.
Internal tables without header line.
Declaration contd.
2) data : begin of itab occurs 0.
include structure <table name>.
data : end of itab.
Declaration contd.
3) data : begin of itab occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of itab.
Declaration contd.
4) data : begin of itab occurs 0,
carrdid like sflight-carrid,
connid like sflight-connid,
bookid like sbook-bookid,
fldate like sbook-fldate,
end of itab.
( In this case we are using fields from more than one
table)
Declaration contd.
5) data : begin of itab occurs 0,
carrid1 like sflight-carrid,
connid1 like sflight-connid,
fldate1 like sflight-fldate,
end of itab.
Populating contd.
2) do 5 times.
itab-number = sy-index.
append itab.
clear itab.
Enddo.
Populating contd.
Populating contd.
Populating contd.
5) select * from sflight <where..>.
move sflight to itab.
append itab.
clear itab.
endselect.
Populating contd.
6) select * from sflight <where.>.
move-corresponding sflight to itab.
append itab.
clear itab.
endselect.
Populating contd.
7) select carrid connid fldate from sflight
into (itab-carrid, itab-connid, itab-fldate)
<where.>.
append itab.
clear itab.
endselect.
Populating contd.
8) select * from sflight.
select * from sbook where carrid =
sflight-carrid.
move-corresponding sflight to itab.
move-corresponding sbook to itab.
append itab.
clear: itab-bookid,itab-fldate,sbook.endselect.
clear: itab-carrid,itab-connid,sflight.endselect.
Write
loop at itab < where carrid = LH >.
Write:/ itab-carrid,itab-connid,itab-fldate.
endloop.
Read
Read table itab index <index>.
OR
Read table itab with key carrid = LH connid
= 0400.
Insert
itab-carrid = MN.
itab-connid = 1111.
insert itab index 3.
Modify
itab-carrid = NM.
itab-connid = 2222.
modify itab index 3.
Delete
delete itab index 3.
OR
delete from itab where carrid = LH.
clear itab.
clear itab [ ].
refresh itab.
free itab.
Collect itab