Examine how Logical Databases can be optimally used
Describe how a Logical Database is incorporated into an ABAP program
Introduce the GET event statement and explain its use in relation to a Logical Database
Summarise the advantages of using Logical Databases
Print a list of all customers who will depart after 01/09/2006.
Use the bookings table and the customer table.
Solution 1 - Nested Select Statement
tables : bookings , customer.
select * from bookings
where fldate > ‘20060901’.
select * from customer
where id = bookings-customid .
write: / customer-name ,
Solution 2 - Using a Logical Database
nodes : customers, bookings.
write: / customers-name.
write at /3 bookings-fldate.
Using a Logical Database
A logical database supplies your program with entries from tables. This means that you only need to program the data processing statements.
Each logical database has a structure containing a hierarchy of those tables that can be read.
What is a Logical Database?
Using a logical database is another method for reading data from a database table.
A logical database is actually a separate program , usually written by SAP, that provides access to a group of related tables .
The database access has been optimized using Open SQL.
The R/3 system contains about 150 logical databases covering most of the business processes.
When you run a program that uses a logical database , the program behind the logical database runs as well. The logical database displays an automatic selection screen for the user, i s sues the SELECT commands and returns the data to the calling program (your program) .
Assigning a Logical Database
The name of the logical database is an attribute of the program and must be set in the attributes screen .
Selection screen of a Logical Database
When you use a logical database in your program, a selection screen is called automatically, and the user can enter information to limit the data returned by the logical database.
Selections displayed depends on the nodes statement in the program.
Event Sequencing: Usi ng the GET event
An event is a keyword that defines a block of code to be executed when the system detects a certain occurrence.
The GET event is used in a program that uses a logical database.
The GET events in an ABAP program are processed in a tree like order to match the tree like order relationship of the tables in the logical database.
Using the GET event
The first data record from database table SPFLI is made available to your program. If your program has a GET spfli , the event block is processed.
The first data record from SFLIGHT that corresponds to the key of the current SPFLI record is made available to your program. If your program has a GET sflight , the event block is processed.
The next corresponding data record from database table SFLIGHT is made available to your program and the event block is processed again.
GET sf l ight : is called again until no further corresponding data records are found.
The logical database makes the next corresponding data record from SPFLI available to your program etc.
Advantages of Logical Databases
Logical Databases simplify the creation of reports where access to data from multiple tables is required.
A selection screen with appropriate selection criteria is automatically created. You don’t have to define this in your program.
Logical Databases can be used in more than one program. Improvements to the database access methods of the logical database immediately improve the performance of all programs using it.