RFC Function Module

Hello,
I am trying to get the records using RFC FM in IT_DATA[] using the following. But I am not getting any records in it. it_data is declared as (DATA: it_data   TYPE tab512 OCCURS 0 WITH HEADER LINE.)
  LOOP AT it_rseg_data.
  it_options-text = 'BELNR = '.
  CONCATENATE ' '' ' it_rseg_data-belnr '''  AND ' INTO objid.
  CONDENSE objid NO-GAPS.
  CONCATENATE it_options-text objid INTO it_options-text
  SEPARATED BY space.
  APPEND it_options.
  ENDLOOP.
IT_OPTIONS gets built with different values of BELNR from it_rseg_data table.
    For Ex. BELNR = 1234
                BELNR = 5678
PERFORM read_rbkp_belnr_details USING p_logsys bldat bldat_to.
FORM read_rbkp_belnr_details USING p_logsys LIKE rfcdes-rfcdest bldat bldat_to.
DATA: l_errflg TYPE char1. CLEAR: it_data.  REFRESH: it_data.
  CHECK NOT vt_fields[] IS INITIAL.
read data from backend
  PERFORM read_table_rbkp_for_belnr USING 'RBKP'
                                            p_logsys bldat bldat_to
                                           CHANGING l_errflg.
ENDFORM.    
FORM read_table_rbkp_for_belnr USING pi_tabname LIKE dd02l-tabname
                                     pi_logsys bldat bldat_to
                                     CHANGING pc_errflg.
  REFRESH it_data. CLEAR it_data.
   CALL FUNCTION 'RFC_READ_TABLE'
    DESTINATION PI_LOGSYS
    EXPORTING
      query_table          = 'RBKP'
    TABLES
      OPTIONS        = it_options
      fields               = vt_fields
      data                 = it_data
    EXCEPTIONS
      table_not_available  = 1
      table_without_data   = 2
      option_not_valid     = 3
      field_not_valid        = 4
      not_authorized      = 5
      data_buffer_exceeded = 6
      OTHERS               = 7.
  it_rbkp_data [] = it_data [].
Shall appreciate if anyone can tell me where I am doing wrong and how do I correct it.
Thks,
Hemal
Edited by: hemalgandhi on Mar 25, 2009 4:25 PM
Edited by: hemalgandhi on Mar 25, 2009 4:26 PM
Edited by: hemalgandhi on Mar 25, 2009 4:26 PM

I think problem is while creating the options internal table
LOOP AT it_rseg_data.
it_options-text = 'BELNR = '.
CONCATENATE ' '' ' it_rseg_data-belnr ''' AND ' INTO objid.
CONDENSE objid NO-GAPS.
CONCATENATE it_options-text objid INTO it_options-text
SEPARATED BY space.
APPEND it_options.
ENDLOOP.
Say for example if you are inserting for BELNR 1000 then after your loop
it looks like
BELNR = '1000' AND.
I think you need to remove the AND from the last record

