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

Similar Messages

  • 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 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

  • 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

  • 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 Javamail for accessing additional mailboxes -IMAP, Exchange 2010

    hi,
    I want to access a shared mailbox (NOT FOLDER) via Javamail API (1.4.5) using IMAP(s) with plain logon. The mailserver is a Exchange Server 2010.
    User: user1 ([email protected])
    pwd: xxxx
    shared mailbox: [email protected]
    Properties:
    mail.imaps.socketFactory.port = 993
    mail.imaps.starttls.enable = true
    mail.imaps.socketFactory.class = javax.net.ssl.SSLSocketFactory
    mail.imaps.socketFactory.fallback = false
    username = [email protected]
    password = xxxx
    I´ve managed to get access to the user1 - mailbox:
    Session session = Session.getInstance(properties, new ExchangeAuthenticator(username, password));
    session.setDebug(true);
    Store store = session.getStore("imaps");
    store.connect(imapHost, username, password);
    --> this works just fine! But now i want to access the additional mailbox by changing the login-String:
    [email protected]/shared_MB (user@domain/additional_MB)
    --> unfortunately I´m getting an "NO AUTHENTICATE" message:
    DEBUG: setDebug: JavaMail version 1.4.5
    DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc]
    DEBUG: mail.imap.fetchsize: 16384
    DEBUG: mail.imap.statuscachetimeout: 1000
    DEBUG: mail.imap.appendbuffersize: -1
    DEBUG: mail.imap.minidletime: 10
    DEBUG: trying to connect to host "host.domain.com", port 993, isSSL true
    * OK The Microsoft Exchange IMAP4 service is ready.
    A0 CAPABILITY
    * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
    A0 OK CAPABILITY completed.
    DEBUG IMAP: AUTH: NTLM
    DEBUG IMAP: AUTH: GSSAPI
    DEBUG IMAP: AUTH: PLAIN
    DEBUG: protocolConnect login, host=host.domain.com, [email protected]/shared_MB, password=<non-null>
    DEBUG IMAP: AUTHENTICATE PLAIN command trace suppressed
    DEBUG IMAP: AUTHENTICATE PLAIN command result: A1 NO AUTHENTICATE failed.
    javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    I was able to get access with Thunderbird and also with the Exchange OWA-Client, so I think there is something missing in my code...
    or is it just impossible to get access to a different mailbox using javamail and plain-auth?
    Thank you in advance.

    Thanks bshannon, that was a great idea!
    I haven´t found an solution yet, but I have maybe identified the real problem:
    Here is some interessting Thunderbird - Logging stuff:
    744[7161040]: try to log in
    744[7161040]: IMAP auth: server caps 0x1187235, pref 0x1006, failed 0x0, avail caps 0x1004
    744[7161040]: (GSSAPI = 0x1000000, CRAM = 0x20000, NTLM = 0x100000, MSN = 0x200000, PLAIN = 0x1000, LOGIN = 0x2, old-style IMAP login = 0x4)auth external IMAP login = 0x20000000
    744[7161040]: trying auth method 0x1000
    744[7161040]: got new password
    744[7161040]: IMAP: trying auth method 0x1000
    744[7161040]: PLAIN auth
    744[7161040]: 7082000:xmail.domain.com:NA:SendData: 2 authenticate plain
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=3 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: +
    744[7161040]: 7082000:xmail.domain.com:NA:SendData: Logging suppressed for this command (it probably contained authentication information)
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=27 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: 2 NO AUTHENTICATE failed.
    744[7161040]: authlogin failed
    744[7161040]: marking auth method 0x1000 failed
    ---> okay, so PLAIN AUTH is failing.....
    744[7161040]: IMAP auth: server caps 0x1187235, pref 0x1006, failed 0x1000, avail caps 0x4
    744[7161040]: (GSSAPI = 0x1000000, CRAM = 0x20000, NTLM = 0x100000, MSN = 0x200000, PLAIN = 0x1000, LOGIN = 0x2, old-style IMAP login = 0x4)auth external IMAP login = 0x20000000
    744[7161040]: trying auth method 0x4
    744[7161040]: got new password
    744[7161040]: IMAP: trying auth method 0x4
    744[7161040]: old-style auth
    744[7161040]: 7082000:xmail.xmail.domain.com:NA:SendData: Logging suppressed for this command (it probably contained authentication information)
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=23 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: 4 OK LOGIN completed.
    744[7161040]: login succeeded
    --> okay, so Thunderbird is using "old-style IMAP login" and is successful.
    Unfortunately I have no idea what that actually means or how to use it in Javamail (is it even supported?). Any suggestions?

  • 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 setTimeout for Callback function in ajax DWR?

    Hi,
    I am facing a problem of ajax request not returning back to the specified callback function. As a result my application screen gets locked waiting indefinitely.
    The timeout in DWR is controlled using a setTimeout method.
    Can someone plz tell me how to implement this in my javascript code so that my Callback function is invoked for sure.
    below is my code snippet...
    var dwrMap = new DWRMap(theMainForm);
         dwrMap['menuId'] = menuid;     
    CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut);
    else{
         fnDoAnalyze(analyzeUrl);
    function fnPerformLogOut(response){
    if(response == "timedOut"){
         alert("Timed Out");
         fnAskToLogin();
    else{
         alert("Not timed out");
         fnDoAnalyze(analyzeUrl);
    Here CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut); is sending ajax request.
    and fnPerformLogOut() is the callback function.

    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

  • Where used list for RFC function module

    Hi All,
    Is it possible to list where the RFC enabled FM is getting called? I mean in which all system (say RFC present in some Dev system, it might be called somewhere in other systems other than in Dev systems) RFC is getting called.
    Kindly suggest.
    Thanks,
    Ashwini

    Hi Ashwini,
    Is it possible to list where the RFC enabled FM is getting called?
    Yes, there are several ways to do it, if you just need the list of the systems that call your RFC,
    1) look up the technical designs of the interfaces(the ones which use RFCs) that are present in your project.
    2) Enable RFC trace on your system and go through the trace list, you can get help from your BASIS team.
    3) If you have a middleware through which all the interfaces are handled then you can work with the middleware team to identify the source systems which call your RFC.
    4) Add a line in your RFC to update a Z Table on when and from which UID it was called, based on this you can identify the source.
    5) You can add a bug so that your RFC shortdumps, the team from the source team will be sure get in touch with you in this case...just kidding, but a possible solution at the same time.
    Regards,
    Chen

  • How to insert a code for a function module into a Customer Exit Variable?

    I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.
    I need to get data in the column LW (Last Week) for both the key figures.
    In function module EXIT_SAPLRRS0_001 one of the functions I have is:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    I need to create a new variable to get values in the Last week column for different key figures and use function “'DATE_TO_PERIOD_CONVERT'” in that variable.
    Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.
    In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.
    Thank you.
    TR.

    Hi Wond,
    Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                EXPORTING
                  i_date         = ld_date
                  i_periv        = lc_periv
                IMPORTING
                  e_buper        = ln_poper
                  e_gjahr        = ln_bdatj
                EXCEPTIONS
                  input_false    = 1
                  t009_notfound  = 2
                  t009b_notfound = 3
                  OTHERS         = 4.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ELSE.
                lc_poper = ln_poper.
                CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.
                wa_e_t_range-sign = 'I'.
                wa_e_t_range-opt = 'EQ'.
                APPEND wa_e_t_range TO e_t_range.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.
    Thank you.
    Regards,
    TR.

  • How to add Test data for a function module

    Hi experts,
    i want to add test data for a function module . i don't know how to proceed on it . please help me...
    with regards,
    James...
    Valuable answers will be rewarded...

    Hi,
    - Go to SE37 and execute your FM
    - Enter the data you want to pass to FM
    - Hit 'Save' button. Enter the meaningful name for your test scenario and save. That's it you have saved the test data.
    You can also enter some other test data and save that also. In short, you can save multiple test scenario. Also, you can give multiple test scenario a same name and they do not overwrite each other ( but normally you give different name to differentiate them)
    Next time you come to execute the FM again, hit the "test data" button and it will show you all the test scenario you have stored before. Select the one you want to use and it will load the data in FM parameters.
    Let me know if you need any other information.
    Regards,
    RS

  • How to check for a function module with its description and functionality

    Hi all,
    How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .

    Hi,
    You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
    Say for example you need to search something regarding converstion.
    Search for * CONVERT * and press F4.
    If there is something specfic like converting date to something you can give
    DATE * CONVERT *
    OR
    CONVERT * DATE *  and press F4.
    Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
    Regards,
    Pramod

  • How to find suitable( existing) function group for a Function Module ?

    How to find suitable( existing) function group for a Function Module to be created?
    This is FM for converting amounts to text.

    Hi,
            If you are not sure into which Function group your FM should go in then its advised to create a Function group of your own. Its not advised to create a function module in any other function group unless its owned by you since your FM can get deleted by others or it can get changed.
    Create your own Function group. But if you want to create in an existing FG then best way is to find out the Function Group by searching for suitable existing Function module then see their function group
    Regards,
    Sesh

  • How to schedule a background jobs for a function module

    HI all,
    I have created a function module (zrfc_test). Now I need to schedule it daily around 8am . the 2 tcodes used is sm36 & sm37. But I need a detail description for a function module.
    Points will be rewarded
    thanks in advance

    As there is no direct way of scheduling a function module, you may write a online program (program type 1) and call this function module in side it and schedule the program using SM36. Or you may record a CATT procedure for the function module and schedule it using SCAT transaction.Hope this helps
    Krishna

  • How to execute Se30(performance check) for a function module

    can anyone please let me know hot to execute perofrmance check for a function module.

    In SE30 below the program option you have Function Module option.
    Give the FM name there >execute, It will lead to the SE37 for Function Module execution screen, enter the values>Execute.
    The ctrl will return back to SE30.
    Press Evaluate to know the analysis.
    Hope this answers.
    Regards
    Vinayak

Maybe you are looking for

  • HT201250 How to use time machine external hard drive on other devices

    I have an external hard drive which i usually use to back up my macbook pro via time machine but if i put pictures or songs on the external hard drive and connect it to a gaming concole or a pc nothing happens. The concole and pc doesn't recognize th

  • Can a thread's start() method be called more than once?

    Is it legal/well-defined to call a Thread object's start() method after a previous call to start() has completed? eg. Thread t = new Thread(public void run() {...}); t.start(); t.join(); t.start(); // will this call fail?

  • Module Pool Screen - Download

    Hi Friends, i have to copy the Module pool program from one server to another server. while doing this i need how to copy / download the screen from the server. i heard that one option is exist in the layout of screen. please help me on this. this is

  • Japanese character input.

    I want to save the Japanese character input from html forms into the Oracle Database using the euc character set. Most of the users use Windows PC, so I guess most of the input would be using s-jis or MS932. Do I need to write the character code conv

  • How to maintain, the validity internal when we use non commulative key figu

    Hi Friends, I would like to check, I've created query on Inventary infocube, when we trying to execute the report, I'm getting the following error. The validity internal has the initial value as lower limit Generally, How we will maintain validity in