SAP LDB EXAMPLE
Get Example source ABAP code based on a different SAP table
ABAP_LDB - Example of a Logical Database
This example demonstrates all significant components of the imaginary logical database
ITOC
Structure
|
|----LFB1
|
|----LFC1
|
|----BKPF>
Selections in the Selection Include
sbukrs FOR lfb1-bukrs,
sgjahr FOR lfc1-gjahr,
sbelnr FOR bkpf-belnr.>
Database Program
* DATABASE PROGRAM OF LOGICAL DATABASE TEST_LDB
*-------------------------------------------------------*
PROGRAM sapdbtest_ldb DEFINING DATABASE test_ldb.
NODES: lfa1,
lfb1,
lfc1,
bkpf.
*-------------------------------------------------------*
* Initialize selection screen (processed before PBO)
*-------------------------------------------------------*
FORM init.
....
ENDFORM.
*-------------------------------------------------------*
* PBO of selection screen
*-------------------------------------------------------*
FORM pbo.
....
ENDFORM.
*-------------------------------------------------------*
* PAI of selection screen
*-------------------------------------------------------*
FORM pai USING fname mark.
CASE fname.
WHEN 'SLIFNR'.
....
WHEN 'SBUKRS'.
....
WHEN 'SGJAHR'.
....
WHEN 'SBELNR'.
....
ENDCASE.
ENDFORM.
*-------------------------------------------------------*
* Raise event GET lfa1
*-------------------------------------------------------*
FORM put_lfa1.
SELECT * FROM lfa1
WHERE lifnr IN @slifnr INTO @lfa1.
PUT lfa1.
ENDSELECT.
ENDFORM.
*-------------------------------------------------------*
* Raise event GET lfb1
*-------------------------------------------------------*
FORM put_lfb1.
SELECT * FROM lfb1
WHERE lifnr = @lfa1-lifnr
AND bukrs IN @sbulrs
INTO @lfb1.
PUT lfb1.
ENDSELECT.
ENDFORM.
*-------------------------------------------------------*
* Raise event GET lfc1
*-------------------------------------------------------*
FORM put_lfc1.
SELECT * FROM lfc1
WHERE lifnr = @lfa1-lifnr
AND bukrs = @lfb1-bukrs
AND gjahr IN @sgjahr
INTO lfc1.
PUT lfc1.
ENDSELECT.
ENDFORM.
*-------------------------------------------------------*
* Raise event GET bkpf
*-------------------------------------------------------*
FORM put_bkpf.
SELECT * FROM bkpf
WHERE bukrs = @lfb1-bukrs
AND belnr IN @sbelnr
AND gjahr IN @sgjahr
INTO @bkpf.
PUT bkpf.
ENDSELECT.
ENDFORM.>
The
The nodes of the structure are declared using the
The selection screen can be initialized in the subroutines
The user input on the selection screen can be, for example, checked for authorizations in the subroutine
The database tables are read in accordance with the selection criteria of the user and the associated
This program is only intended to demonstrate the principles of the structure of a logical database. It does not contain any methods for optimizing response times. The chronological order of the subroutine calls is determined by the structure of the logical database.