Similar Messages

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

  • Using RFC Function Module to send data to NON SAP Application

    Hi friends,
    Please guide me how can I send data from SAP -> Dotnet Applcation using Dotnet Connector through RFC function module from SAP side. In my scenerio, I Run Z transaction  to executte RFC function module which create some data to pass to dotnet connector.
    Regards,
    Rajesh Kumar

    Hi,
    You can make use of Dotnet connector to read the content of SAP RFC .. (eaiest of all)
    The RFC can be executed using connector , and can read the data simultaneously.. u need to code in dotnet for this..
    else create a webservice and read it from dot net ..
    Regards
    Renu Gusain
    Edited by: Renu Gusain on Jan 25, 2010 12:55 PM

  • How to debug a RFC function module remotely from another R/3 system?

    Hi experts,
       I have RFC function module in one R/3 system. I am calling this from another R/3 system that is cross apps (Xapps).
       This function module is Synchronous.
      Is it possible to debug this function module from cross apps?
      Can somebody give me the steps?
    Thanks & Regards
    Gopal

    Hi Shree,
       Can you explain it bit more?
       Do I have to call the function  module with "IN BACKGROUND TASK"?
       Or is it that I have to just put external breakpoint in the function module?
       Please help
    Thanks
    Gopa

  • 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

  • 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

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

  • Problem with RFC function module from R/3 to CRM

    Hi, i have a RFC function module created in R/3, this is the code:
    function Z_CRM_PRODUCTO_INTERLOCUTOR.
    ""Interfase local
    *"  IMPORTING
    *"     VALUE(GV_VKORG) TYPE  VKORG
    *"     VALUE(GV_VTWEG) TYPE  VTWEG
    *"     VALUE(GV_MATNR) TYPE  MATNR
    *"     VALUE(GV_KUNNR) TYPE  KUNNR_V
    *"  EXPORTING
    *"     VALUE(GV_KDMAT) TYPE  MATNR_KU
    *"     VALUE(GV_POSTX) TYPE  KDPTX
    *"  EXCEPTIONS
    *"      NOT_FOUND
      UNPACK GV_MATNR TO GV_MATNR.
      UNPACK GV_KUNNR TO GV_KUNNR.
      select single  KDMAT POSTX
              into (GV_KDMAT, GV_POSTX) from KNMT
              where   VKORG = GV_VKORG
                      and  VTWEG = GV_VTWEG
                      and  KUNNR = GV_KUNNR
                      and  MATNR = GV_MATNR.
      IF sy-subrc <> 0.
        RAISE NOT_FOUND.
      ENDIF.
    endfunction.
    When i call this function from CRM, i do it like this:
    CALL FUNCTION 'Z_CRM_PRODUCTO_INTERLOCUTOR'
      DESTINATION LV_RFCDEST
      EXPORTING
        GV_VKORG  = lv_vkorg
        GV_VTWEG  = ORGMAN_H-DIS_CHANNEL
        GV_MATNR  = ORDERADM_I_WRK-ORDERED_PROD
        GV_KUNNR  = WA_DATOS_PER-N_PAGADOR
      IMPORTING
        GV_POSTX  = IT_POS_LINE-DESCRIPCION
        GV_KDMAT  = IT_POS_LINE-material
      EXCEPTIONS
        not_found = 1.
    where:
    it_pos_line-descripcion type string
    it_pos_line-material type string.
    Well, my problem is that when debugging, in R/3 the 2 return values have the correct value, but when they are passed to CRM they have only one position.
    As i've been told, it was working ok, but it's being wrong since we made a ¿conversion to unicode?. Maybe I should change the type of return ???
    Thanks in advance !!!

    Hello Maria,
    Make sure you define your parameters in CRM exactly the same way as in R3, do not use type string here.
    So:
    it_pos_line-descripcion type C char 40,
    it_pos_line-material type C length 35.
    Kind regards,
    John.

  • Debugging RFC function module from ECC to CRM

    Hi All,
    My requirement is to debug an RFC function module present in CRM(7.0) system from ECC(6.0) system. A report program in ECC will call CRM custom FM. I found many posts in SDN with the same issue and tried to implement suggestions provided there. But I couldn't succeed. The approach I followed is:
    I logged in to ECC report program and kept an external breakpoint just before the function module call.
    I logged in to CRM system, opened the function module and kept an external breakpoint there.
    In both the systems I provided the dialogue userid( id through which I log in to SAPGUI) in the system->settings->debugging option.
    In CRM I activated the external break point in  transaction SRDEBUG.
    Now when I execute the report program in ECC, control stops at the breakpoint. If I press F5 at the function call, control is not going to the external break point set in the CRM FM. I am getting output of FM directly.
    I tried with different settings like turning on the check box for IP matching and session breakpoint active immediate, switching to classic debugger etc. I also tried to provide the RFC user id instead of dialogue user but system throws exception saying only dialogue userids are allowed. I found that by inserting an infinite loop statement, control goes inside the RFC CRM FM but I prefer not to change the code.
    Please let me know if I missed anything.
    Thanks and Regards,
    Naren

    Hi,
    Debug RFC calls
    When an RFC function module is called it is usually not possible to debug the call, using the below techniques we can achieve the same. For this example we are calling an RFC enabled FM in ECC system from CRM system.
    Scenario 1: Calling a custom RFC FM
    STEP 1: Add an infinite loop in the remote custom Function Module (adding a u201CDO. ENDDO.u201D statement at the start of the FM would be enough).
    STEP 2: Execute your program in the CRM system. The execution stops at the RFC call, because of the infinite loop.
    STEP 3: Now login to the ECC system and go to transaction SM51 select the process which is executing the RFC and navigate to the menu: u201CProgram/Session->Program->Debuggingu201D this triggers the debugger session in a separate window.
    Scenario 2: Calling a Standard RFC FM
    When we are debugging a standard program we cannot add the infinite loop, hence we cannot go to SM51 and debug the work process. The RFC destination for the ECC system has a User specified, the RFC function module gets executed using this users credentials. Usually the basis team set up the RFC user as non Dialog user, this does not allow debugging. Contact your Basis team and get this changed to a dialog user enabling you to debug RFC function calls via the normal debugger.
    Note: User name configured in the RFC destination (transaction SM59) 
    Note: User type for the RFC User (transaction SU01D)
    Hope this will be helpful..

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

  • Error when call RFC Function module in R/3

    Dear All,
    We are trying to call RFC function module CBIF_GLM1_PROCESS_ORDER_READ (This is not a BAPI and also not released ) in R/3 from XI system.
    we are facing the error "Error while lookup Exception during processing the payload. Error when calling an adapter by using the communication channel CC_PPPI_MES_RFC_Rcvr (Party: , Service: WCD_320, Object ID: 16563889b449328eac76caa6a3bc592e) XI AF API call failed. Module exception: 'error while processing the request to rfc-client: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: failed to parse BAPI response due to: com.sap.aii.adapter.rfc.util.bapi.BapiException: Parameter with name RETURN not found.'. Cause Exception: 'com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: failed to parse BAPI response due to: com.sap.aii.adapter.rfc.util.bapi.BapiException: Parameter with name RETURN not found.'."
    This is the first time we are doing this configuration.
    Could you please let me know what woulbe the reason.

    read the original message
    We are trying to call RFC function module CBIF_GLM1_PROCESS_ORDER_READ (This is not a BAPI and also not released ) in R/3 from XI system.
    I am talking about the above Receiver RFC channel which you guys are using to call R/3 from XI. That where you need to change the commit parameter

  • Get interface of RFC function modules in a remote system

    Hi,
    my goal is to write a report which checks if DDIC structures in two systems fit together when I use RFC`s.
    I have the destination and the name of the RFC.
    Can somebody tell me if I can get a list of the Importing/Exporting Parameters of this RFC? Maybe even with a typedescribtion?
    Thanks for you help.
    Best regards
    Lars
    Edited by: Lars-Eric Biewald  on May 21, 2008 8:39 AM

    Hello ,
    Thank you for your quick help.
    Here I have 3 ECC 6 system .
    1 Central systen
    2 Slave system
    Data will be updated to 2 slave system using RFC function module .
    We've already the SAP address, Client, User name , Password.. of the remote system
    So here how we will create RFC in SM59 to be used in the RFC call ?
    We will transfer the username, password , client in the RFC function module/..
    Here I do not know how to create RFC connection in SM59 and how to use them in ABAP
    Could you please help me ????
    Thanks

  • Passing the structure to rfc function module

    hi,
    iam having a rfc function module which is importing structure.
    i have to pass only one field value to that structure.
    how can i pass that field value to that structure.
    it is very urgent.
    thanks in advance

    Hi..
    You have to Declare the ACTUAL PARAMETER (workarea) with the Same Structure as that of the FORMAL PARAMETER.
    but you can fill only the FIELD that you want pass in the workarea and pass it to the RFC.
    <b>Reward if helpful.</b>

  • Calling RFC Function module from JAVA

    Hi All,
       We have created a RFC Function Module for Billing Plan tab in Sales order (BDC). The function Module contains BDC. When we are running the same function module in SAP it is working fine. But when the FM is called in Java , it is allowing only maximum of 5 entries , when we trying to insert at 6th position in billing plan tab, we are getting an error.
    Can any one help on this.
    Points will be rewarded for helpful answers.
    Thanks & Regards,
    Kiran I

    I think the problem is because of the number of lines displayed on the screen in the BDC session in the Billing Plan.
    You might have to add the page down logic to your BDC program.

  • Standard Component in CRM that will call RFC Function Module

    HI all,
    Is there any Standard Component in CRM that will call RFC Function Module from ECC and that called RFC FM should Fetch the data from ECC.

    You can call RFC from different places, like programs, function modules, web dynpros, classes...
    So you just have to have appropriate RFC on ERP side and call it from CRM side. To call it you use the following statement...
          CALL FUNCTION 'YOUR RFC FUNCTION'
            DESTINATION i_dest "name of server
            EXPORTING
              your export parameters
            IMPORTING
              your import parameters
    Regards.

Maybe you are looking for

  • Why does the bit debth of my raw file image different in my camera, in Brigde and in when opened in Photoshop?

    I have a Nikon D700 12 megapixel full frame camera which has a 12 – 14 bit depth. I usually shoot images with the Nikon raw file format (NEF) with the color space setting at Adobe RGB (1998). When I select a photo to look at the details of the metada

  • TMS import stops working

    Hi Gurus We have been importing transports into qas client 200 without any problems, we then created client 300 in qas and when we tried to import the transports that were already in the queue, the import started hanging, i checked the logs and saw t

  • AIR Deployment stability questions

    I just published an AIR app from Flash CC 2014 and I'm viewing on my Kindle Fire. There are a few things that I see which I need to address before I finish the build. Since I'm new to AIR deployment I would think someone would give me a bit of knowle

  • Editing Sequences together Using the Multi-Cam function

    I'm trying to use the multi-cam editing function in FCP to edit together 4 different sequences I have already edited. However, FCP isn't letting me do this. Is there a better way to get around this than exporting my sequences as quicktime files, impo

  • Adobe Creatite Suite 6 Design & Web Premiumのインストールについて

    質問です. adobe Creatite Suite 6 Design & Web Premiumの製品を2台目としてインストールしましたが.パソコンが調子が悪く初期化をしましたら全部なくなってしまいました. wordなどは直ぐにインストール出来ましたが.この製品のインストール方法を教えてもらいたいです. 因みに1台目は富士通のパソコンで.インストールする2台目はマイクロソフトのサーフィスです. 宜しくお願いします.