Calling a RFC Function Module

Hello Guys,
I have a question regarding calling a RFC function module.
In BW - BI 7.0 I call a RFC function module:
(The ABAP program in BW-BI 7.0 is below)
  CALL FUNCTION ''ZTESTFUNCTIONMODULE'  " Function module in ECC
     DESTINATION 'DECCLNT110'  " ECC system
    TABLES
      it_gl_item   = it_gl
      it_errlog_gl = it_errlog_gl.
The 'ZTESTFUNCTIONMODULE'   is RFC enabled in the ECC system.
The purpose is we retarct the data from BW to ECC.
When I run the function module it always asks for the user id and password.
The SAP logon screen appears and it asks for the user id and password.
The destination is maintained in the SM59 transaction and also the user is maintained there. I think it should login automatically into remote system and return the tables. is it correct. How to skip the logon screen.
Do I have to pass the user id and password in the function module. I think it should take the user id from the SM59 destination. Is it correct.
Please advise. As always thanks for your help guys.

Hi Senthil,
I think you answered your query in your question itself
The user ID and password need to be maintained in RFC destination in SM59.
Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
Regards,
Atish

Similar Messages

  • Problem while calling an RFC Function Module in Background

    Hello,
    I have created a RFC function module for reading data from an external DB system. The FM calls an external RFC program (coded in C++ using RFC SDK), which delivers the required data. This external program is maintainged as an TCP RFC Connection in SM59.
    Further I have created a report, that calls the RFC function module to get the data from the external RFC programm.
    My problem is, when I call the report in foreground, everything works OK, the RFC connection works and data can be read from the external program.
    However, when I schedule the report to run in background as a job, the report is stating in the protocoll that there was a problem calling the defined RFC connection (although the connection is working properly at that time).
    More funny is, this particular problem with running in background occurs only in the productive system, in test and development system the report works correctly also while running as a job in background.
    Can you suggest the solution to this problem? Could it be something with authorisations or server settings?
    I will be on holiday for the next 6 weeks, so take your time to answer .
    Regards,
    Dusan.
    Edited by: Julius Bussche on Jan 22, 2009 7:19 PM
    Please read the forum rules about u r g e n t ...

    This is an external RFC server program, not a remote enabled ABAP RFC function module as the others seem to be assuming, right?
    Is it possible that your DEV and QAS systems only have one application server, but the PROD has many and dedicated one(s) for processing low priority background jobs?
    It might be that the target server of your TCP connection is not this BTC instance, and your RFC server is returning the data "locally" - so, into nirvana...
    Just guessing, but might be worth checking.
    Cheers,
    Julius

  • Where should i call the rfc function module? in xi or in r/3

    where should i call the rfc function module?
    for the synch scenario: file < -- >  xi <---> rfc
    i know the type of rfc is tcp/ip; but i'm not sure with the followings,
    and with some trials i can not even see any message via rwb even all the setting
    can be activated without errors.
    where should i create the rfc destination? in r/3 or xi
    where should i call the rfc via abap program? in r/3 or xi
    i guess the calling program should belong to the different server with the rfc itself....
    so confused....
    Thanks for your reply!!
    Jun

    if i create the destination in xi point to r/3, then i call the rfc use the destination in r/3 right ?
    The call doesnt use the destination in R3. XI has the RFC destination which is just used to connect to the R3 system
    but where i need to create the fm via se37? in xi or r/3 ?
    In R3
    Regards,
    Prateek

  • Unknown error calling a RFC Function Module in BODI

    Hi all,
    I am having an issue identifying the error that my batch job in BODI is giving with regards to a RFC function module call in my query. The value returned by the standard parameter 'AL_RFC_RETCODE' are square characters (              ).
    At the completion of the job, the error message 'RFC CallReceive error <Function ZCT_INDSLS_SLS_TRN_INSERT: Invalid request.. Invalid request.>.' is being output.
    Correct me if I'm wrong but the parameter 'AL_RFC_RETCODE' should return standard values as per the techical manual provided to undertand any errors that might occur during a RFC FM call.
    Can anyone help me on this?
    Best regards,
    Andrew Wong

    Hi Senthil,
    I think you answered your query in your question itself
    The user ID and password need to be maintained in RFC destination in SM59.
    Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
    Regards,
    Atish

  • Calling Synchronous RFC Function Module in Background

    Hi all,
    Currently we are working on some requirement where in we have to retrieve data from one system(CRM) and update the same into another system(ECC). We have developed a RFC Function in CRM system and it is being called from ECC system as in synchronous mode via a batch program.
    Now since all sychronous call to a RFC function will be dialog there is a constraint on the runtime which is being set by maximum run time for each dialog work process. So my question is there an option to call an RFC function synchronously in background (background task) so there is no runtime performance.
    The standard TRFC, QRFC calls in background runs asynchronously and so I am trying to check with the SDN world as whether has anyone tried  SRFC(Synchronous) call in background?
    Thanks in advance,
    Jagath

    So my question is there an option to call an RFC function synchronously in background (background task) so there is no runtime performance.
    One solution would be to increase the value of the "time out" parameter defined the CRM system. This i feel is not a fool-proof solution as the run-times cannot be predicted. Check this thread: Re: RFC timeout profile parameter
    For me a better solution would be to implement tRFC call instead of a synchronous call. Any reasons why you don't want to implement a tRFC ?
    BR,
    Suhas
    Edited by: Suhas Saha on Jun 26, 2010 8:52 AM

  • Calling BAPI(RFC function module) in java? Part 2

    Hi
    Can any body tell me or give me source code for calling give BAPI...i need to give the inputs to that parameters..
    data l_order_header_in    like bapisdhd1.
    data t_return             like bapiret2  occurs 0 with header line.
    data t_order_items_in     like bapisditm occurs 0 with header line.
    data t_order_schedules_in like bapischdl occurs 0 with header line.
    data t_order_partners     like bapiparnr occurs 0 with header line.
    *data t_order_condition_ex like bapicond   occurs 0 with header line.
    *clear   t_order_condition_ex.
    *refresh t_order_condition_ex.
    clear l_order_header_in.
    l_order_header_in-doc_type      =  'TA'.
    l_order_header_in-sales_org     =  'ZZ02'.
    l_order_header_in-distr_chan    =  'Z2'.
    l_order_header_in-division      =  'Z2'.
    *l_order_header_in-purch_no      =  '12'.
    clear   t_order_items_in.
    refresh t_order_items_in.
    t_order_items_in-itm_number     =  '000001'.
    t_order_items_in-material       =  'HAMAM'.                 " 'LBYA1'.
    t_order_items_in-target_qty     =  '0000000000001'.
    t_order_items_in-comp_quant     =  '0000000000001'.
    append t_order_items_in.
    clear   t_order_partners.
    refresh t_order_partners.
    t_order_partners-partn_role     =  'AG'.
    t_order_partners-partn_numb     =  '0000000006'.
    append t_order_partners.
    clear   t_order_schedules_in.
    refresh t_order_schedules_in.
    t_order_schedules_in-itm_number =  '000001'.
    t_order_schedules_in-sched_line =  '0001'.
    t_order_schedules_in-req_qty    =  1.
    append t_order_schedules_in.
    clear   t_order_partners.
    t_order_partners-partn_role     =  'WE'.
    t_order_partners-partn_numb     =  '0000000006'.
    append t_order_partners.
    break kumars.
    call function 'BAPI_SALESORDER_CREATEFROMDAT2'
      exporting
      SALESDOCUMENTIN               =
        order_header_in               = l_order_header_in
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
      SALESDOCUMENT                 =
      tables
        return                        = t_return
        order_items_in                = t_order_items_in
      ORDER_ITEMS_INX               =
        order_partners                = t_order_partners
        order_schedules_in            = t_order_schedules_in
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN           =
      ORDER_CONDITIONS_INX          =
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
    break venkat.
    call function 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
    Awaiting for ur responses..
    Thx
    PRadeep

    To call an RFC, you need to import that first. For that right click on the project into which you need to add the rfc.
    Import >>import RFC modules from r/3>>Give the package name and a port name for the rfc.
    set the server options as your r/3 server properties.
    Then you can search the Function name >> it will be displayed in the result area>> select it and press finish.
    The RFC will be imported to your project.
    Then you need to create JCO for calling that rfc.
    Here is a sample code which calls an RFC and setting jco..
    import com.sap.mw.jco.JCO;
    import com.sapportals.portal.prt.component.*;
    public class rfc extends AbstractPortalComponent
         private JCO.Client jcoClient;
         Insert_pgm_PortType insFunc=new Insert_pgm_PortType();
         Zinsert_Pgm_Input ip=new Zinsert_Pgm_Input();
         Zinsert_Pgm_Output op=new Zinsert_Pgm_Output();
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
        this.connect();
         insFunc.messageSpecifier.setJcoClient(jcoClient);
    //setting input params
         ip.setAssociate_Id1("44");
         ip.setCourse_Objt1(2);
         ip.setQlty_Content1(5);
         ip.setSeq_Content1(2);
         ip.setTraining_Id1("22");
    //calling RFC
         try{
         op=insFunc.zinsert_Pgm(ip);
         }catch(Exception e){}
              response.write(op.getMessage());
              this.disconnect();
    //creating JCO connection
         private void connect() {
                   try {
                        jcoClient =
                             JCO.createClient("Client","userid","password","Language","servername","Systemid");
                             jcoClient.connect();
                   } catch (Exception e) {
                        System.out.println("Error connecting to SAP ::" + e.getMessage());
                        e.printStackTrace();
         private void disconnect() {
                   try {
                        jcoClient.disconnect();
                   } catch (Exception e) {
                        System.out.println(
                             "Error dis-connecting to SAP ::" + e.getMessage());
                        e.printStackTrace();
    Hope this Helps
    gEorgE

  • Regarding: calling a rfc function module for web dynpro for JAVA

    Hello all,
    I want to call an rfc enabled function module from webdynrpo application.
    *and there is one condition that function module should be called not threw bapi.*
    Thanks
    Edited by: Punit Pawar on Jul 21, 2008 10:38 AM

    Hi 
    You can call RFC(remote enabled) from R/3 through Models in Webdynpro Java.You need to have JCO destinations.You connection properties of backend System
    http://help.sap.com/saphelp_nw04s/helpdata/en/6a/11f1f29526944e8580c5e59333d96d/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/11c3b051-0401-0010-fe9a-9eabd9c216de
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0310cf8-8cdb-2910-4a82-df1f11619f4e
    Thanks,
    Tulasi Palnati

  • RFC function module called inside an enhancment section

    Hi All,
    I am calling a RFC function module in background task as a separate unit. I am calling this FM within an enhancement section. Is it alright to use a commit work inside this RFC enabled FM even if I am calling it within an enhancemnt? Please help

    Hi,
    Yes,  you can use a commit work inside this RFC enabled FM even if I am calling it within an enhancemnt. Please refer below link regaring this. Thanking you.
    Commit within an enhancement point

  • Backgroung job failing becuase RFC function module is running in Dialog

    Hi,
    I have a program which is calling a RFC function module. I am running this program in background as a job. Now this function module which is in other system is running in Dialog and giving a time out error and the job is failing becuase of that.
    I tried call fucntion 'test' in background task
        destination 'XVZ'
    tables
       test = 'test'.
    But this is not working, i can still see this function module running in Dialog in SM50. Any suggestion?
    Thanks,
    Shweta

    Hi !
    RFC-Called function-modules are running in a dialog workprocess of the
    target system (they could not run in a batch proecess !!).
    That means the do have the same "Timeout" limitations than any other
    Dialog-Process.
    What you can do:
    - The Dialog "Timeout" could ce increased by your SAP-BASIS
    - If they could not - you should "shorten" the LUWs in the target-funktion.
      ...means - put a COMMIT WORK an any point the work is done.
      After a COMMIT WORK the "Timeout" Counter beginns at 0 !
    Hope that helped....
    Reward points would be nice...

  • Exception error_message in rfc function module

    Hi all,
    I am getting a short dump Raise exception in my R/3 system when calling a RFC function module in R/3 for printing  a label in LOFTWARE. The error analysis shows the that exception condition 'Nlink exception' condition raised . The rfc destination is working fine  and also i have included the predefined exceptions system_failure and communication_failure and also I have used RFC_PING function module before calling teh rfc for printing . Yet it is giving short dump.
    I heard that if we include one more exception error_message with return code 99
    ie exceptions
        system_failure = 1
        communictaion_failure = 2
        error_message = 99. there will be no short dump.
    Can anyone explain me why the return code for exception error_message is not 3 but 99 and also what is the significance of this.
    Need your help.

    from dump no information is available also it last occured 5 days ago so refreshed from our system..
    I want to know what is the importance of the return code 99 here...
    can anyone clarify this concept and aslo genrally in rfc exception handling communication_failure and system_failure can handle all type of exceptions then why error_message exception is added with a return code of 99..

  • Facing Problem with RFC Function Module

    Hi,
    I have created an RFC function module to get some data in table format.
    I have run the RFC in original system: It is giving the data.
    However, when I run this in target system, It is not giving any values.
    Could you please let me know, why it happens? I am not sure where I missed out.
    Thanks,
    Sandeep

    HI,
    i hope you are calling the RFC function module in the target system like this
    CALL FUNCTION <FUNC NAME> DESTINATION <DESTINATION NAME> . The destination should be logical system name of the source Logical system .
    Regards,
    Nagaraj

  • Debuggin a Call to Remote Function Module

    Hi
    I have a scenario where i have a Remote Function Module in r3 which is being called synchronously by an external java application. The FM has a lot of input and output parameters and many tables.  The output returned by the FM is not as expected.
    Can anyone tell me how debug a Remote Function Module when a call has been made from an external application.
    I am not able to get the test data sent by the external application . So when the external application gives a call to this Remote FM and if it is possibele to debug it would be great.
    regards
    Nilesh Taunk.

    Hi Nilesh,
    1) Login to SAP with the same ID with which you will calling the RFC function module from the outside system.
    2) Goto transaction - se37/se38
    3) Goto Utilities => Settings.
    4) Select the ABAP Editor Tab.
    5) Click on the Debugging tab.
    6) Tick the Actv. button and give the user name with which you will be debugging the code. In this case the logged in user id.
    7) Press Enter.
    8) Now put an external break point inside the Function Module.
    9) Load your external application (from where you want to debug the FM) once again.
    The execution will stop in the FM.
    Hope it helps..
    Lokesh
    PS: This was a simple question, but I guess the reason no one has answered your question is due to the fact that you havent rewarded points to members helping you. Also remember to close your post once it has been answered.

  • Call RFC Function Module and return 1000 records at a time

    I would like to call a Remote Enabled Function Module from a non SAP system.  This function module will select data from the database and return it to the calling program.
    Suppose there are 100,000 records that need to be returned, but the calling module would like the data in chunks of 1000 records.  Therefore the calling program would call the FM 100 times. 
    How do I code the function module to know on each subsequent call to grab the next chunk of 1000 records? 
    Let me know if additional information is needed.
    Thanks,
    Aaron

    Hello,
    Here is how you can go for this issue:
    1. Create one RFC function module with following parameter. These parameters are with respective of chunking logic.
         Import: Package Size
         Export: Total number of records
         Changing: chunk count
    Implement following logic:
    1. First of you need to know how many chunks you need to fetch for that get the count of total number of records. This is one  
        time activity so you better maintain one flag import parameter will be set to 'X' only first call.
    2. Get the number of chunk using total number of records / chunk size for e.g. 1000 / 100 so chunk count = 10.
    3. Define internal chunk counter in function module which will be used to locate the correct chunk depending on the chunk
        counter value sent from calling program.
    4. Send first call with package size 100 and chunk count = 1, execute select statement and increment internal
        chunk count check if chunk count = internal chunk count in current case chunk count = 1 so exit select statement and return
        with first chunk.
    5. Send second call with package size 100 and chunk count = 2. Execute select statement and check chunk count with internal
        chunk counter, in current case it will be 1 so skip that data and go for next chunk of 100 records increment internal chunk  
        counter. In this case it will match with external chunk count = 2. load output table with that data and return to calling program.
    6. Repeat step 4 until you reach last chunk.
    You need to use SELECT...ENDSELECT with PACKAGE SIZE addition so for every loop it will return number of records mentioned in package size.
    Hope this helps.
    Thanks,
    Augustin.

  • ABAP Dump due to RFC Function module call in another thread

    Hi,
    I am facing some problem since yesterday. In one of my executable program I am calling a RFC fm as below mentioned    
    REPORT ZREPORT.
    CALL FUNCTION 'Z_XXXXXXXXX'
          STARTING NEW TASK L_NAME
          DESTINATION IN GROUP 'TASK'
          PERFORMING RETURN_INFO ON END OF TASK
          EXPORTING
            P_exp1       = l_emp
          TABLES
            R_VBELN      = r_it_vbeln
          EXCEPTIONS
            NO_DATA_TO_PROCESS = 1
            OTHERS             = 2.
    wait until v_task = 1.
    update ztable.
    Due to some data inconsistence one of the SAP function
    module which I am calling in my function module Z_XXXXXXXXX
    is generating dump with message type X. Since there is data inconsistence it is generating dump that's OK.
    But the problem i am getting is, report ZREPORT is generating dump at WAIT statement saying illegal statement even though I am calling that function module
    Z_XXXXXXXXX as a separate new task.
    Can somebody help me.
    Thanks,
    Amara.

    hi, Amara
    I agree with Rich said, and do a simulate test in my server, here is the analysis.
    Assume we have a RFC, like this:
    FUNCTION ZGZL_DUMPTEST.
    *"*"Local interface:
    *"  EXPORTING
    *"     VALUE(OUT) TYPE  I
    *"  EXCEPTIONS
    *"      CONVERT_FAIL
      data:a  type  i.
      a = 'A'.
    ENDFUNCTION.
    And call this RFC like you way:
    REPORT ZGZL_DUMPTEST .
    DATA:
      SEMAPHORE(1) VALUE SPACE,
      LC_OUT       TYPE  I.
    CALL FUNCTION 'ZGZL_DUMPTEST'
    STARTING NEW TASK 'DUMP'
    PERFORMING RETURN_INFO ON END OF TASK.
    WAIT UNTIL SEMAPHORE = 'X'.
    WRITE: 'OVER'.
    FORM RETURN_INFO USING TASKNAME.
      RECEIVE RESULTS FROM FUNCTION 'ZGZL_DUMPTEST'
              IMPORTING  OUT = LC_OUT.
      SEMAPHORE = 'X'.
    ENDFORM.                    " RETURN_INFO
    if we run the RFC in se37 directly, obviously it will occur a rumtime error CONVT_NO_NUMBER, and dump.
    But if we run the above application to call the RFC, we will get a different runtime error CALL_FUNCTION_REMOTE_ERROR.
    Error Analysis in ST22 like this:
    An error occurred when executing a REMOTE FUNCTION CALL.
    It was logged under the name "CONVT_NO_NUMBER"
    on the called page.
    I think that means the application receive the runtime error from RFC when call  <b>RECEIVE RESULTS</b>.
    In normal CALL FUNCTION, the external application will accept the rumetime error throw from FM, that's correct, because it let the caller can handle these runtime errors.
    In you case, you said RFC run in a new task, yes, that's true, so you can call the RFC like this:
    CALL FUNCTION 'ZGZL_DUMPTEST'
    STARTING NEW TASK 'DUMP'
    PERFORMING RETURN_INFO ON END OF TASK.
    WAIT UNTIL SEMAPHORE = 'X'.
    WRITE: 'OVER'.
    FORM RETURN_INFO USING TASKNAME.
      SEMAPHORE = 'X'.
    ENDFORM.                    " RETURN_INFO
    It will goes well, no dump. Why? because we don't use RECEIVE RESULT. RECEIVE RESULT will bring the result from FM, also bring the runtime error from FM.
    So if you want to call the FM and receive the result, handle the runtime error in FM inside at first.
    like this:
      CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 1.
        a = 'A'.
      ENDCATCH.
      IF SY-SUBRC = 1.
        RAISE CONVERT_FAIL.
      ENDIF.
    And then you call FM like this:
    CALL FUNCTION 'ZGZL_DUMPTEST'
    STARTING NEW TASK 'DUMP'
    PERFORMING RETURN_INFO ON END OF TASK.
    WAIT UNTIL SEMAPHORE = 'X'.
    WRITE: 'OVER'.
    FORM RETURN_INFO USING TASKNAME.
      RECEIVE RESULTS FROM FUNCTION 'ZGZL_DUMPTEST'
              IMPORTING  OUT = LC_OUT
              EXCEPTIONS CONVERT_FAIL = 1.
      SEMAPHORE = 'X'.
    ENDFORM.                    " RETURN_INFO
    That's will be ok for your scenario.
    Hope my reply is useful.
    thanks

  • Is it possible to call custom designed RFC function module, apart from BAPI

    Hi Friends,
    1.     Is it possible to call custom designed RFC function module, apart from BAPI.
    2.     Why we call it Adaptive RFC layer, Since every time the JCO layer updated with SAP, Why can’t be dynamic.
    Thanx for Ur time.
    Cheers,
    Sam

    Also check <a href="http://help.sap.com/saphelp_nw04/helpdata/en/41/38bc8f813719488ddc9d9b21251ec3/frameset.htm">here</a> for more information on aRFC. Here you can find why it is called adaptive.
    Regards,
    Christophe

Maybe you are looking for