Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

what is logical database

Former Member
0 Likes
496

hi,

what is logical databse and its application.

please tell ...

thanks

3 REPLIES 3
Read only

Former Member
0 Likes
458

A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.

It has its own selection screen. When we use a LDB in a report program, that selection screen automatically appears for this report program.

Reading a SAP standard logical database (DB M - MRP Documents) in your ABAP/4 program.

start-of-selection.

get is equal to select * from....

get mdkp.

check field-name.

get mdtb.

check field-name

end-of-selection.

read data from a database tables we use logical database. A logical database provides read-only access to a group of related tables to an ABAP/4 program. Advantages: i)check functions which check that user input is complete, correct,and plausible. ii)Meaningful data selection. iii)central authorization checks for database accesses. iv)good read access performance while retaining the hierarchical data view determined by the application logic. dis advantages: i)If you donot specify a logical database in the program attributes,the GET events never occur. ii)There is no ENDGET command,so the code block associated with an event ends with the next event statement (such as another GET or an END-OF-SELECTION).

Logical database structures

There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.

Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.

Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.

Database access programming: Once you’ve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.

Check out this:

http://articles.techrepublic.com.com/5100-10878_11-5034421.html

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm

http://www.erpgenie.com/abaptips/content/view/339/62/

http://wiki.ittoolbox.com/index.php

Reward if usefull.

Read only

Former Member
0 Likes
458

I have explained below the steps of how a LDB works in a report program.

Logical database is a program which fetches data from the database and provides it to the other programs.

It has its own selection screen. When we use a LDB in a report program, that selection screen automatically appears for this report program.

In order to use it in a report program:

1. We have to mention the LDB name in the attributes of report program… say for eg: we mention PNP (is one of the LDB).

2. We have to mention a node in the report program. Node is nothing but a work area.

This is done by declaring the TABLES statement in the report program.

For eg: TABLES : PERNR

PERNR is a structure which contains the basic details of an employee (related to HR module)

3. We have to mention the internal tables within which the relevant data is fetched.

This is done by declaring the INFOTYPES statement in the report program.

For eg: INFOTYPES: 0000, 0001,0002, 0006, 0007.

Infotypes are nothing but a table structure. Here we are declaring the internal tables PA0000, PA0001, PA0002.....which will have the same structure of corresponding database tables PA0000, PA0001, PA0002.. in the database.

Now, how the data is actually fetched in to the program:

1. The fetching of the data is trigerrred by a ‘GET node’ event.

Say, if we mention - GET PERNR. statement in the program. The data rows satisfying the parameters selected in selection screen are fetched from database, but filled into the PERNR work area row by row.

2. For each row fetched into the PERNR - relevant data is fetched into the internal tables PA0000, PA0001, PA0002 from database tables. For eg: PA0002 is a database table which holds the personal details of an employee and there may be many rows of data for the same employee. So based on the personnel number (employee number) fetched into PERNR all data records of that employee are fetched in to our internal table pa0002 from the database table PA0002.

Like wise , the other internal tables - pa0003, pa0006 are filled with the corresponding data.

Like data in PERNR work area acts like a primary key to fetch the data from data base to the internal tables.

3. For these data fetched into internal tables - we can write our data processing statements or just display on the list report.

So what ever statements we write between GET PERNR. and END SELECTION. are executed repeatedly like within a loop until all data records satisfying the parameters entered in selection screen are fetched into the node(work area) PERNR.

GET PERNR. * like LOOP.

write pa0002-name. * This statement is executed for each data record fetched into the work area PERNR.

  • other data processing statements.

END-SELECTION * like END LOOP.

Reward if useful.

Regards,

Pavithra

Read only

RaymondGiuseppi
Active Contributor
0 Likes
458

Look at [what is logical database|https://www.sdn.sap.com/irj/sdn/directforumsearch?threadid=&q=whatislogical+database&objID=&dateRange=last90days&numResults=15&rankBy=10001]

Regards