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

Similar Messages

  • Tech architecture of CM&RM update tasks and MM update tasks

    Hi all!
    I'm experiencing a problem to make a correct technical architecture of such a functionality: when the user update MM document (MIRO, which is parked or when a reversal is made) I need to update the linked case(s) (Case Management document).
    How to make a real transactional behavior (e.g. if something with saving MM doc went wrong all the changes in MM AND CM is rolled back and vise versa). Which methods of CL_SCMG_CASE_API I need to use? How to use CL_SCMG_CASE_API -> G_UPDATE_TASK? When to call IF_SCMG_CASE_API~SAVE? When CLOSE? Where I can read about this?
    I'm using in business logic this CM and RM methods:
    IF_SCMG_CASE_API~CREATE
    IF_SCMG_CASE_API~ATTRIBUTE_CHANGE
    IF_SCMG_CASE_API~ELEMENT_INSERT
    IF_SRM_SP_RECORD~ELEMENT_DELETE_BY_ID
    IF_SRM_SP_RECORD~SAVE
    I will be very much appreciated for architecture example.
    Paul.

    Hi all!
    I'm experiencing a problem to make a correct technical architecture of such a functionality: when the user update MM document (MIRO, which is parked or when a reversal is made) I need to update the linked case(s) (Case Management document).
    How to make a real transactional behavior (e.g. if something with saving MM doc went wrong all the changes in MM AND CM is rolled back and vise versa). Which methods of CL_SCMG_CASE_API I need to use? How to use CL_SCMG_CASE_API -> G_UPDATE_TASK? When to call IF_SCMG_CASE_API~SAVE? When CLOSE? Where I can read about this?
    I'm using in business logic this CM and RM methods:
    IF_SCMG_CASE_API~CREATE
    IF_SCMG_CASE_API~ATTRIBUTE_CHANGE
    IF_SCMG_CASE_API~ELEMENT_INSERT
    IF_SRM_SP_RECORD~ELEMENT_DELETE_BY_ID
    IF_SRM_SP_RECORD~SAVE
    I will be very much appreciated for architecture example.
    Paul.

  • 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

  • Calling Function Module in Update Task

    Hello Experts,
                              Can anyone let me know about
    Calling Function Module in Update Task.
    Why do we use this " In Update Task "  ??
    How do we Use ??
    What is the Use... ??
    Kindly let me know....
    Thanks and Regards
    Pramod

    hi,
    Why do we use this " In Update Task " ??
    The main update technique for bundling database changes in a single database LUW is to use CALL FUNCTION... IN UPDATE TASK.
    How do we Use ??
    A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.
    What is the Use... ??
    Asynchronous update is useful when response time from the transaction is critical, and the database updates themselves are so complex that they justify the extra system load
    Real time scenario.
    Suppose a user wants to change an entry in a database table, or add a new one. He or she enters the necessary data, and then starts the update process by choosing Save. This starts the following procedure in the ABAP program:
    Firstly, the program locks the database entry against other users, using the enqueue work process (or the message server in the case of a distributed system). This generates an entry in the lock table. The user is informed whether the update was successful, or whether the lock could not be set because of other users.
    If the lock is set, the program reads the entry that is to be changed and modifies it. If the user has created a new entry, the program checks whether a record with the same key values already exists.
    In the current dialog work process, the program calls a function module using CALL FUNCTION... IN UPDATE TASK, and this writes the change details as an entry in table VBLOG.
    When the program is finished (maybe after further dialog steps), a COMMIT WORK statement starts the final part of the SAP LUW. The work process that is processing the current dialog step starts an update work process.
    Based on the information passed to it from the dialog work process, the update work process reads the log entries belonging to the SAP LUW from table VBLOG.
    The update work process passes this data to the database for updating, and analyzes the return message from the database. If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG.
    If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user, who should then inform the system administrator.
    The corresponding entries in the lock table are reset by the update work process.
    Hope this is helpful, Do reward.

  • Why Service Call and why not call Function module Directly in WD ABAP

    Hi,
    I have created a Webdynpro applications and the logic requires calling avrious Function modules.
    Do I need to create Service Call for each Function module or call them directly.
    It would be great if you can suggest me under what cases I need to opt for Service call
    For example, if I use 'RP_CALC_DATE_IN_INTERVAL', do I need to use Service call or call function module directly.
    Note: I have searched forums but could not get the correct answer which I want
    Thanks!

    The Service Call is really meant to be a wizard/time saver.  It has the advantage that it can generate matching context nodes/attributes for the interface of the Function Module you are calling. However everything that the service call does can also be created by hand.
    Personally I'm not a fan of what the service call wizard generates.  Its good as a time saver or for beginners, but I find I prefer to touch up the code it generates anyway. I much prefer to create a nice reusable model class with its own unit test and then consume this model class (with the service call wizard) from WD.  This model class might contain one or more function module calls depending upon what logic I need to access.

  • 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

  • Requirement to call Function Module in Workflow

    Hi,
    I have been assigned to task wherein i have a requierement like this . I have created a workflow with step user decision with 2 options. Now the thing is that when user select one of option i need to call function module and based on result from
    workflow i need to done further processing. Since there is no event to trigger workflow i am using function module
    SAP_WAPI_START_WORKFLOW to trigger workflow .
    Kindly suggest me how would i call Function module in workflow. i.e. What are the ways( or by which step type facilitate
    me to call FM ) by which i should call FM and do further processing based on result.
    Thanks
    Parag

    Follow the below steps inorder to call a fucntion module from the workflow
    1. First you have to create either a business class or a Business object.... from SWO1 txn..
    2. Create a method in the BOR and while created the system will prompt a message that would you like to create by using any FM here you need to specify the name of the FM that you want to use in the workflow...
    3. ONce the method is created and the code will be generated automaticlaly by the system.. and then you have to create a standard task from PFTC txn..
    4. Once the task is created then you have to use the same task in the workflow.. by creating a activity step ...
    That's all..

  • Uncatchable exception: BSP calling Function Module

    Hi all,
    currently i'm facing a very weird problem. My application class calls function module
    HR_INFOTYPE_OPERATION. Normally, in case of an error, the function module gives you back a return parameter. But if i call it from my BSP, the processing doesn't leave the function module. It directly throws an exception ERROR_MESSAGE_STATE instead of writing the message into parameter return.
    If i call the function module with the same parameters from a report, it works fine and the error message is written to return parameter without throwing an exception.
    What am i doing wrong? I don't want that exception and need to go on with filled parameter result.
    Regards
    Mark-André

    Hi MA,
    try using ERROR_MESSAGE in the exceptions list, like this.
    CALL FUNCTION 'func_name'
         EXPORTING
              string            = text
              pos               = position
         IMPORTING
              string1           = text1
              string2           = text2
         EXCEPTIONS
              string1_too_small = 1
              string2_too_small = 2
              ERROR_MESSAGE     = 3
              OTHERS            = 4.
    Cheers
    Graham Robbo

  • Third party system call function module/BAPI through RFC to update Z table

    Dear Friends,
    We have a third party system which directly inserts a Z table in SAP through its programming, which is an auditing issue.
    We want the third party system should call function module/BAPI through RFC so that the Z table gets updated.
    waiting for inputs..
    Thanks,
    Kumar

    if third party system is capable of making Remote Function call, then writing a Function module & making it remote enable is not difficult task in ABAP.
    You may have to prepare specifications first to decide if third party system is going to Read, insert, update, delete records from Zee table.

  • Calling Function Module RV_ORDER_FLOW_INFORMATION in a Loop!

    Hi Guys,
    I need to fetch SD document Flow data into Bw for which I have created an Extractor using function modules. I am using a Standard FM  "RV_ORDER_FLOW_INFORMATION" which is called in the LOOP as below.
    LOOP AT VIT_VBRK INTO VFL_VBRK.
        CLEAR VBCO6.
        VBCO6-MANDT = SY-MANDT.
        VBCO6-VBELN = VFL_VBRK-VBELN.
        REFRESH TVBFA_TAB[].
        CLEAR TVBFA_TAB.
    CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
      EXPORTING
       AUFBEREITUNG        = '2'
       BELEGTYP            = VFL_VBRK-VBTYP
        COMWA               = VBCO6
       NACHFOLGER          = 'X'
       N_STUFEN            = '50'
       VORGAENGER          = 'X'
       V_STUFEN            = '50'
    IMPORTING
       BELEGTYP_BACK       = BELEG_TYP
      TABLES
        VBFA_TAB            = TVBFA_TAB
    EXCEPTIONS
       NO_VBFA             = 1
       NO_VBUK_FOUND       = 2
       OTHERS              = 3
    IF SY-SUBRC <> 0.
    ENDIF.
    *OTHER CODE LOGIC*
    ENDLOOP.
    Now the problem is if I run this only once, i.e VIT_VBRK having only 1 document, the result I get is correct. However, if this same code is run in a LOOP with many different values in VIT_VBRK, the first Loop gives correct values and all subsequent values (value of TVBFA_TAB- RFMNG to be precise) are incorrect.
    I am guessing this is b'coz of some internal tables and work areas specific to the function module are not refreshed and the values of earlier iterations are adding up in the subsequent runs. can any one tell me if theres any specific 'REFRESH' statement or FM to be called before calling this FM.
    Thanks in Advance,
    Parth Shah.

    Hi Matt,
    I debugged the Function module like u said in 2 different Session, what I found was that there is a yet another function module called with in the FM RV_ORDER_FLOW_INFORMATION, i.e "GET_HANDLE_SD_DOCUMENTFLOW_SP" heres what the code in this FM looks like.
    FUNCTION GET_HANDLE_SD_DOCUMENTFLOW_SP.
    *"Lokale Schnittstelle:
    *"  EXPORTING
    *"     REFERENCE(HANDLE) TYPE REF TO  IF_EX_BADI_SD_DOCUMENTFLOW
    *"     VALUE(ACTIVE) TYPE  XFELD
    IF L_HANDLE_SD_DOCUMENTFLOW IS INITIAL.
        CALL METHOD CL_EXITHANDLER=>GET_INSTANCE
          IMPORTING
            ACT_IMP_EXISTING = BADI_SD_DOCUMENTFLOW_ACTIVE
          CHANGING
            INSTANCE         = L_HANDLE_SD_DOCUMENTFLOW
            EXCEPTIONS
            OTHERS           = 1.
        IF NOT SY-SUBRC = 0.
          CLEAR BADI_SD_DOCUMENTFLOW_ACTIVE.
        ENDIF.
      ENDIF.
      HANDLE = L_HANDLE_SD_DOCUMENTFLOW.
      ACTIVE = BADI_SD_DOCUMENTFLOW_ACTIVE.
    ENDFUNCTION.
    the only difference I found in the two sessions was that L_HANDLE_SD_DOCUMENTFLOW  is initial in the first run and then in all subsequent run its value remains the same, while in fact it should reset. Sadly there is no REFRESH procedure / Subroutine for it.
    Any idea how i can refresh it, or may be by-pass this check (IF L_HANDLE_SD_DOCUMENTFLOW IS INITIAL) ?
    Edited by: shahparth on Feb 17, 2011 8:39 AM

  • Interrogating field data in a called Function Module

    Good day to all;
    I'd like to call a function module within my program and interrogate one of its fields once it is complete.  The field itself is not returned through the function module's interface, so in stead of trying to rewrite the thing, I'm wondering if I can just request it?
    I've ran a search on this and noted that someone said it may be possible to assign a field symbol to a program's variable, but that in order to actually gain access your program must be on the same calling stack.

    Hi,
    i think you mean the "dirty assign"
    Re: How to access global variable declaraed in the separate program?
    A.
    Message was edited by: Andreas Mann

  • Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background

    Hi All,
    We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
    The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
    After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
    Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
    * Now we have to wait for the termination of the external
    * command if the caller wants us to.
        IF TERMINATIONWAIT = 'X'.
          CALL FUNCTION 'SAPXPG_END_XPG'
            DESTINATION DESTINATION
            IMPORTING   EXITSTAT = STATUS
                        EXITCODE = EXITCODE
            TABLES      LOG      = LOG
            EXCEPTIONS  COMMUNICATION_FAILURE = 1 MESSAGE MSG
                        SYSTEM_FAILURE        = 2 MESSAGE MSG.
    I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass ‘X’ as well.
    Any ideas on what could be causing this issue?
    Mike Vondran

    I also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it don’t have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if you’re sure from SAP standpoint.
    Hope this’ll give you some guide line..
    Thanks
    Bye

  • Function Module to get BEGIN and END date of a month?

    Hello everybody,
    Is there any function module to get BEGIN and END date of a month
    GIVEN EITHER THE CURRENT SYSTEM DATE or MONTH?
    Regards,
    Sanghamitra.A.

    hi
         CALL FUNCTION 'PA03_PERIODDATES_GET'
            EXPORTING
              f_abkrs               = p_abkrs1
            IMPORTING
              f_permo               = wf_permo
              f_current_begda       = wf_begda
              f_current_endda       = wf_endda
            CHANGING
              f_current_period      = wf_pabrp
              f_current_year        = wf_pabrj
            EXCEPTIONS
              pcr_does_not_exist    = 1
              abkrs_does_not_exist  = 2
              period_does_not_exist = 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.
          ENDIF.
    this is the function module to get the first date and last date of a particular month
    if u have any doubts ask
    regads
    karthik
    reward points if useful

  • Type error while calling function module with in FOX formula

    Hi,
    I am getting following error while calling function module from FOX Formula:
    "Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
    Following is the code:
    DATA    I_CALDAY       TYPE  0CALDAY.
    DATA    N_CALDAY       TYPE  0CALDAY.
    DATA    KYF              TYPE KEYFIGURE_NAME.
    FOREACH   I_CALDAY, KYF.
       CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
          EXPORTING
             DAY_IN  =  I_CALDAY
          IMPORTING
             LAST_DAY_OF_MONTH = N_CALDAY.
        {KYF, N_CALDAY}  =  {KYF, L_CALDAY}.
    ENDFOR.
    Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
    Edited by: SAP_BOY on Dec 4, 2009 5:26 PM

    Hi,
    I think It will not identify ,though you have  (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
    Data I_CALDAY TYPE D.
    Hope it may work out.
    Regards,
    Indu

  • HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM

    PLEASE ANYONE TELL ME, ABOUT  HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM. IT IS VERY URGENT!!!!!!!!!1

    Hi,
      Under Global Definitions, we have 'Form Routines' tab. Under this tab, u can have a dynamic subroutine call. With in FORM and ENDFORM, you can call the Function Module.With in the Program Lines editor, u can define the subroutine........PERFORM. 
    If helpful, reward points.
    Rgds,
    CK

Maybe you are looking for

  • How to make BI Info obj Data element in-herit source DE documntn?

    Say I am in ECC. I go to SE11, give table name MARA and then doubleclick on the dataelement 'MATNR'. Then I click on documentation. I get a popup with Short text " Material Number" and Definition "Alphanumeric key uniquely identifying the material'.

  • Nokia Suite/Nokia Store finally working

    I had not tried downloading/installing an app from the Nokia store from within Nokia Suite in quite a while, as it never seemed to work. On a lark, I decided to see whether anything had changed since installing the latest version of Nokia Suite. To m

  • Document type in FIPP object for parked documents

    Hi all, I am using ZFIPP object in my workflow, i want to check a start condition with the fields company code, document type and transaction code, but did not find the those field in zfipp, how to do validation?? Thanks, Venu.

  • Photoshop elements 10 won't open up Nikon d4s RAW files

    Photoshop elements 10 will not open up my RAW files from my new Nikon D4S.  My Nikon d700 RAW files tranfers fine.  I have updated my Camera RAW to 6.7 but it still does not open.  I do not want to convert my NEF files to DNG because you lose data. 

  • Obia sales order management application

    hi guys, i have installed obia sales order management app .. when i gcc check in obiee admin tool .. some dimension dont have joins ...what do i do with those dimensions? regards