Entering content frame

Logical Databases Locate the document in its SAP Library structure

Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables and linking them to executable ABAP programs while setting the program contents. You edit logical databases using the Logical Database Builder in the ABAP Workbench.

However, since Release 4.5A, it has also been possible to call logical databases independently of this tool using the function module LDB_PROCESS. This allows you to call several logical databases from any ABAP program, nested in any way. It is also possible to call a logical database more than once in a program, if it has been programmed to allow this. This is particularly useful for executable programs, allowing them to use more than one logical database and process a database more than once.

Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.

Views of Data in Logical Databases

Logical databases provide a particular view of database tables. It is appropriate to use logical databases if the database tables you want to read correspond largely to the structure of the logical database and where the flow of the system program (select - read - process - display) meets the requirements of the application.

The data structure in a logical database is hierarchical. Many tables in the R/3 System are linked to each other using foreign key relationships. Some of these dependencies form tree-like hierarchical structures. Logical databases read data from database tables that are part of these structures.

This graphic is explained in the accompanying text

A logical database can read the lines of these tables one after the other into an executable program in a sequence which is normally defined by the hierarchical structure. The term logical database is sometimes used to mean not only the program itself, but also the data that it can procure.

Tasks of Logical Databases

Logical databases serve mainly to reuse predefined functionality for reading data from database tables, but they can also be programmed for other tasks. To keep the application logic of application programs free from technical details, logical databases can perform the following tasks:

        Reading the same data for several programs.

The individual programs do not then need to know the exact structure of the relevant database tables (and especially not their foreign key relationships). Instead, they can rely on the logical database to read the database entries in the right order during the GET event.

        Defining the same user interface for several programs.

Logical databases have a built-in selection screen. Therefore, all of the programs that use the logical database have the same user interface.

        Central authorization checks

Authorization checks for central and sensitive data can be programmed centrally in the database to prevent them from being bypassed by simple application programs.

        Improving Performance

If you want to improve response times, logical databases permit you to take a number of measures to achieve this (for example, using joins instead of nested SELECT statements). These become immediately effective in all of the application programs concerned and save you from having to modify their source code.


Structure of Logical Databases

Selection Views

Example of a Logical Database

Using Logical Databases

Editing Logical Databases


Leaving content frame