Logical database in SAP
The LDB is special type of ABAP program that combines the contents of certain related(检索) database tables and retrieve some related data and make it available to application programs.
In other words, a LDB is a method by which ABAP programs read and process the data. The sequence in which the data is supplied to the program is determined by a tree structure.
The LDB usually consists of the following components:
Structure
Selections
Database programs
Logical databases have a tree structure.A logical database can contain a maximum of 300 tables
SAPDBPNP is the name of the database program for the logical database PNP.
How are logical database used
1.Logical databases when generating an ABAP program
The selection screen generated contains the selections (SELECT-OPTIONS AND PARAMETERS) of both the logical database and the program.
The only database-specific selections displayed on the selection screen are those needed by the program for data retrieval purposes
2. Logical databases at run-time of an ABAP program
At run-time, the system processes the events in the program and in the logical database in the following order
Before displaying the selection screen, certain initializations (e.g. calculating default values such as key date, etc.) are performed for the selection screen by the logical database and the program.
The selection screen is displayed and the user enters data in the input fields.
The logical database and the program check that the input is correct and complete , but also that the user has the appropriate authorizations. If an error occurs, some fields are made ready for input again, so that the user can make the necessary correction(s).
In the event START-OF-SELECTION, the ABAP program performs any preliminary work (for ex, importing files).
The logical database reads the selected data and the program processes it within the GET events according to the sequence specified by the structure.
In the event END-OF-SELECTION, the ABAP program performs any concluding operations (for example, calculating totals, exporting files).
3 . Designing the selection screens
The standard selection screen of a logical database has a standard layout where SELECT-OPTIONS and PARAMETERS appear in the sequence they are declared, each on a new line. The system automatically generates such a screen for each program that does not have its own selection screen entered in the attributes.
You can define your own selection screens for any logical database . If the attributes of a program include the number of its own selection screen, the system uses this screen as a model when generating. Any program-specific selections appear after the database selections. The flow logic for such screens is also generated automatically and therefore cannot be modified. You cannot delete database selections
Functions of LDB:
Data retrieval :
The personnel data of each employee is loaded into the main memory where it can be accessed for processing.
Screening :
Employees can be selected according to the organizational criteria entered on the selection screen.
E.g…Hourly wage earners in a particular personnel sub area.
There are two types of screening..Person selection and data selection period.
Person selection defines those employees for whom a report is to be run.
E.g..Monthly wage earners in a specific personnel sub-area.
E.g..Personnel number range
E.g..Features of org.Assignment…Employees who assigned to certain cost center.
E.g..Employee status..Active or inactive.
The data selection period delimits the time period for which data is evaluated.
When you enter the data selection period,the provide loop retrieves the infotype records whose validity period overlaps with at least one day of this period.
Authorization check:
This ensures that the person starting the evaluation Is authorized to access the report data.
Lagical Data bases in HR ABAP:
PNP
PNPCE
PAP
PCH