Logical Database
Logical Database
In this section, we will Explain Logical Databases Describe Report Driven Reading of Vendor Master Data Describe Reading Data Compare Logical Databases v. Select Define the structure of a Logical Database Explain Event Keywords Describe the interaction of Logical Databases and Reports
Logical Database
Logical Database
Logical Database
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 by linking them to executable ABAP programs. 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.
The diagram illustrates how the R/3 System might represent the structure of a company. 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 Reading the same data for several programs. Defining the same user interface for several programs. Central authorization checks Improving performance
LFA1 LFAS LFBK LFB1 LFB5 LFC1 LFC3 BSIK BKPF BSEG GSEG GSEG LFAS LFBK LFB1
Documents
BSIK BKPF BSEG
LFB5
LFC1
LFC3
Reading Data
ABAP Dictionary
1
Logical Database
REPORT ... . TABLES:SPFLI,SFLIGHT. GET SPFLI. GET SFLIGHT.
2
Without Logical Database
REPORT ... . TABLES: SPFLI,SFLIGHT. SELECT SPFLI. SELECT SFLIGHT. ....
Processing
Processing
Processing
END-OF-SELECTION
Introduces any statements that are to be processed after all logical database records have been read and processed. Retrieves the table <dbtab> for processing via the logical database program SAPD<db><a>. Introduces statements that are only processed once subordinate tables have been read and processed. These statements are processed before the next loop is performed.
GET <dbtab>
KDF
REPORT RSDEMO00. TABLES: LFA1, LFBK, LFB5 . GET LFA1.
REPORT SAPDBKDF... FORM PUT LFA1 . SELECT * FROM LFA1... . PUT LFA1 . ENDSELECT . ENDFORM . FORM PUT_LFBK . SELECT * FROM LFBK... . PUT LFBK. ENDSELECT. ENDFORM. FORM PUT_LFB1. SELECT * FROM LFB1... . PUT LFB1. ENDSELECT. ENDFORM. FORM PUT_LFB5. SELECT * FROM LFB5... . PUT LFB5. ENDSELECT. ENDFORM.
LFBK
LFB5
LFC1
LFC3
BSIK
GET LFBK.
GET LFB5.
4 2 LFB1 4
LFC1 LFC1 3 3
END-OF-SELECTION
SELECT
Faster than logical databases More powerful than logical databases select into order by More flexible More specific coding is easier work for the database.
BUT:
Logical databases are slower Changes to a logical database affect all programs that use it
BUT:
; Authority check missing ; Parameters for selectoptions have to be coded
LDB_PROCESS