I. Internal Table Declaration ABAP / 4 Internal Table is a Data Structure, similar to the Struture in other languages, which can be composed of several different types of fields, used to represent some of the different properties. Things, a single data represents a matter, multiple data indicates multiple things with the same properties. For example, we create the following INTERNAL TABLE: Data: Begin of Student Occurs 20 , STD_ID TYPE N, NAME (10) Type C, AGE TYPE I, BIRTH TYPE D, Score Type P Decimals 2, End Of Student. We have created an Internal Table called Student and a pre-applied for it. The buffer of 20 data (of course, if the access information is more than 20, the program is executed, the system buffer is automatically applied. "The definition of the internal table has the following format: Format One. Data: Begin of
Occurs
,
Type
,
[
Type
,
Type
,
...]]]]
END OF
.
Format 2. Types: Begin of
,
Type
,
[
Type
,
Type
,
...]]]]
END OF
.
Types
Type
Occurs
.
Format three. Data: Begin of
.
Include structure
.
Data:
Like
Occurs
.
II. Append line format: append [
TO]
.
Examples 1 (using Work Area)
Data: Begin of Line,
COL1 TYPE I,
COL2 TYPE I,
End of line.
Data Itab Like Line Occurs 10.
DO 2 Times.
Line-col1 = SY-INDEX.
Line-col2 = SY-index ** 2.
Append line to itab.
Enddo.
Loop at Itab Into Line.
Write: / line-col1, line-col2.
Endloop.
The execution result is:
1 1
twenty four
Example II. (Do not use Work Area)
Data: Begin of Itab Occurs 10,
COL1 TYPE I,
COL2 TYPE I,
END OF ITAB.
DO 2 Times.
ITAB-col1 = SY-INDEX.
ITAB-col2 = SY-INDEX ** 2.
Append itab.
Enddo.
Loop at itab.
Write: / ITAB-COL1, ITAB-Col2.
Endloop.
The execution result is as the example.
Example III. (Elements) of another internal table)
Format: Append Lines of
[From "
] [To
] To
.
will
Element added to
Middle, you can choose from
to
Range.
Append Lines of Itab to JTAB.
.DATA: END OF