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

Similar Messages

  • What is the difference between the normal function module and bapi function

    hi,
    what is the difference between the normal function module and bapi function module.

    Hi
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    Regards
    Anji

  • Calling function modules in background task

    Hi All,
    I am creating a notification in the background and linking it to an order. This I am doing inside a function module which is called in background task as a separate unit. I should change the user status of this newly created notification. This I am doing in another FM called as a separate unit. Now my requirement is that, I need to perform the status change only after the new notification is committed to the database. I would like to know if i can provide some time lag between the 2 FM execution. Can anyone tell me how much time will be consumed to commit the data to the database tables irrespective of the length of the data. Say for example, if i have hundreds of notifications within the object list tab of an order, I want to know what is the maximum time it will take to commit this to the database table so that I can put a wait conditionat the stat of the second FM call.
    Thanks

    Ok thanks. But let me tell you 1 thing, actually I am calling these 2 FMs within an enhancement section just before another FM CO_ZV_ORDER_POST which is actually doing a commit work. So is it OK if I call the 1st FM in background task and the second FM in update task in the same place as I am calling the FMs now(i.e., before CO_ZV_ORDER_POST)?

  • What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?

    Hi experts,
    I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
    1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
    2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
    3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
    Finally, thanks for reading and help.

    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

  • Call function module in backgrouns task and in update task

    Hi Gurus,Pls crear me on the " <b>Call function module in backgrouns task and in update task</b>".
    how it works and waht is the link with LUW  releated to these .
    also heard that commit work statement aslo linked with this.
    Pls clarfiy me with expalnation of code.

    Hi sridhar,
    the explanation already given is correct and good. Small add-on:
    All functions called during one LUW with addition IN UPDATE TASK are stored together with their actual parameters in a temporary memory area. The moment a COMMIT WORK is issued, the functions are released to be executed by a so-called update task which is running in the background. This explains why functions called in update task never return anything, no SY-SUBRC and no export or table parameters If a function called in update task raises an exception or runs into an error the calling user will get an express message informing about this. Also, all database updates done by this update process are rolled back to keep consistency.
    This proceeding helps to keep database tables consistent and allows the user to keep on doing his work before all database updates are complete. You may have seen messages like "material will be changed" after saving. If you open the same material immediately, you'll get a message "object locked by...<yourself>". This means the update task is still running.
    Regards,
    Clemens

  • Jco Call a Function Module in BackGround

    Hello All.
    Some one can send me a simple exemplo how to call a ABAP Function Module in BackGround.
    Can i set this in Java side?
    ..or only set the BackGround Work Process in SAP side?
    In my java application call the Abap Function Module like this:
    client.execute(function);
    How to set parameters to execute the function in BackGround.
    My rpoblem is when the return the data to java side ...occurs the error TIME_OUT in Dialog WorkProcess.
    I need to call in background to better performance and to prevent the TIME_OUT.
    Best regards.
    Taylor.

    Hi.
    I don’t know how to do, but, you can do a previous RFC, this new RFC execute the original function in background mode. I did something like that:
    - JAVA: client.execute("RFC_FUNCTION", input, output);
    - SAP: RFC_FUNCTION:
    CALL FUNCTION func IN BACKGROUND TASK
                         [DESTINATION dest]
                         parameter_list
                         [AS SEPARATE UNIT].
    or
    CALL FUNCTION update_function IN UPDATE TASK
                                 [EXPORTING p1 = a1 p2 = a2 ...]
                                 [TABLES t1 = itab1 t2 = itab2 ...].
    I hope that help you

  • Difference between a programe&function module in R/3 & BW

    Hi Gurus
                    i would like to know differenece between programe and function module in R/3
    and BW, so can some one give me  a brief idea about it cheers thanks .....

    Hi,
    Function modules are ABAP routines that are administered in a central function library. They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group. A function group is nothing but a container for the function modules. Now create a function group and then a function module.
    it is  a kind of standrad program where u can use it in differnt local programes .
    take an example  standrad function module "REUSE_ALV_CHECKBOX_SET"  suppose u want to create a checkbox in output screen u dont need to write a program for that u can use above mentioned function module in ur programe.
    hope this information helps u
    Regards,
    Gurudatt Bellary

  • Function module in background task

    Hi,
    I have a user-exit, that must modify a value. But this value  have a lock entry (it's my own transaction that set this lock-entry). So I would like to call a function in background task to modify the value when the lock entry disapear.
    But ...
    I don't see anything append in the SM50.
    If I call the function not in background, I could debug the function.
    When I set background debugging nothing append.
    I have set the RFC option in the function module.
    CALL FUNCTION 'ZCALL_MB26_CONFIRMATION_OT'
      IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION 'NONE'
    Rgd
    Frédéric

    Hello Fred,
    This is a sample code to wait for unlock (but if a user is in modification it can be endless).
      data : w_garg like  seqg3-garg.
      data : t_enq like seqg3 occurs 0.
      concatenate sy-mandt tplnr into w_garg.
      do.
        refresh t_enq.
        call function 'ENQUEUE_READ'
         exporting
           gclient                     = sy-mandt
           gname                       = 'IFLOT'
           garg                        = w_garg
      GUNAME                      = SY-UNAME
      LOCAL                       = ' '
    IMPORTING
      NUMBER                      =
      SUBRC                       =
          tables
            enq                         = t_enq
    EXCEPTIONS
      COMMUNICATION_FAILURE       = 1
      SYSTEM_FAILURE              = 2
      OTHERS                      = 3
        if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        if t_enq[] is initial.
          exit.
        endif.
      enddo.
    David

  • 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

  • Calling function module in background task

    Hello,
    There is one function module which is called in background task. Is there any chance that background task is not created and function module is not executed. That function module is supposed to send some outbound message. The FM is called in one user exit. I don't have any idea as why it is called as background task. The probem is that this message is not getting send sometimes.(sometimes it gets send ). Because of this I am not able to make any conclusion.
    Please respond if anyone has come across such scenario before.
    Thanks in advance,
    Minal

    Check the below link...it might be helpfull
    It should be executed....check it with different data as to what might fail
    http://help.sap.com/saphelp_nw04/helpdata/EN/8f/53b67ad30be445b0ccc968d69bc6ff/content.htm
    http://help.sap.com/abapdocu/en/ABAPCALL_FUNCTION_BACKGROUND_TASK.htm

  • Debugging the Functional Module in Background.

    I am calling a Custom Functional module in Background mode using the syntax CALL FUNCTION ZFM in background task.
    Can anyone tell how to debug the code using this..
    Thanks ,
    Yatish

    Hello Yatish
    You could try to use the following trick:
    (1) Put an endless loop into the coding of your function module where you want to start debugging, e.g.
      DATA:
        lx_exit_loop(1)     TYPE c.
      lx_exit_loop = ' '.
      DO.
        IF ( lx_exit_loop = 'X' ).
          EXIT.
        ENDIF.
      ENDDO.
    (2) Call your function module in background task
    (3) Call transaction <b>SM50</b> and search for the background process.
    (3) Choose from menu <i>Program/Mode -> Program -> Debugging</i>
    Now you the debugger should bring you right to your endless loop. Set lx_loop_exit = 'X' in the debugger and continue (F5 or F6).
    Regards
      Uwe

  • Call function module in new task

    I need to call a function module starting new task but the problem is that it has inporting parameters also. Please help me in doing this. Points will be rewarded.

    Look at the ABAP keywords RECEIVE RESULTS FROM FUNCTION.  This is where you can get the results from the CALL FUNCTION MODULE... NEW TASK...
    It's all in the ABAP help for CALL FUNCTION MODULE.
    matt

  • What is the exact syntax for calling remote function module.

    Hi to all
    1.....what is the exact syntax for calling remote function module.?
    Thanks and regards,
    k.swaminath reddy

    hi
    good
    Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
    Do the following steps for creating RFC in server A.
    1. log on to server A
    2. go to se37
    3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
    4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
    5. go to attribute tab -> choose remote-enabled module from processing type.
    so that your FM will become RFC.
    6. provide the import parameter in import tab.
    we will provide only two import parameters.
    - parameter name : P_NUM1, typing: TYPE, associated type : I & check the pass value (all the parameters of RFC must pass by value).
    - parameter name : P_NUM2, typing: TYPE, associated type : I & check the pass value
    7. provide the export parameter in export tab.
    parameter name : P_SUM, typing: TYPE, associated type : I & check the pass value
    8. write the given simple code in source code tab.
    FUNCTION Z_TEST_RFC.
    P_TOT = P_NUM1 + P_NUM2.
    ENDFUNCTION.
    Do the following steps for creating ABAP program which will call the RFC in server B.
    1. se38 - > creat a program.
    2. write the given simple code.
    data tot type i.
    call function 'Z_TEST_RFC' destination 'XXXXXX'
    exporting
    p_num1 = 10
    p_num2 = 15
    importing
    p_tot = tot.
    write tot.
    please note that XXXXXX is RFC connection which is avialable in sm59 transaction in server A.
    -go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of XXXXXX in the code.
    finally you can execute the normal abap program that will call the RFC and display the result.
    reward point if helpful.
    thanks
    mrutyun^

  • Program making a RFC call to Function Module not working in background

    Hi All,
    I have an ABAP Program which is used to do a reconciliation check between the R/3 and BI system for Invoice Data. Please find below the details of the program flow:
    1.     Program counts the number of records in the DSO table and aggregates the Net_Value based on the date range (passed as parameters)
    2.     Program calls a Function Module (RFC Call) which counts the number of records in the R/3 table and aggregates the Net_Value for the same date range
    3.     Function Module Passes back the count values and aggregated Net_Value to the program
    4.     Program compares the count and aggregated Net_Value from EDWH and MSP systems and sends an email mentioning whether the counts match or not
    However we are facing an issue.
    Whenever, we execute the program in dialog mode, it works fine and fetches results within 5-6 minutes. However if we schedule the program to run in background (parameters through a variant), it gives no results even after running for over 3-4 hours. We tried figuring it out yesterday but could not come to any conclusion. Since there is a RFC call being to the function module, we were wondering if we need to specify some other parameter as well.
    Thanks & Regards
    Dharmendra

    RFC Call is a procedure for executing remote enables function modules. It is done via the 'Remote Enabled' radio button on the function module's attribute screen.

  • Difference between HR programing & other module programming

    Hi
    What are difference between HR programming & other module programming?
    This is one of interview questions from IBM.
    Any body can answer for me?
    WIth Regards,Jaheer.

    Dear Jaheer,
    Advanced Business Application Programming ABAP is SAP's fourth generation language. All of R/3's applications and even parts of its basic system are developed in ABAP. ABAP is used for customization and modification of SAP applications. 
    In HR ABAP use of select statements significantly less than in other areas of ABAP development, Logical databases have limited applications in other modules but are very useful in HR. Also, you really need to understand the infotype time constraint concept since the data organization in HR is Employee-Time based,     When you cannot get the information that you need out of the logical DB look at the function modules starting with HR* and RH*. These function modules will provide you with multiple ways of accessing data to save time. Worst-case scenario, use a select statement.
    In addition to the LDB, HR programming also involves the use of Macros for data extraction,
    The storage an access of data is different,
    Authorization checks.
    The Human Resources module uses a system of data grouped together called infotypes. The Human Resources module uses a system of data grouped together called infotypes. And storing bulk data like time management and Payroll data in Cluster files. HR Programming involves data extraction and manipulation from these infotypes and clusters using LDB/MACRO and function modules.
    Infotypes mirror a quantity of connected data records; infotypes are identifiable through a four character numerical string .
    You can save the infotypes as time-dependent to enable a retroactive evaluation of Employee data.
    The infotypes appear as an entry screen for the user, through which you can maintain infotype records. Infotypes can be processed individually or in fast entry mode.
    Regards,
    VIjay

Maybe you are looking for