How to use Logical database in function module?

I will create a function module in HR.
but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

You cannot attach the LDB to the main program of the function group.
- So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
- Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
- Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
Regards

Similar Messages

  • How to use a user defined function module in IP

    Hi All,
    Can you please guide me on how to use a user created function module in IP? My requirement is to have 2 exit function modules to be used in IP to load the falt file data into a cube..
    Regards,

    Hi,
    /people/marc.bernard/blog/2007/11/25/how-to-load-a-file-into-sap-netweaver-bi-integrated-planning-part-1
    thanks to Marc Bernard
    Regards

  • Why and how we use Logical Database?

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

    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

  • Use of Logical Database in function module

    Hello Experts,
    Is there a way of using logical database and Get enent inside a function module.
    I am trying to create a RFC for HR module and need this badly. Any help would be highly appriciated.
    Thanks,
    Gregory fernando

    This fm will work fine with all LDBs including PNP
    Have you checked the fm documentation ?

  • How to use Exceptions for a function module

    Hi folks,
            I have created  a new function module.Its working fine, but i am not aware of using exceptions for a function module. I hav just declared an exception in the 'exception' tab. Could any body explain me how to use that in my FM source code....Thanks...

    Hi Shyam,
    Have a look at this,
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gd_file
          has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = it_record
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
        IF sy-subrc NE 0.
          write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
          skip.
        endif.
    Regards,
    Sai

  • **How to use Logic as a sound module with an MPC?!?!**

    So I'm new to Logic, I love the program but don't know a thing about the environment... I've seen people discuss this a lot on the forums but I still haven't been able to figure it out.
    Basically, I am using an MPC 2500 and would like to use Logic as a sound module.
    I know you have to create a new multi track instrument in the environment but as a newbie I just can't seem to put the pieces together. I tried and tried but when I create a new instrument all I get is a box with 16 channels!?
    Does someone have a similar setup? Would anyone mind sending me their environement?
    MacBook Pro   Mac OS X (10.4.7)  

    Pictures worth a thousand words and stuff:
    http://bj.angeltowns.com/images/log_cs.jpg
    Here I've disconnected the physical input object from the sequencer object (called "to recording & thru")
    I've created a channel splitter object, and cabled the physical input object to it. I'm now in the process of option-clicking the channel splitter's output cables (one for each MIDI channel) - ()option-clicking the output cables is a shortcut way to cable to objects on different layers) - and selecting channel 1 (and thus cable 1) to go to Audio Instrument 1, channel 2 (cable 2) to Audio Instrument 2 etc.
    So the MIDI comes in to Logic, gets split into individual channels, and each channel goes to it's own audio instrument via a cable, which you can put any plugins on.
    You can't record into Logic this way now, as we've bypassed the sequencer, but I think you need it simple at this stage

  • How to use a Logical Database in Function Module.

    Hi Experts,
    I want to use a logical database in a Function Module to fetch data from a standard SAP table into a Internal table for certain filter conditions.
    How can I get get this done????
    I called LDB_PROCESS FM in my FM, but I could not figure out how to store the extract in my IT table since we cant use GET in FM.
    Please provide me a sample code if possible.
    Thanks in Advance,
    Alex.

    Hi,
    i had an example program like this ,in this i want to get the data using pnp logical database with 5 fields in an interface program.
    data: begin of it_final occurs 0,
            pernr like pa0002-pernr,
            vorna like pa0002-vorna,
            nachn like pa0002-nachn,
           usrid like pa0105-usrid,
           usrid_long like pa0105-usrid_long,
           end of it_final.
    get pernr.
      clear : p0000,p0002,p0105.
      rp-provide-from-last p0000 space p_date p_date.
      if p0000-stat2 = '3'.
        v_pernr = pnppernr-low.
      else.
        reject.
      endif.
    *---Get employee pernr, First name ,Last name into final table
      rp-provide-from-last p0002 space p_date p_date.
      if pnp-sw-found = '1'.
       it_final-pernr = p0002-pernr.
       it_final-vorna = p0002-vorna.
       it_final-nachn = p0002-nachn.
      else.
    *---Error message if not infotype 0002 maintained
      T_ERROR-PERNR   = pnppernr-low.
      CONCATENATE TEXT-EMI '0002'
      INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
      APPEND T_ERROR.
      CLEAR T_ERROR.
      endif.
    **--Get SYSTEM USERNAME to final table
      rp-provide-from-last p0105 0001 p_date p_date.
      if pnp-sw-found = '1'.
        it_final-usrid = p0105-usrid.
      else.
    *---Error message if not SYSTEM USERNAME maintained
        T_ERROR-PERNR   = pnppernr-low.
        CONCATENATE TEXT-003 '0105'
        INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
        APPEND T_ERROR.
        CLEAR T_ERROR.
      endif.
    **--Get Email ID to final table
      rp-provide-from-last p0105 0010 p_date p_date.
      if pnp-sw-found = '1'.
        it_final-usrid_long = p0105-usrid_long.
      else.
    *---Error message if not Email ID maintained
        T_ERROR-PERNR   = pnppernr-low.
        CONCATENATE TEXT-004 '0105'
        INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
        APPEND T_ERROR.
        CLEAR T_ERROR.
      endif.
       append it_final.
        clear it_final.
    reward points if useful,
    venkat.

  • How to use Logic DataBase in WDA?

    Hi Experts,
    The LDBs contain: Selection Screen, Authorization check, Data Retrieval, and it is very useful for writing a report within R3 system.
    I am developing some WDA reports, and really need this kind of features too. Is there anyone know how to use LDB in WDA???
    Thanks a lot.
    Best Regards,
    Guo Guo Qing

    Thanks for your reply.
    Could you tell me if there is some standard function module to handle LDB?
    Best Regards,
    Guo Guo Qing

  • How to use ejbs for accessing Function Module.

    Hi,
    I want to call ABAP function module using ejb(Since I want to expose them as web service on different server). I know how to do that using Models, but dont know how to go ahead using ejbs.
    Could you please guide me on this?
    Regards,
    Abhijeet.

    Hi,
    In another thread with a similar question I found these references:
    /people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco
    Re: interfacing SAP with an existing java applications
    And this code example:
              HashMap result = new HashMap();
              Object ret = new Object();
              JCO.Client mConnection = null;
              mConnection = getConnection();
              JCO.Repository mRepository;
              mRepository = new JCO.Repository("R3", mConnection);
              JCO.Function function =
                   createFunction("Z_ISA_GET_ORDER_ITEM_INFO", mRepository);
              function.getImportParameterList().setValue(orderNum, "ORDER");
              if (function != null) {
                   mConnection.execute(function);
                   JCO.Table codes = function.getTableParameterList().getTable("INFO");
                   for (int i = 0; i < codes.getNumRows(); i++) {
                        codes.setRow(i);
                        int tmp = new Integer(codes.getString("POSNN")).intValue();
                        String tmpStr = new String(Integer.toString(tmp));
                        ret = result.put(tmpStr, codes.getString("VBELN"));
              } else {
                   System.out.print("Fxn call failed for Z_ISA_GET_ORDER_ITEM_INFO");
              JCO.releaseClient(mConnection);
    Good luck,
    Roelof

  • How to use ET_ATTACH importing parameter Function module BBP_PD_SC_CREATE

    hi,
    how to use ET_ATTACH importing parameter of Function module BBP_PD_SC_CREATE, my requirement is to create SC with attachment.
    an example would really help.
    Kind Regards,
    Kailash.

    Hi,
    Generally we create the SC from ITS or Portal, and there in the Create SC screen , once you add the item into the shopping cart , in the Item details, there is the section called , Documents and Attachements, where in you can upload the attachments which ever you want. Sometimes the extn .DOC, .pdf and .xls are allowed. but that also you can check which are the Authorized files extns avaialbe in Backend R/3.
    Using the FM RFC_READ_TABLE, in table pass TDWP and in the i_field pass 'APPSFX' and then you can get the authorized file formats. in Backend Transaction DC30 you can verify which are the allowed file formats.
    Moreover for restricting the User from uploading the attachment BADI BBP_ITEM_CHECK_BADI can be implemented for raising the error message if required.
    Regarding the ET_ATTACH, it is the structure of type BBPT_PDS_ATT_T,  so you have to provide the complete details for this structure. Like : GUID, P_GUID ,LOGICAL_SYSTEM, DESCRIPTION, URL, TYPE,DISP_URL, PHIO_EXT ,etc.
    Once all the entries are fine.
    You can create the SC, but the recommeded way for creating the SC is thru ITS or Portal.
    I hope this will help. Feel Free while asking questions.
    Thanks and Regards,
    Ankur Goyal

  • How to use selection-screen in function module?

    Hello
    I've created a function module and i have to create within the function module a selection-screen(with select-options for entering data) but i get an error that within form routines and function modules this statement is not allowed.
    Can anybody help?
    thanx

    Hi,
       YOu cannot create a selection screen withing a function module.
    What you can do is to call a screen , say '0100'.
    Create a screen '0100' and then include a selection -screen as a subscreen in that screen.
    Regards,
    Ravi

  • How to use logical database "psj" for query?

    Hi, expert :
       use "PSJ" to make a query. but in queries, the title have two lines. and can't  correspond to the content.
       how to make the title correspond to the content?
    regards

    Hi
    Comments option nothing but where you can enter your description.While creating the SAP Query using SQVI enter your query name and click create one popup window will come in that you have comments field where you can enter your description.
    Thanks
    S.Murali

  • Use logical database to fetch data in FI reports

    Hi All,
              is it possible to fetch data using logical database for FI module ALV reports.
    please provide me details.
    Thks
    Shailesh

    look at the logical database tables for the FI module
    BMM                  Documents for Number
    BRF                  Document Database
    BRM                  Accounting Documents
    DDF                  CUSTOMER  DATABASE
    KDF                  Vendor Database
    SDF                  G/L Account Database

  • Why u  use logical databases

    how u used logical database?how is data transferrd to program?corresponding statement in LDB?

    Hi,
    Logical databases are programs that does useful tasks like data fetch, Authorization check on behalf of thep program to which you attach them.
    Some of the Tasks of LDB's.
    <b>Reading the same data for several programs.</b>
    The individual programs do not then need to know the exact structure of the relevant database tables (and especially not their foreign key relationships). Instead, they can rely on the logical database to read the database entries in the right order during the GET event.
    <b>Defining the same user interface for several programs.</b>
    Logical databases have a built-in selection screen. Therefore, all of the programs that use the logical database have the same user interface.
    <b>Central authorization checks</b>
    Authorization checks for central and sensitive data can be programmed centrally in the database to prevent them from being bypassed by simple application programs.
    <b>Improving Performance</b>
    If you want to improve response times, logical databases permit you to take a number of measures to achieve this (for example, using joins instead of nested SELECT statements). These become immediately effective in all of the application programs concerned and save you from having to modify their source code.
    The data fetch happend with the PUT_XXXX subrotuines in the Logical database programs.
    Example:
    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 
    Regards,
    Sesh

  • How to retrieve data using logical database and custom select options

    Hi all,
    I have a selection screen which is displayed by logical database PSJ and I have two select options of my own. I need to retrieve data based on both selection screen of logical database and my own select options. How can I do it?
    Thanks in advance.

    Hai Gupta
    Check the following Document & Links
    1. A logical database is in fact
    a program only.
    2. This LDB provides two main things :
    a) a pre-defined selection screen
    which handles all user inputs and validations
    b) pre defined set of data
    based upon the user selection.
    3. So we dont have to worry about from
    which tables to fetch data.
    4. Moreover, this LDB Program,
    handles all user-authorisations
    and is efficient in all respects.
    5. tcode is SLDB
    good info about Logical Database. you can check the link.
    http://www.geekinterview.com/question_details/1506
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Re: How to Create and Use ldb in reports?
    Re: Logical databases
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    Functions for displaying and changing logical databases:
    Call Transaction SE36 or
    Choose ABAP Workbench -> Development -> Programming environ. -> Logical databases
    Interaction between database program and report:
    During program processing, subroutines are performed in the database program and events are executed in the report.
    To 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:-
    The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
    i)An easy-to-use standard user interface.
    ii)check functions which check that user input is complete,correct,and plausible.
    iii)meaningful data selection.
    iv)central authorization checks for database accesses.
    v)good read access performance while retaining the hierarchical data view determined by the application logic.
    disadvantages:-
    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).
    1. transaction code SLDB.
    2.enter name z<ldb-name>
    3.create
    4.short text
    5.create
    6. name of root node (here Ekko)
    7. enter short text (f6)
    8.node type -> data base table.
    9.create
    10 change logical DB
    riht click on ekko and insert node
    here node name ekpo
    11.create
    12. click on selections
    13. press no Should the changed structure of Z<ldb name> be saved first.
    14.select tables which you want to join.
    15.transfer
    16 now you have to o to coding part.
    17. save
    activate.
    19.click to src code
    double click on first include and activate
    Regards
    Sreeni

Maybe you are looking for