Sunteți pe pagina 1din 7

Bases de datos lógicas:

Desde SE36 podemos buscar por nombre, descripción, tabla…

También desde una tabla por referencias de utilización en BDs lógicas.


En Cod Fuente podemos ver el código que genera la BDs lógica (son básicamente
procedimientos PUT_NOMBRE_NODO que realizan las selects y finalmente vuelcan
las itabs con la sentencia PUT (used to pass the data read by the logical database to the user
of the logical database)

Las BDs lógicas tienen sus propios textos de selección y generan pantallas de selección.

En los programas que utilicen BDs lógicas se debe:

- Indicar en los atributos del programa la BDs lógica y la variante de la pantalla


de selección

- Declarar las tablas que se obtendran de la BDs lógica


- Declarar los nodos a utilizar con la sentencia NODES
- Declarar la estructura de la pantalla de selección (Si necesitamos conocer la
selección)
- Mapear la selección a los campos de selección de la BDs lógica por ej
PERFORM map_sel_to_ldb (si necesitamos modificar parameters de la
selección(por ej ocultos en la variante de selección))
- Realizar llamadas GET a los diferentes nodos siguiendo el recorrido deseado:

Events in Logical Databases

REPORT sapbc405_ldbd_events.
... START-OF-SELECTION

1 GET SPFLI DL 1699

START-OF-SELECTION 2 GET SFLIGHT 25.02.2000


3 GET SBOOK 00002568
1 SPFLI 1 SPFLI 3 GET SBOOK 00002569
3 GET SBOOK 00002570
5
4 GET SFLIGHT LATE
2 GET SFLIGHT 27.03.2000
2 SFLIGHT 2 SFLIGHT
4 4 3 GET SBOOK 00002590
3 GET SBOOK 00002591
SBOOK SBOOK SBOOK SBOOK SBOOK 4 GET SFLIGHT LATE
3 3 3 3 3 5 GET SPFLI LATE
1 GET SPFLI DL 1984
END-OF-SELECTION
END-OF-SELECTION

 SAP AG 1999

Ej
* Tablas que se buscan mediante la base de datos lógica DDF
TABLES: kna1,
knas,

TABLES: b0sg.

* map selections to LDB logic:
PERFORM map_sel_to_ldb.
************************************************************************
GET kna1. “ CABECERA
************************************************************************

************************************************************************
GET knb1. “ POSICION

BDs lógica DDF


El código que genera la BDs lógica sería:

LDB Sub-Objects: Database Programs

Naming convention sapdb<


sapdb<ldbname>
ldbname>

Database accesses, input checks, and authorization checks

FORM
FORM init.
sapdb<ldbname>
...
ENDFORM init
ENDFORM

FORM
FORM put_spfli.
...
ENDFORM put_spfli.
ENDFORM

FORM
FORM put_sflight.
...
ENDFORM put_sflight
ENDFORM

 SAP AG 1999

 Database program sapdb<ldbname> for logical database <ldbname> is a collection


of subroutines, each of which is performed for specific events. For example,
subroutine <init> is processed once at the start of the database program. This
program can be used to define default values for the selection screen of the LDB.
 Other subroutines also exist that are processed during events PBO (Process Before
Output) and PAI (Process After Input) of the selection screen. Checks, such as
authorization checks (AUTHORITY-CHECK), are usually performed during event
PAI.
 The database accesses (SELECT statements) are programmed in the put_<node>
subroutines. These subroutines may be processed several times, depending on
which selection criteria the user specifies. The sequence in which these subroutines
are processed is determined by the structure of the logical database.
 Database access (SELECT statements) should be programmed with optimal
performance in mind. When creating a logical database you generate the
corresponding database program after first having determined its structure and
selection attributes. You can find performance tips in the comment lines.
Interaction: LDB and Program

PROGRAM SAPDBF1S REPORT sapbc405_ldbd_ldb.


Structure
Structure of
of F1S
F1S DEFINING DATABASE F1S. NODES: spfli, sflight, sbook.
...
FORM PUT_SPFLI.
SELECT * FROM SPFLI ... * Processing of SPFLI records
SPFLI PUT
PUT SPFLI.
SPFLI. GET SPFLI FIELDS ...
ENDSELECT.
ENDFORM. Data
Data processing
processing

FORM PUT_SFLIGHT. * Processing of SFLIGHT records


SELECT * FROM SFLIGHT .
SFLIGHT PUT SFLIGHT.
PUT SFLIGHT. GET SFLIGHT FIELDS ...
ENDSELECT.
ENDFORM. Data
Data processing
processing

FORM PUT_SBOOK.
SELECT * FROM SBOOK ... * Processing of SBOOK records
SBOOK PUT SBOOK.
PUT SBOOK. GET SBOOK FIELDS ...
ENDSELECT.
ENDFORM. Data
Data processing
processing

 SAP AG 1999

 When a program that has been assigned a logical database is started, control is initially
passed to the database program of the logical database. Each event has a corresponding
subroutine in the database program - for example, subroutine init for event
INITIALIZATION. During the interaction between the LDB and the associated report, the
subroutine is always processed first, followed by the event (if there is one in the report).
 Logical database programs read data from a database according to the structure declared for
the logical database. They begin with the root node and then process the individual
"branches" consecutively from top to bottom.
 The logical database reads the data in the PUT_<NODE> subroutines. During event PUT,
control is passed from the database program to the GET event of the associated report. The
data is made available in the corresponding work areas in the report. The processing block
defined for the GET event is performed. Control then returns to the logical database. PUT
activates the next form subroutine found in the structure. This flow is continued until the
report has collected all the available data.
 The depth of data read in the structure depends upon a program's GET events. A logical
database reads to the lowest GET event contained within the structure attributes. Only those
GET events for which processing is supposed to take place are written into the report
program. Logical databases read all data records found on the direct access path.

S-ar putea să vă placă și