Calling FM in update task

Hi,
   I read SAP document saying that if we call an update function module like
   CALL FUNCTION <FM_NAME> IN UPDATE TASK.......
  we can have a log of parameters passed to the function module in VBLOG table.
  I Created an update FM and I am passing parameters and inside that I am updating a customized table.
  But, When I debug control never goes into that FM source code and the table is not updated.
  What may be the reason.
Thanks and regards,
venkat

Did you understand the concept of update function modules at all ?
The call to the update FM is logged in the table VBLOG along with the actual parameters.
The actual processing starts after the COMMIT WORK statement. Read the SAP documentation thoroughly, it is explained in a very simple manner there. [http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_UPDATE.htm]
BR,
Suhas

Similar Messages

  • How do I SUBMIT from a user exit which is called in an update task?

    I want to send an idoc each time there is a goods movement. So, in the user exit of MB_POST_DOCUMENT I am calling IDOC_OUTBOUND_WRITE_TO_DB. This creates an idoc of status 30. However, in order to send the idoc I want to SUBMIT RSEOUT00. I get an ABAP dump on the SUBMIT because MB_POST_DOCUMENT is called in the update task, where SUBMIT is not allowed. Do you know any other way I can execute RSEOUT00 at this moment without having to call it later in batch?
    Thanks!!
    Joy

    Hi Naren,
    Your reply is VERY helpful!! Thank you so much.
    I added  CALL FUNCTION 'RSAP_IDOC_EINBUCHEN_VOM_BIW_4' IN BACKGROUND TASK. I am no longer getting the dump, but my idoc is still a status 03 and not a status 30. Should I expect to see it turn to a status 30? I ran this function directly in SE37 -> Test with the same parameters and it ran perfectly and turned the idoc to a status 03. Is there anything else I need to do in the code?
    Thanks again,
    Joy

  • Call function '' in update task - code inside is BDC

    hi to all,
    in using call function '' in update task
    the code inside is bdc. is this possible? 
    my scenario is from VA01 then post billing to VF01,
    i am using user-exit MV45AFZZ in subroutine userexit_save_document.
    i need to post billing after va01 save.
    thanks to all.

    To debug in the update task, you have to set that option on in the debugger.
    If the user exit runs in the update task, then you must have something like: CALL FUNCTION MODULE my_fm_to_do_BDC STARTING NEW TASK.   ( This function module should wait until the SD is created.  You might want to check in a loop, with a WAIT command.   Once it is created, then you start your BDC and CALL TRANSACTION. )  This is NOT an update function module.  It may need to be RFC enabled - I'm not certain at the moment.
    If the user exit doesn't run in the update task, you need to create, and call from the user exit, an update function module that calls your function module "my_fm_to_do_BDC" STARTING NEW TASK. 
    The attribute "collective run", which is V3, means that the update task won't run that function module until a regularly scheduled job on the application server runs.  For processing to run during the rest of the SD save, you must use V1 (could be run in any order with other V1s) or V2 (Will run after V1, but in any order with other V2s).  Typically, I use V2 for this kind of task.
    matt

  • Problem when using Call FM IN UPDATE TASK.

    we plan to update ztable using Call FM in update task, and write the success/error message into log.
    Does below is right??  I found the commit work can not be used here. Thanks..
    CALL FUNCTION 'ENQUEUE_ETABLE'.
    IF sy-subrc = 0.
    CALL FUNCTION 'update_ztable'' IN UPDATE TASK.
    Endif.
    COMMIT WORK and wait.
    IF sy-subrc <> 0.   
         ROLLBACK WORK.
         write error log.
    Else.
        Write successful log.
    Endif.
    CALL FUNCTION 'DNQUEUE_ALL'.

    Hi ,
    Please see the refernce of UPDATE FUNCTION MODULES:
    UPDATE FUNCTION MODULE
    -In the attributes tab, under processing type, choose Update Module, 
    Start Immediately. Define your import parameters, enter the source
    code, All validations should have been done prior to the call to this
    function module, so all you need in the source, is the updating of the
    database, INSERT, MODIFY, UPDATE, whatever.
    -When you call you function module, use IN UPDATE TASK, after the call, 
    COMMIT WORK. The commit work will trigger the db update.
    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.
    Q:We are calling Sales Order Change in update task inside the user Exit MV50FZ1. We can see that the FM is called in update task after the commit work and the return of the FM shows the success message. But still the changes are not saved to the DB.
    A: check sm21 or sm13 to see if the update was successful  .. In SM21 I checked. It is giving me the error Transaction Failed
    Reward if useful
    Thanks
    Jagadeesh.G

  • Queries on  Call Function In update Task

    Hi ,
         I have a requirement where I have to update a ztable in background once I execute the report.THe requirement is to exceute the updation in background.Will
    Call funtion in update task help me?If yes, I have never used call function in update task .so can you guide me on the same.If no, how best can  I acheive this?
    Thanks & Regards,
    Jyotsna

    Hi,
    look F1 to call function pls:
    It is not executed at once, but the data passed with EXPORTING or TABLES is placed in a database table and a subsequent COMMIT WORK then causes the function module to be executed by the update task.
    -> so in error case you can analyse err. with TA SM13
    (update records)
    regards Andreas

  • Calling function in Update Task problem

    Hello Friends,
    I'm calling FM 'REVISION_LEVEL_POST' in Update Task to insert a revision level for a material when saving a Change Master (CC02 T-Code). But the calling is triggered a bit early (Before updating the Data Base AEOI Table!). An Update Task FM is called right after the COMMIT WORK is executed. Here in my case, a commit work is done but not for my change Master but for a text... So my FM does not find the record to be updated.
    Is there a way to solve this ?
    Thank you for your Help!

    Check the log in VBLOG table ..

  • Call Function in Update task

    I have written the FM Call function 'COMMITROUTINE' in update task.
    but this FM is not getting triggered when some commit happens. In all, this FM is not commiting tha data in the table.
    CALL FUNCTION 'COMMITROUTINE' IN UPDATE TASK
      EXPORTING
        lt_dfkkbrlevyrec       = lt_dfkkbrlevyrec
    and the
    What is missing in it?
    Regards,
    Seema Dadhwal.

    Hi,
    if you want to call your FM when a commit happens you should write a routine which is called upon commit and this routine will call your fm.
    e.g
    form call_my_fm .
    CALL FUNCTION 'COMMITROUTINE' IN UPDATE TASK
    EXPORTING
    lt_dfkkbrlevyrec = lt_dfkkbrlevyrec
    endform.
    perform call_my_fm on commit.
    commit work. " now your routine will be called
    Kostas

  • Call function in update task empty variables error

    Hello,
    I'm experiencing a weird error while using the addition "In update task".
    My Scenario is the following:
    Use the bapi_goodsmvt_create -> if there are no errors, fill some values and call my function and then commit everything.
    The problem is, when the function runs in update task, all import parameters are empty!
    Also, this only happens in the following code structure
    CALL METHOD run_migo( IMPORTING bapireturn = t_bapireturn).
    IF t_bapireturn IS INITIAL.
      CALL METHOD save_custom_tables. "this runs my function 'IN UPDATE TASK'
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
    if I commit inside the method SAVE_CUSTOM_TABLES, the data is passed normally to the function, if I commit like the code above, everything is empty.

    Here's the code:
    METHOD save_partial.
      DATA: t_wegritm    LIKE gt_wegritm,
            t_tegrp_parc TYPE TABLE OF ztegrp_parc,
            w_tegrp_parc TYPE ztegrp_parc,
            w_tegrk_parc TYPE ztegrk_parc.
      FIELD-SYMBOLS <w_wegritm> LIKE LINE OF t_wegritm.
      t_wegritm = gt_wegritm.
      DELETE t_wegritm WHERE mengee IS INITIAL.
      CHECK NOT t_wegritm IS INITIAL.
    *-->save xml iten
      LOOP AT t_wegritm ASSIGNING <w_wegritm>.
        MOVE-CORRESPONDING <w_wegritm> TO w_tegrp_parc.
        w_tegrp_parc-id = gw_tegrk-id.
        w_tegrp_parc-gr_docto = <w_wegritm>-gr_docto.
        w_tegrp_parc-gr_mjahr = <w_wegritm>-gr_mjahr.
        w_tegrp_parc-gr_zeile = <w_wegritm>-gr_zeile.
        APPEND w_tegrp_parc TO t_tegrp_parc.
      ENDLOOP.
      MOVE-CORRESPONDING gw_tegrk TO w_tegrk_parc.
      CALL FUNCTION 'Z_SAVE_PARTIAL'
        IN UPDATE TASK
        EXPORTING
          iw_tegrk_parc = w_tegrk_parc
        TABLES
          it_tegrp_parc = t_tegrp_parc.
    ENDMETHOD.
    I tried to re-create this scenario with a local class, but the code that I originally sent worked(the commit work outside of the routine).

  • Call transaction in update task

    Hi,
    I'm trying to call t-code V_V2 on update task but the update terminates with error "POSTING_ILLEGAL_STATEMENT". I've tried the same below code but without "In update task" and it worked correctly. Can anyone help me please?
    DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
    "Open the 1st screen of transaction V_V2...
    CLEAR bdcdata.
      bdcdata-program  = 'SDV03V02'.
      bdcdata-dynpro   = '1000'.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    "Position the cursor on the material number field...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_CURSOR'.
      bdcdata-fval = 'S_MATNR-LOW'.
      APPEND bdcdata.
      "Enter the material number on its field...
      CLEAR bdcdata.
      bdcdata-fnam = 'S_MATNR-LOW'.
      bdcdata-fval = matnr.
      APPEND bdcdata.
      "Position the cursor on the plant field...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_CURSOR'.
      bdcdata-fval = 'S_WERKS-LOW'.
      APPEND bdcdata.
      "Enter the plant on its field...
      CLEAR bdcdata.
      bdcdata-fnam = 'S_WERKS-LOW'.
      bdcdata-fval = plant.
      APPEND bdcdata.
    "Position the cursor on the simulation checkbox field...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_CURSOR'.
      bdcdata-fval = 'P_SIMUL'.
      APPEND bdcdata.
      "Clear the simulation checkbox field...
      CLEAR bdcdata.
      bdcdata-fnam = 'P_SIMUL'.
      bdcdata-fval = ' '.
      APPEND bdcdata.
      "Execute the program...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_OKCODE'.
      bdcdata-fval = 'ONLI'.
      APPEND bdcdata.
      "A popup window will raise for change confirmation...
      CLEAR bdcdata.
      bdcdata-program  = 'SAPLSPO1'.
      bdcdata-dynpro   = '100'.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
      "Position the cursor on this popup window...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_CURSOR'.
      bdcdata-fval = 'SPOP-OPTION1'.
      APPEND bdcdata.
    "Press the "YES" button...
      CLEAR bdcdata.
      bdcdata-fnam = 'BDC_OKCODE'.
      bdcdata-fval = 'YES'.
      APPEND bdcdata.
    CALL FUNCTION 'ABAP4_CALL_TRANSACTION_VB' IN UPDATE TASK
      EXPORTING
        tcode                         = 'V_V2'
      SKIP_SCREEN                   = ' '
        MODE_VAL                      = 'N'
        UPDATE_VAL                    = 'S'
      TABLES
        USING_TAB                     = bdcdata
      SPAGPA_TAB                    =
      MESS_TAB                      =
      EXCEPTIONS
        CALL_TRANSACTION_DENIED       = 1
        TCODE_INVALID                 = 2
        OTHERS                        = 3.

    Hi,
    use the following stmt. instead of calling FM ''ABAP4_CALL_TRANSACTION_VB'
    CALL TRANSACTION 'V_V2' USING BDCDATA MODE 'N' UPDATE 'S'......
    Hope it will work.

  • Call transaction inside Update task

    <b>Is it possible to use call transaction inside an update function module?</b>
    My requirement is like this.
    When I execute LB10 storage units will be created..then we have to go to lt09 and then create a TO's there for all these Storage units..
    Now, when I try to call a bdc session from an exit, the storage units are not  updated there. so the BDC is getting failed..
    To resolve this, I kept all the BDC code in to a Zfunction module and made it an update funtion module. I am calling this function module form the exit IN UPDATE TASK.
    But the call transaction is not working....
    I have tried with L_TO_CREATE_MOVE_SU inside the Z function module..Still no use..
    is there any other way that I can solve this?

    Hi,
       Calling a FM in Update Task is one of the bundling techniques used in ABAP to avail functionality provided by SAP Update System. Here all database updates are processed at the end of the SAP LUW in contrast to normal FM call where the database updates are done and commited at the time of call (Database LUW). It is necessary to bundle all your database updates in an SAP LUW e.g. all database updates in a transaction (like VA01) should be bundled. Almost all standard SAP transactions use bundling techniques.
    This technique separates the dialog process and update process. The dialog part of the transaction can span more than one screen(one dialog step) and can be processsed by more than one dialog work process. A work process is released when the dialog step changes (screen changes) and the work process sends a database commit (called Implicit Database LUW). So with each screen change there is a database commit and database remains in consistent state.
    Now when using bundling technique, when a COMMIT WORK is encountered, system ends the dialog process with a dialog work porcess and starts the update process using an update work process.
    The dialog step containing the COMMIT WORK is considerd as the last dialog step of the transaction and all the update function modules are processed now in the last dialog step by the update work process though they were called earlier during the earlier dialog steps.
    It is necessary to create update FMs to take advantage of this technique. The update FM is created FM by setting the Update moduleradiobutton in the Attributes tab in SE37.
    In a normal FM call, if there are database updates (UPDATE, INSERT, MODIFY, DELETE) than database is commited after the FM processing is over as the FM starts its own Database LUW and ends it too.
    <b>Reward Points</b>
    Regards

  • Update termination error while calling FM in Update task

    Hi Friends,
    I am calliing my Z Function Module in update task from my report, my function module contain reuse alv list display fm which should create a Spool in the spool list.
    When ever i am directly executing my Z function module i am getting spool in SP01, but when ever i am calling the Z Function Module in update task from my report i am getting a message as "Express document "Update was terminated" received from author.
    I want to call the Function module in update task and it should generate spools .
    Syntax:
    CALL FUNCTION 'ZLOK_TEST' IN UPDATE TASK.
    Commit work.
    Thanks Regards,
    Sandipan jena

    Hi sandipan jena,
    a function called in update task will not create a spool list if not told so to to. Only reports scheduled in a JOB will put the output into spool.
    Make sure you have no COMMIT WORK and no MESSAGE output when in UPDATE TASK. You can enter /h and in debugger switch on UPDATE debugging. This will lead you to any error occurring.
    You should analyze the errors you get. Mabe NEW-PAGE PRINT ON can help you.
    Regards
    Clemens

  • Call FM in update Task ?

    Dear All,
    I've created a custom FM and I want to call this FM in update task.
    I'm passsing a tables parameter to this FM in update Task.
    Everything is fine but when I'm coming back to the main program the tables paramter is not having any value.
    It's becoming null.
    Can you tell me the reason y it's so ?
    Regards,
    Deepu.K

    Hi deepu,
    in update task only starts after the commit instruction of your program and it doesn't accept importing, changing parameters or exceptions. And table parameters are only valid for input.
    You might want to check the starting new task mode:
      CLEAR w_end.
      ltask = 'HELLOWORLD'.
      CALL FUNCTION 'Z_UPDATE_ZDSDM01' STARTING NEW TASK ltask PERFORMING f_go ON END OF TASK
        EXPORTING
          in = lin.
      WAIT UNTIL w_end IS NOT INITIAL.
      WRITE: 'Hi', lnew, l_subrc.
    *&      Form  f_go
    FORM f_go USING par TYPE clike.
      w_end = 'X'.
      RECEIVE RESULTS FROM FUNCTION 'Z_UPDATE_ZDSDM01'
              CHANGING xnew    = lnew
                      EXCEPTIONS lixo = 1 system_failure = 2 communication_failure = 3 OTHERS = 9.
      l_subrc = sy-subrc.
    ENDFORM.                    "f_go
    regards,
    Edgar

  • Is It Possible to use Call Function in update task in perform on commit

    Hi Friends,
    I have to send an email once the commit work is done. so i am writing code like this,
    Perform send_email on commit.
    form send_email.
    call function 'SO_NEW_DOCUMENT_SEND_API1' in update task
    endform.
    endform.
    .... ( Some other code)
    commit work.
    But, I am getting error saying Update task is not possible. Please suggest me how to solve this.
    Thanks in Advance,
    Phani.

    Hi Phani,
          Check whether <b>COMMIT Work</b> has be performed. I think this might be the problem.
    Regards,
    Prashanth

  • Function modules called in update task

    Hi,
    I am calling two function modules in update task sequentially. I want to know whether these two function modules are also called sequentially in update debugging also?
    My code is like this
    1. call FM1 in update task
    2. Call FM2 in update task
    will this be the same sequence at the time of execution also? or will it be random?
    Thanks in advance.

    ya it will this be in  the same sequence only...........
    Regards
    Anbu

  • Commit changes after CALL FUNCTION ... IN UPDATE TASK

    Hi ABAPers,
    I'm a bit confused about the behaviour of Update Function Modules.
    Following scenario:
    In our transaction (Modulpool with dynpros) the user clicks a butto to change some data:
    1. PAI-Modul performs FORM_A
    2. FORM_A calls FM_A several times in a LOOP
    3. FM_A does some business logic and calls FM_B IN UPDATE TASK
    4. FM_B modifies database tables
    5. After the LOOP FORM_A does COMMIT WORK AND WAIT
    Then the changes are not in the db immediately, the user will see the old data for a short time.
    Why does the COMMIT-statement not start the Update-process?
    Thanks,
    Markus

    Hi,
    This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.
    here high priority function moudles are function module with V1 task.
    Regards,
    Siva chalasani.

Maybe you are looking for

  • Sharing HP LaserJet 200d on Windows 7 to XP machine

    I need help sharing  my LaserJet 220d running on Windows 7 with another computer running XP. The HP LaserJet was originally installed on the XP 32 bit machine and it ran fine. I bought a new computer with Windows 7, 64 bit and Windows automatically i

  • HP Remote Print Drivers

    Hello, Just to give you some background, I have a HP PhotoSmart 6180 multifunction inkjet machine.  The printer has been wirelessly attached to my home network for about two years now (Linksys WRT54G).  All print functions work (printing to photo tra

  • Report Designer Locking issue

    Hi,    We have found locking issue while accessing same report(Created in Report Designer) by multi users at a time .    Has anyone face this issue and How to fix it. It's major concern because same report can be accessed by multiusers at  same time

  • Linking to (or importing) large FM books in Windows 7

    We've been using the latest CS to develop our source content in Frame, and linking to that from Robohelp (in order to generate OLH). It hasn't been a pleasant process, especially, but it has been sufficient for the last year and a half or so. I'm swi

  • Project change with the change in requirements

    Dear All My client has the following requirements: When the requirements from the customer change, changes to time, resources and budget have to be managed. What iam thinking is as soon as the requirements change, a ECR is created for the change in r