Application Development 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: 

logical database KDF

Former Member
0 Kudos
871

hi,

Abapers,

I want to fatch all the data of BSEG but BSEG is a clustor table so i want to use logical database kdf ,as i am new for using logical database. may any one please give me an example for how to use logical databse in executable programe.

thanks in advance.

4 REPLIES 4

sreeramkumar_madisetty
Active Contributor
0 Kudos
191

Hi

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.

LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.

Less coding s required to retrieve data compared to normal internel tables.

Tables used LDB are in hierarchial structure.

Mainly we used LDBs in HR Abap Programming.

Where all tables are highly inter related so LDBs can optimize the performance there.

Check this Document. All abt LDB's

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...

GO THROUGH LINKS -

http://www.sap-basis-abap.com/saptab.htm

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

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

http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html

www.sap-img.com/abap/abap-interview-question.htm

www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm

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

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm

Gothru the blog which provides info on LDB's:

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

reward if useful

Regards,

Sree

Former Member
0 Kudos
191

hi

Selections in the Selection Include

SELECT-OPTIONS: slifnr FOR lfa1-lifnr,

sbukrs FOR lfb1-bukrs,

sgjahr FOR lfc1-gjahr,

sbelnr FOR bkpf-belnr.

Database Program

----


  • DATABASE PROGRAM OF THE LOGICAL DATABASE TEST_LDB

----


PROGRAM sapdbtest_ldb DEFINING DATABASE test_ldb.

TABLES: lfa1,

lfb1,

lfc1,

bkpf.

----


  • Initialize selection screen (process before PBO)

----


FORM init.

....

ENDFORM. "INIT

----


  • PBO of selection screen (always before selection

  • screen

----


FORM pbo.

....

ENDFORM. "PBO

----


  • PAI of selection screen (process always after ENTER)

----


FORM pai USING fname mark.

CASE fname.

WHEN 'SLIFNR'.

....

WHEN 'SBUKRS'.

....

WHEN 'SGJAHR'.

....

WHEN 'SBELNR'.

....

ENDCASE.

ENDFORM. "PAI

----


  • Call event GET LFA1

----


FORM put_lfa1.

SELECT * FROM lfa1

WHERE lifnr IN slifnr.

PUT lfa1.

ENDSELECT.

ENDFORM. "PUT_LFA1

----


  • Call event GET LFB1

----


FORM put_lfb1.

SELECT * FROM lfb1

WHERE lifnr = lfa1-lifnr

AND bukrs IN sbulrs.

PUT lfb1.

ENDSELECT.

ENDFORM. "PUT_LFB1

----


  • Call event GET LFC1

----


FORM put_lfc1.

SELECT * FROM lfc1

WHERE lifnr = lfa1-lifnr

AND bukrs = lfb1-bukrs

AND gjahr IN sgjahr.

PUT lfc1.

ENDSELECT.

ENDFORM. "PUT_LFC1

----


  • Call event GET BKPF

----


FORM put_bkpf.

SELECT * FROM bkpf

WHERE bukrs = lfb1-bukrs

AND belnr IN sbelnr

AND gjahr IN sgjahr.

PUT bkpf.

ENDSELECT.

ENDFORM. "PUT_BKPF

The PROGRAM statement has the addition DEFINING DATABASE test_ldb. This defines the database program as belonging to the logical database TEST_LDB.

You declare the node of the structure using the TABLESstatement. This creates the necessary interface work areas as table work areas. You can also use the NODES statement to define database tables as nodes. If a node of a logical database is not a database table, you must use the NODESstatement. The interface work areas are shared by the database program and the user, and so act as an interface for passing data. The term “user” here can mean either an executable program to which the logical database is linked, or the function module LDB_PROCESS.

The subroutines INIT and PBO initialize the selection screen.

In the PAI subroutine, you can include an authorization check for the user input on the selection screen. Plausibility or value range checks are also possible. If a check fails, you can write an error dialog. The corresponding field on the selection screen is then made ready for input again.

The PUT_node subroutines read the database tables according to the selection criteria entered by the user and trigger the relevant GET events. This program is intended only to show the essential structure of a logical database. It does not contain any refinements to improve response times. The order in which the subroutines are called is determined by the structure of the logical database.

follow the link below.it will clear all ur doubts

http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9be035c111d1829f0000e829fbfe/frameset.htm

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Former Member
0 Kudos
191

Hi

You have to use GET BSEG command to fetch the all data from BSEG.

see the doc of LDB's

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.

LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.

Less coding s required to retrieve data compared to normal internel tables.

Tables used LDB are in hierarchial structure.

Mainly we used LDBs in HR Abap Programming.

Where all tables are highly inter related so LDBs can optimize the performance there.

Check this Document. All abt LDB's

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...

GO THROUGH LINKS -

http://www.sap-basis-abap.com/saptab.htm

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

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

http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html

www.sap-img.com/abap/abap-interview-question.htm

www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm

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

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm

Gothru the blog which provides info on LDB's:

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

Reward points if useful

Regards

Anji