Learn ABAP (5)

Internal Tables
In this section, we will learn on how to define an internal table, how to append rows, how to display the rows, and how to find a row which match a search kriteria. By the way, what is an internal table ? Is it a table pre-built in SAP such as lfa1 (vendor master) ? No, it is not. An internal table is a temporary table stored in RAM for manipulating data only.

/nse38

report zinternaltable.

data :
begin of intable occurs 5,
row1(2),
row2(6),
end of intable.

intable-row1 = 'ID'.
intablet-row2 = 'karno'.
append intable.

intable-row1 = 'US'.
intable-row2 = 'george'.
append intable.

intable-row1 = 'CH'.
intable-row2 = 'zhang'
append intable.

loop at intable.
write : / sy-tabix, intable-row1, intable-row2.
endloop.

read table intable with key row1='US'.
write : / sy-uline,
/ intable-row1, intable-row2.

All SAP products are trademark of SAP AG. This blog is not affiliated with nor endorsed by SAP AG.