Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Internal Tables
• Internal Table
– Temporary table stored in RAM on
application server (not on GUI)
– Created & filled during execution of program
– Consists of one or more rows with identical
structure.
– Identical to a field string declaration
• Consist of a body & optional header line.
– Body holds the rows of data
• Defined using the occurs n
– Header line holds current row being
retrieved or added to the table.
• Automatically created using begin of…
• Using like will not create header line.
• Nested internal table does not have header line
ABAP/4
Internal Tables
1data: BEGIN OF itab1 OCCURS 10,
f1,
f2,
f3,
END OF itab1.
data itab2 LIKE ztxlfa1 OCCURS 100.
data itab3 LIKE ztxlfa1 OCCURS 100
with header line.
LOOP AT itab.
write: / sy-tabix, itab-f1, itab-f2.
ENDLOOP.
WRITE: / 'done. sy-tabix =', sy-tabix,
/ ' sy-subrc =', sy-subrc.
OUTPUTS:
1 A XX
2 B YY
3 C YY
Done sy-tabix = 99
sy-subrc = 0
ABAP/4
Internal Tables
• Restricting rows read from an
internal table.
– Using FROM, TO and WHERE
• WHERE returns a subset but always
performs a full table scan!.
– LOOP AT itab WHERE f2= ‘YY’
– LOOP AT itab from 2 to 3.
• Use EXIT, CONTINUE or CHECK
to control LOOP AT.