Reading logical database using ABAP program

Read a logical database (you must have data in those tables, now LFA1), fill up an internal table. Sort the data by a given field and then display the internal table.

ABAP program Source Code:

report zldbread no standard page heading.
tables: lfa1.
data: begin of t occurs 0,
linfr like lfa1-lifnr,
name1 like lfa1-name1,
end of t.


get lfa1.
clear t.
move-corresponding lfa1 to t.
append t.
sort t by name1.
loop at t.

write: / t-name1, t-lifnr.

More References