Calling RFC FM in update or background task

hi experts,
I have a RFC FM in system B and i want to call it from system A. if the system B is down when the call happens then the call is lost. basically i want the call happen when the system B is up. somewhere i have read that when u call the RFC FM in update task/ background task , SAP will try to make the call  to system B at periodic intervals of time till the system B is up. is that so? what is the difference between calling the RFC in update task and background task?
thanks

Hi,
the transactional RFC (tRFC) implements true asynchronous communication.
Remote system need not be available at the time of the RFC Client tRFC execution.
If the call is sent while remote system is unavailable, the call remains in the local holding queue and the calling program can continue to run without waiting the response of the execution.
If the RFC server is not activated until a certain period, the call is scheduled as a background job
For the transactional call to a remote function module we use the statement:
CALL FUNCTION <func> IN BACKGROUND TASK <task> (DESTINATION dest) u2026
The update task that you mentioned is something different than the RFC technique and in the case of the function module, the function must have the 'Update Module' parameters marked.
For more info about this topic please check the link:
[http://help.sap.com/saphelp_nw04/Helpdata/EN/41/7af4daa79e11d1950f0000e82de14a/frameset.htm]
[http://help.sap.com/saphelp_nw04/Helpdata/EN/41/7af4daa79e11d1950f0000e82de14a/frameset.htm]
Kind regards.
Andrea

Similar Messages

  • Calling RFC FM in update task / background task

    hi experts,
    I have a RFC FM in system B and i want to call it from system A. if the system B is down when the call happens then the call is lost. basically i want the call happen when the system B is up. somewhere i have read that when u call the RFC FM in update task/ background task , SAP will try to make the call to system B at periodic intervals of time till the system B is up. is that so? what is the difference between calling the RFC in update task and background task?
    thanks

    no replies

  • CALL FUNCTION IN BACKGROUND TASK - enable tRFC

    Hi Experts,
    I want to call a Remote Function module 'IN bACKGROUND TASK' and get the status in SM58 within the same AS. Kindly help me to do this.
    Requirement is to call the remote function module asynchronously in a guarentied way.
    Thank you
    Nikhil

    The scenario works fine for me. The issue was unable to create a proper test condition in the RFC.
    CALL FUNCTION 'ZMY_RFCASYNC'
       IN BACKGROUND TASK
       EXPORTING...
       TABLES...
       EXCEPTIONS...
    Simulated error condition in 'ZMY_RFCASYNC'
    and got entry in SM58 by simply making an exception. 
    Thank you all.

  • Table parameter of RFC FM in background task

    hi
    I have a RFC FM in system A which has two table parameters, first table parameter table1 will have the data and the second table parameter table2 will be filled with in the FM with the error and success messages. Now i am calling this RFC FM in a program in system B in background task. I am passing the values to the first table paramter table1. after the call i am using commit work. now my question is can i read the values in the second table parameter table2?
    report
    call function 'ABC' destination dest in background task
    tables
    table1 = itab1
    table2  = itab2
    commit work
    will the values be populated in itab2.?
    thanks

    Hi,
    yes u can surely read the values of the second table ,
    what ever parameters you pass to the FM whether it is an RFC enabled or simple FM they can be accessed by the report in which you r calling it.
    Call Function <FM>.
    Tables
       table1 = itab1
       table2 = itab2
    loop at itab1 into wa.
    write: wa-field1.               " Read the values of table1
    endloop.
    loop at itab2 into wa1.
    write: wa1_field1.            " Read the values of table2
    endloop.
    thanks
    ravi

  • Qs about call FM in background task, and monitoring in SM37.

    Hi, guys, i got a question here, if I call a FM using addition "in background task" in a Z program, does this mean the FM process is running in background? And can I monitor my task in sm37?
    i've tried to do that, the FM was successfully proceeded, but I cannot see anything related to that task in SM37 under mine user ID.

    No, you cannot see that in SM37.
    What it means is that the function is being executed in a seprated thread and the program that called the function will continue the execution without waiting for the function finish execution, that means the function is called in a synchronous manner.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • Error in debugging tRFC Function module (in background task) in SM58

    Hi,
    I am trying to debug this statement:
    CALL FUNCTION 'CRM_UPLOAD_TRIGGER'                 
      IN BACKGROUND TASK                               
      DESTINATION gv_smof_erpsh-rfcdest AS SEPARATE UNIT
    I have followed these steps:
    When you debug a program that calls function modules using the IN BACKGROUND TASK addition, they are processed in a background work process (additional internal session). If you set the In background task: Do not process option, the system collects the function calls, but does not start the background work process. The Debugger assigns a transaction ID, which identifies the background work process uniquely. You can now start the Debugger for the background work process using transaction SM58. You can select the function module concerned here, and then execute it via the Edit menu.
    but still i cant find any entry in SM58.
    Can anybody help me out in this?
    Thanks a lot.
    Best Regards,
    Shweta

    HI,
    When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
    If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days

  • Difference between calling a function module in background task and update

    Hi experts,
    Can someone explain me the basic difference between calling a FM in  background and update tasks?
    Also what is the advantage of using backgroud RFCs over the above 2.
    Thanks in advance,
    reddy

    This is essentially a difference of synchronization with the main program calling this FM.
    For Update task, we specify explicitely that we want to update some rows in a database table. But Update task is essentially for waiting that all tasks to do before are done and updating database at the end. The main point is that MF called in Update task wait for a COMMIT WORK to be executed.
    On the other hand FM in background task are executed immediatly and are not specific to updating database table : it can be a function that would return some values or something else like that.
    If you want to see more about difference between background jobs / update jobs, you can also have a look at transaction SM51. Here you will see all the servers composing your SAP instance and what kind of task they can execute :
    - background jobs corresponds to BATCH
    - update tasks corresponds to UPDATE
    Those 2 kinds of tasks stands not necessarily on the same server...
    Best regards,
    Samuel

  • Calling RFC enabled FM IN BACKGROUND TASK

    Hi Frnds,
    I have a requirement where in I need to call a FM which executes 'VA02' BDC in some user exit.
    Since this has to be executed after the commit work is executed in the calling program i am using the background mode.
    something like below,
      CALL FUNCTION 'Z_SD_AVAILABILITY_CHECK_BDC'
        IN BACKGROUND TASK
        DESTINATION 'NONE'
        TABLES
          t_vbap = xvbap.
    This above FM is RFC enabled.
    And this FM is also called successfully and VA02 is executed without any error. But the FM's session does not get killed after its executed completly. Instead it creates another session of the same FM and executes the BDC again. This is goion on and on and multiple sessions are created at the end.
    Am I missing something here? Do I have to include the Performing RETURN_INFO ON END OF TASK  also?
    Please give ur suggestions.
    regards,
    Karthick C

    Hi,
    Check the SM58 to see how many calls are there. It might be that the function is called multiple times every time the user exit is triggered. So put a break point in the user exit and check that the function is actually only called once per transaction.
    As the SAP help says that the calls are stored in the tables ARFCSSTATE and ARFCSDATA, it might be worth checking the entries of this table for the function calls before the transaction commit work is executed. See [here|http://help.sap.com/saphelp_nw04/helpdata/en/8e/d05f3ce4dd3370e10000000a114084/frameset.htm]
    regards,
    Advait
    Edited by: Advait Gode on Jun 22, 2009 11:19 PM

  • Call function IN BACKGROUND TASK don't work

    Hello,
    I've a interface RFC to JDBC asyncronous.
    When i call function in R3 (IN BACKGROUND TASK), sy-subrc = 0, however i don't see any message in SXMB_MONI and runtime workbench.
    The CC sender (for RFC) is OK,
    what happen?
    thanks very much

    Have this code after your call function:
    CALL FUNCTION 'START_OF_BACKGROUNDTASK'
         EXPORTING
              STARTDATE = SY-DATUM
              STARTTIME = TIME
         EXCEPTIONS
              OTHERS    = 1.
    IF SY-SUBRC = 1.
      EXIT.
    ENDIF.
    COMMIT WORK.
    Also, if you want to call your RFC function module in async mode, you can try
    Call function '<fm name>' in update task....
    Regards,
    Ravi Kanth Talagana

  • COMMUNICATION_FAILURE in CALL FUNCTION STARTING NEW TASK/Background task

    Hi friends,
    I am trying to use a FM in a Print Program (when user prints a document), using
    CALL FUNCTION STARTING NEW TASK 'TASK' DESTINATION 'NONE'.
    The program is triggered from VL02N tcode.
    But it's giving an exception - COMMUNICATION_FAILURE. Message is Error when opening an RFC connection
    I also tried
    CALL FUNCTION IN BACKGROUND TASK as Separate Unit
    then error message pops up - Database error when recording transactional RFC
    We are attaching a PDF file of the print to content server within this function module and because the "attaching" takes a while, this part needs to be detached from the print program so that we can avoid performance issue.
    I can't figure out the issue. i gues this is happening because print program is already running in Update task. I also tried with RFC enabled FM. Please help me resolve/understand the issue.
    Appreciate your help.
    Regards,
    Ronjan.

    Hi Ronjan,
    COMMUNICATION_FAILURE. Message is Error when opening an RFC connection
    I guess the reason for the above is that every RFC call synchronous/Asynchronous issues a DB COMMIT and we cannot have DB COMMITs in the V1/V2 updates, please go through the link below.
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/23/e9aa61638e404d81575e939b5cd847/frameset.htm
    Now, the possible solutions i can think of are,
    1) Call the FM in update task delayed start and try.
    2) Or create a report program and use SUBMIT (look at the job options as well).
    @Mainak
    3. Write a statement COMMIT WORK AND WAIT. This will actually invoke the FM
    Mainak, this will lead to a Update termination, as the program is running in an update task.
    Regards,
    Chen

  • Windows 8.1 background task Javascript - Call angular controller function from task js

    Hi,
    The Ionic Side menu starter template for windows 8.1 is a very good option to run the ionic apps on Windows  8.1 phones.
    I am not sure whether this is related to Ionic/angular or VS2013 CTP 3.1 but if anyone can give some tips ,that would be great. I registered a background task as per the VS tutorial (Run JS task in background) and i tested it with windows toast notifications.However
    my requirement is to access webservice in background which I am not able to implement.
    The setup for background task is path to the js file but my requirement is to call a function defined within a controller.Is there any way i can access the controller function from an outside js file.I am new to Ionic,Angular and VS 2013.Any help would be great
    The structure of background task js file is as below
    (function() {
       --- I need to call my controller/service  function here---
        var notifications = Windows.UI.Notifications;
        var template = notifications.ToastTemplateType.toastImageAndText01;
        var toastXml = notifications.ToastNotificationManager.getTemplateContent(template);
        var toast = new notifications.ToastNotification(toastXml);
        var toastTextElements = toastXml.getElementsByTagName("text");
        toastTextElements[0].appendChild(toastXml.createTextNode("From Background!"));
        var toastNotifier = notifications.ToastNotificationManager.createToastNotifier();
        toastNotifier.show(toast);
        close();
     

    Are there any updates on this issue? I'm currently seeing this on a Lumia 822 with WP8.1, and the app has never been published to the store. I've only ever deployed the app from Visual Studio to my device. It worked when deploying the Debug build, then I
    tried a Release build, and it crashed immediately upon launch when trying to register the background task, but then I was able to go back to deploying/debugging the Debug build on the device for awhile. I made more changes, and now neither Debug nor Release
    builds work--both fail on the BackgroundTaskBuilder.Register() call with the error described in the original question:
    "The drive cannot locate a specific area or track on the disk. (Exception from HRESULT: 0x80070019)"
    I've tried changing the Task name during registration, rev-ing the version number of the application, adding the call to BackgroundExecutionManager.RemoveAccess() before BackgroundExecutionManager.RequestAccessAsync(), changing the name of the IBackgroundTask
    concrete implementation and changing the corresponding EntryPoint in the package.appxmanifest (as well as in the BackgroundTaskBuilder instance), and changing the package DisplayName to a new reserved name, all to no avail. The only thing I didn't try
    was associating with an entirely new app in the app store or paving my phone, as these are both fairly undesirable "workarounds."
    Even if this won't affect clients downloading the app from the store, this is a major roadblock during development, as we can essentially only use the emulator to test an app specifically designed to help solve problems involving moving around physically
    in the real world.
    Any more information would be greatly appreciated. If there's any information I can provide, please let me know.

  • Creation of spool for job created by calling FM in background task

    Hi Gurus,
    1.Wanted to confirm if it is possible to attach spool to the job that has been created by calling a function module in background task.
    Currently I have created one RFC enabled FM and called it in background task. It runs fine, and the job is created which can be seen in SM37. But it does not contain the spool even if the RFC FM contains the code for list ALV.
    2. Also is it possible to control the name of the job created by calling the RFC FM in background task?
    Code for calling the FM is given below(ZK_XX is th RFC FM):
    CALL FUNCTION 'ZK_XX' IN BACKGROUND TASK
    CALL FUNCTION 'START_OF_BACKGROUNDTASK'
    EXPORTING
       startdate       = sy-datum
       starttime       = sy-uzeit
      NOSEND          = ' '
    COMMIT WORK.
    Thanks a lot for your help!!
    Warm Regards,
    Raveesh

    Thanks for replying.
    I need to do the processing in background. Hence using 'IN BACKGROUND TASK' addition.
    Please let me knowif you have some idea.
    Thanks & Warm Regards,
    Raveesh

  • RFC in background task LUW

    Hello,
    I've two RFC in user-exit. Both, using IN BACKGROUND TASK DESTINATION XI
    When i execute the transaction, the user-exit is raising and i can see the follow error in SM58:
    maximum size of requests for one LUW has been reached(1).
    I've changing in the CC the parameter Maximum Conecction, however the error continue.
    If i comment the second call function in the user-exit, the first call function is executed OK, the interface is right,
    ¿how can i do to execute two functions in the same LUW?
    thanks

    Hi,
    >>¿how can i do to execute two functions in the same LUW?
    you cannot - you need to do "commit work." after each RFC call
    Regards,
    Michal Krawczyk

  • RFC  IN  BACKGROUND TASK

    Hai all,
    I created RFC 'ZBAPI_BACKPROCES' .
    And Im using this RFC in my ABAP program.
    BUT I having to call this FUNCTION MODULE in background Task .But I dont know how its working and also this FM does not returning any values.
    Can anyone Say  example with explaination (how its working).
    Thanks In Advance.
    regards,
    Ekadevi.S

    Here's a good explanation of the RFC types:
    [Master the five remote function call (RFC) types in ABAP|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f078394a-4469-2910-c4bf-853c75674694]
    Tim

  • Calling RFC In background

    Hi All,
    I have a situation here.I need to call an rfc from  another SAP system.And I need to wait for that RFC to get completed before I process with my caller program.
    The problem here is that Function module is slow and it goes into timeout error in the source system since it starts the process in dialog process
    So I was wondering if I can run this RFC in background in the source system through my caller program and wait till the RFC gets executed completly befor my caller program proceeds.
    I tried using "In background Task " addition but it stil runs the function module in dialog process and also the wait command doesn't work.
    Can anybody help me.
    Thanks
    Umang

    Hi Umang,
    As far as I know, If the DESTINATION is not available for the processing then only it starts the processing in Background mode.
    Nut IN BACKGROUND TASK doesn't mean that it will process the FM in background.
    Reward points if useful.
    Regards,
    Atish

Maybe you are looking for