Mentor SAP

Program Flow of Logical Databases

Logical database programs are named SAPDB <ldbname>, where <ldbname>is the name of the logical database. These programs consist of subroutines. Each subroutine is executed at a particular event, for example, the init subroutine in the program is processed once at the start of the database program. The init subroutine can be used to define default values for the selection screen of the logical database.

 

There are other subroutines that are processed at the Process Before Output (PBO) and Process After Input (PAI) events of the selection screen. Checks, such as authorization checks (AUTHORITY-CHECK), are performed during the PAI event.

 

 

Interdependency – Logical Database and Program

The interaction between a logical database and a program occurs as follows:

 

This flow continues until the report has collected all the available data.

The read depth in the structure depends on the GET events specified in the program. A logical database reads to the lowest GET event contained in the structure attributes.

 

Only those GET events for which processing needs to take place should be coded in the report program. Logical databases read all data records that are found on the direct access path.

 

 

Additional Selection Screen Objects when working with Logical Databases

When using a logical database, you can declare additional SELECT-OPTIONS in the program, if, for example, these are for fields which are not designated for dynamic selection. If you do this, you must use the CHECK <seltab> statement to check if the current data record fulfills the selection criteria (this is necessary since there you cannot amend the WHERE condition of the SELECT statement which is used to retrieve the data; this is in the Logical Database, not your program).

 

If the result of the check is negative, the current processing block is terminated.

 

If you want to extend your selection screen using the PARAMETERS statement to add single fields, you must also use the CHECK statement in the corresponding GET event block. However, in this case, you must specify a complete logical condition (the abbreviated syntax CHECK <seltab> is only possible for SELECT-OPTIONS).