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

ldb

Former Member
0 Likes
644

how i work in LDB

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
609

hi dear

LOGICAL DATABASES:

-


Logical Databases are used to generate report.

It is a repository object, not a data dictionary object.

Under one logical database, a node is created first for the corresponding table in the database.

A logical database can have any number of related nodes in the hierarchical manner.

First node of the logical database is called as ROOT NODE.

SLDB or SE36 to create logical databases.

Navigations to Create Logical Database:

-


SLDB -> Specify LDB name starting with Z or Y -> Click on Create -> Opens an interface -> Enter short description

-> Create -> Save under a package and assign request number -> Opens an interface

-> Specify Root Node name (MARA) -> Enter short description for the Root node

-> Specify Database Table name (MARA) -> Create -> Opens an interface

-> Select the Root Node (KNA1) -> Click on SELECTIONS pushbutton from Appn.

Toolbar -> Click on Yes to generate Selection Screens from the Structure

-> Click on No to Search Help -> Opens an Interface

-> Select the checkboxes to create Field Selections and Free Selections

-> TRansfer -> Opens an Include Program -> Decomment Select-Options statement and specify range variable as follows:

SELECT-OPTIONS : MATNUM FOR MARA-MATNR.

-> Save -> Activate -> Come back.

Select the Node -> Click on SOURCE CODE pushbutton

-> Click on Yes to generate source code from Structure and Selections -> Opens a report with two Include Files :

include DBZLOGICAL_DATABASE1TOP . " header

include DBZLOGICAL_DATABASE1NXXX . " all system routines

-> Double click on Header File to declare global variables -> Specify Following code:

TABLES : MARA * Autogenerated

DATA IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

-> Save -> Activate -> Come back -> Double click on System Routine file, where the fetching operations are done

-> Opens an Include File with three subfiles as follows:

include DBZLOGICAL_DATABASE1N001 . " Node MARA

include DBZLOGICAL_DATABASE1FXXX . " init, PBO, PAI

include DBZLOGICAL_DATABASE1SXXX . " search help

-> Double click on the first file -> Specify SELECT operation statement as follows:

select * from mara into table it_mara where matnr in MATNUM.

PUT MARA. * AUTOGENERATED CODE

loop at it_mara.

write 😕 it_mara-matnr, it_mara-mtart, it_mara-mbrsh, it_mara-meins.

endloop.

-> Save -> Activate.

To Access LDB node, create SE38 PROGRAM, Specify LDB name in ATTRIBUTES section -> Specify following code in SE38:

NODES MARA.

GET MARA.

-> Save -> Activate -> Execute.

3 REPLIES 3
Read only

Former Member
0 Likes
609

hi check this simple program,

Logical database

A logical database is a special ABAP/4 program which combines the contents of certain database tables. Using logical databases facilitates the process of reading database tables.

HR Logical Database is PNP

Main Functions of the logical database PNP:

Standard Selection screen

Data Retrieval

Authorization check

To use logical database PNP in your program, specify in your program attributes.

Standard Selection Screen

Date selection

Date selection delimits the time period for which data is evaluated. GET PERNR retrieves all records of the relevant infotypes from the database. When you enter a date selection period, the PROVIDE loop retrieves the infotype records whose validity period overlaps with at least one day of this period.

Person selection

Person selection is the 'true' selection of choosing a group of employees for whom the report is to run.

Sorting Data

· The standard sort sequence lists personnel numbers in ascending order.

· SORT function allows you to sort the report data otherwise. All the sorting fields are from infotype 0001.

Report Class

· You can suppress input fields which are not used on the selection screen by assigning a report class to your program.

· If SAP standard delivered report classes do not satisfy your requirements, you can create your own report class through the IMG.

Data Retrieval from LDB

1. Create data structures for infotypes.

INFOTYPES: 0001, "ORG ASSIGNMENT

0002, "PERSONAL DATA

0008. "BASIC PAY

2. Fill data structures with the infotype records.

Start-of-selection.

GET PERNR.

End-0f-selection.

Read Master Data

Infotype structures (after GET PERNR) are internal tables loaded with data.

The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.

GET PERNR.

PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA

If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. endif.

ENDPROVIDE.

Period-Related Data

All infotype records are time stamped.

IT0006 (Address infotype)

01/01/1990 12/31/9999 present

Which record to be read depends on the date selection period specified on the

selection screen. PN/BEGDA PN/ENDDA.

Current Data

IT0006 Address - 01/01/1990 12/31/9999 present

RP-PROVIDE-FROM-LAST retrieves the record which is valid in the data selection period.

For example, pn/begda = '19990931' pn/endda = '99991231'

IT0006 subtype 1 is resident address

RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.

<REMOVED BY MODERATOR>

venkat.

Edited by: Alvaro Tejada Galindo on Feb 29, 2008 6:23 PM

Read only

Former Member
0 Likes
610

hi dear

LOGICAL DATABASES:

-


Logical Databases are used to generate report.

It is a repository object, not a data dictionary object.

Under one logical database, a node is created first for the corresponding table in the database.

A logical database can have any number of related nodes in the hierarchical manner.

First node of the logical database is called as ROOT NODE.

SLDB or SE36 to create logical databases.

Navigations to Create Logical Database:

-


SLDB -> Specify LDB name starting with Z or Y -> Click on Create -> Opens an interface -> Enter short description

-> Create -> Save under a package and assign request number -> Opens an interface

-> Specify Root Node name (MARA) -> Enter short description for the Root node

-> Specify Database Table name (MARA) -> Create -> Opens an interface

-> Select the Root Node (KNA1) -> Click on SELECTIONS pushbutton from Appn.

Toolbar -> Click on Yes to generate Selection Screens from the Structure

-> Click on No to Search Help -> Opens an Interface

-> Select the checkboxes to create Field Selections and Free Selections

-> TRansfer -> Opens an Include Program -> Decomment Select-Options statement and specify range variable as follows:

SELECT-OPTIONS : MATNUM FOR MARA-MATNR.

-> Save -> Activate -> Come back.

Select the Node -> Click on SOURCE CODE pushbutton

-> Click on Yes to generate source code from Structure and Selections -> Opens a report with two Include Files :

include DBZLOGICAL_DATABASE1TOP . " header

include DBZLOGICAL_DATABASE1NXXX . " all system routines

-> Double click on Header File to declare global variables -> Specify Following code:

TABLES : MARA * Autogenerated

DATA IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

-> Save -> Activate -> Come back -> Double click on System Routine file, where the fetching operations are done

-> Opens an Include File with three subfiles as follows:

include DBZLOGICAL_DATABASE1N001 . " Node MARA

include DBZLOGICAL_DATABASE1FXXX . " init, PBO, PAI

include DBZLOGICAL_DATABASE1SXXX . " search help

-> Double click on the first file -> Specify SELECT operation statement as follows:

select * from mara into table it_mara where matnr in MATNUM.

PUT MARA. * AUTOGENERATED CODE

loop at it_mara.

write 😕 it_mara-matnr, it_mara-mtart, it_mara-mbrsh, it_mara-meins.

endloop.

-> Save -> Activate.

To Access LDB node, create SE38 PROGRAM, Specify LDB name in ATTRIBUTES section -> Specify following code in SE38:

NODES MARA.

GET MARA.

-> Save -> Activate -> Execute.