SAP Logical databases are special type of ABAP programs to retrieve (read) database data for reusing in other application programs. it shortly known as ldb. It provides a customized view of the database data.
A Logical database structure is a like a tree structure linked with the foreign key relationship between SAP database tables.
Following things are the purposes of Logical database
- Reading the same data for multiple programs
- Defining the same user interface for multiple programs
- Central authorization checks
- Improving performance
Logical database has three components. They are
- Structure (data view specification)
- Selections (user interface for the program)
- Database Program (ABAP coding to read the data)
Here is a sample ABAP program to read a ldb.
Read a logical database in SAP ABP (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.
data: begin of t occurs 0,
linfr like lfa1-lifnr,
name1 like lfa1-name1,
end of t.
move-corresponding lfa1 to t.
sort t by name1.
loop at t.
write: / t-name1, t-lifnr.