Online Tutorials & Training Materials | STechies.com
Register Login

How to use Logical Databases and Events used for Logical Database?

|| 0

How to use Logical Databases and Events used for Logical Database?
Stechies

Tansaction Code: SE36 Logical datbase builder

You declare a logical database(ldb) in the attributes of the report. You just enter the 3 letters of the ldb . ie DDF, BRF, PNP etc. another method is in the report declaration - REPORT ZPROGRAM DEFINING DATABASE BRF.

In the dictionary (SE11) you can do a where used list for a table you want to use and specify looking in ldb.

A logical database is a program which defines a logical structure of tables. It selects the data from these tables either as select * or select fields formats. There has to be a means of getting the records from the ldb into the report. the command you use is GET tablename to retrieve the data from the ldb.

GET tablename is an event (GET is not always an event, but GET tablename is)

Example. (using BRF)

Start-of selection.
GET BKPF.
Code.
Code.

GET BSEG.
Code
Code.

End-of-selection.

This example gets the first record from BKPF and processes the code for that. Then it gets the first related record from BSEG and processes it, then next BSEG (until no more related to first BKPF) and then the next BKPF and so on. It's kind of like nested selects only quicker!

It is sometimes possible to say GET tablename fieldnames, but this depends whether the ldb is written with select * or select fields. Only if it is written with select fields can you use GET tablename fieldnames. A disavantage of ldb's is that it has to get retrieve data in the order of it's own hierarchy, so if you only want data from 2 of the lower tables it still has to retrieve the higher ones first. It's always best to look at the structure of all ldb's containing the tables you want to use so you can find the best one for your purpose.

The HR ldb's are a bit different because they use infotypes which have to be declared. There are also macros for data retrieval in HR. this is not really my specialist area although I have done quite a lot of HR programming. I may be able to help if you have specific questions about HR logical databases but I'm sure someone else in the gourp will have more knowledge than me about this.

Following Events are used for the logical databases:

INITIALIZATION
AT SELECTION-SCREEN
START-OF-SELECTION.
GET .
GET LATE.
END-OF-SELECTION