6 Replies Latest reply: Feb 24, 2009 10:12 AM by Rajan Usman Basha RSS

Why and how we use Logical Database?

Rajan Usman Basha
Currently Being Moderated

Can anybody explain with example why and how we use logical database?

 

Regards,

 

Rajan

  • Re: Why and how we use Logical Database?
    Arindam Ganguly
    Currently Being Moderated

    Hello,

     

    SAP comes loaded with all the extras. Among the extras that are most helpful to IT managers are all the access routines needed to pull any business object that managers can think of out of SAP databases. However, SAP has not thought of everything where your particular applications are concerned. SAP organizes its standard database tables to service business units based on conventional business applications. Itu2019s likely your business requires something new, perhaps even something exotic. In that case, you will need to create a new database, using information from different places. Basically, you need a logical database. You need to create a virtual business data object repository consisting of a new kind of record or table that suits your purposes. In addition, the repository should be composed of information that is actually stored in a number of different locations, none of them necessarily logically associated with one another. Letu2019s take a closer look at creating logical databases.

     

    A case for a logical database

    Suppose my company manufactures widgets of the most obscure variety, and they are components of other widgets. I sell my widgets as raw material for the more sophisticated widgets built by others, but in some cases I actually partner with other manufacturers in creating yet another class of widget. Now, in my world, I consequently have customers who are also partners. I sell to them and I partner with them in manufacturing and distribution. Also, I need an application that uses both of these dual-use relationships.

     

    Essentially, I have a customer database and a partner database. Neither contains records that are structured to contain the identifying particulars of the other. Thus, I need a hybrid database that gives me tables detailing these hybrid relationships. What can I do? I can go the long way around and write a new database, pulling information from both and creating new objects with a customized program that I write by hand. However, this process is cumbersome and contains maintenance issues. On the other hand, I can use SAPu2019s logical database facility, create my logical database in a couple of minutes, and have no maintenance issues at all.

     

    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.

    u2022     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.

    u2022     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.

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

     

    Creating your own logical database

    ABAP/4 (Advanced Business Application Programming language, version 4) is the language created by SAP for implementation and customization of its R/3 system. ABAP/4 comes loaded with many predefined logical databases that can construct and table just about any conventional business objects you might need in any canned SAP application. However, you can also create your own logical databases to construct any custom objects you care to define, as your application requires in ABAP/4. Hereu2019s a step-by-step guide:

    1.     Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.

    2.     Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.

    3.     Youu2019ll be prompted for a short text description of your new logical database. Enter one. Youu2019ll then be prompted to specify a development class.

    4.     Now comes the fun part! You must specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youu2019ve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you donu2019t have to write a single line of code.

     

    Regards

    Arindam

  • Re: Why and how we use Logical Database?
    Santosh Kumar Patha
    Currently Being Moderated

    Hi,

     

      Search Forums you will find lot of threads answering the same..

     

    Regards,

    PSK

  • Re: Why and how we use Logical Database?
    Currently Being Moderated

    What are Logical Databases?

     

    Database within a database, but logically stored within existing (physical) tables.

     

    Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables by linkingthem to executable ABAP programs Logical databases contain Open SQLstatements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.

     

     

    Logical Databases -Views of Data

     

    u2022A logical database provides a particular view of database tables in the R/3 System. It is always worth using logical databases if the structure of the data that you want to read corresponds to a view available through a logical database.

    u2022The data structure in a logical database is hierarchical. Many tables in the R/3 System are linked to each other using foreign key relationships. Some of these dependencies form tree-like hierarchical structures. Logical databases read data from database tables that are part of these structures.

     

    Event Key Words: Overview

     

    GET <dbtab>Retrieves the table <dbtab> forprocessing via the logical databaseprogram SAPD<db><a>.

     

    GET <dbtab> LATEIntroduces statements that are only processed once subordinate tables have been read and processed. These statements are processed before the next loop is performed.

     

     

    Logical Database vs. Select

     

    GETu2022The functional connection already existsu2022Beginners can find the database they are after easieru2022The logic is reusableu2022Select-Options are flexibleu2022Authority check is made automatically

    BUT:Logical databases are slowerChanges to a logical database affect all programs that use it

     

     

    SELECTu2022Faster than logical databasesu2022More powerful than logical databases -u2013select intou2013order byu2022More flexibleu2022More specific coding is easier work for the database.

    BUT:Authority check missing,Parameters for select-options have to be coded

     

    Edited by: krupa jani on Nov 24, 2008 6:27 AM

  • Re: Why and how we use Logical Database?
    Sachin Mahesh Gupta
    Currently Being Moderated

    hi,

     

    Special ABAP program, which provides other ABAP programs with data from the nodes of a hierarchical tree structure. Is linked either in the program attributes of an executable program to this program or is called using function module LDB_PROCESS. A logical database uses a hierarchical structure with nodes, a database program written in ABAP and an own standard selection screen. You edit logical databases in the Logical Database Builder.

     

    what is logical database

     

    Logical databases are special ABAP programs that retrieve data and make it available to application programs.

     

    Need of logical databse

    The most common use of logical databases is still to read data from database tables by linking them to executable ABAP programs.

     

    However, from Release 4.5A, it has also been possible to call logical databases using the function module LDB_PROCESS. This allows you to call several logical databases from any ABAP program, nested in any way. It is also possible to call a logical database more than once in a program, if it has been programmed to allow this. This is particularly useful for programs with type 1.

     

    Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area.

     

     

    thanks

    Sachin

  • Re: Why and how we use Logical Database?
    Thirukumaran Rajendran
    Currently Being Moderated

    Hi,

        Logical data bases are used for hr related issues, these are special type of database where it fetches the data.

      When you are using ldb's you must use the following syntax:

     

    Tables : pernr.

    infotypes : 0001, 0005.

    initilization.

     

    get pernr.

    provide * from pernr.

    endprovide.

     

    the difference b/w provide and loop is that when you are passing the dates in selection screen for loop and endloop statements it will gives the same value what is available in d.b.t. when you use provide and endprovide statements., it will display the values waht you have entered in selection screen ...

     

    some examples for ldb's are : pcl pcl1, pnp, pnpce, etc.,

     

    when you are using ldb's you must specify the ldb's name on defining the program type .. and give the ldb name what ever you need...

     

    Thanks,

    Thiru. R

  • Re: Why and how we use Logical Database?
    Rajan Usman Basha
    Currently Being Moderated

    Learnt from external source

Actions