Skip to Content
author's profile photo Former Member
Former Member

Call FM ...in update task

Hi Experts,

I know the Tech reason for UPDATE Tasks...but

Please explain with an example under what circumstances do we need to use a Call Function Module ...in UPDATE Task?

thanks

Dan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Jan 25, 2007 at 07:33 PM

    Say that you need a bunch of updates to happen, all of them are dependent upon the others, so all of them need to happen or none of them happen. In this case, an update task is a good choice.

    Regards

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 07:39 PM

    Hi,

    If you want to group the updates you can use the update task addition..

    Lets say if you are tring to insert records to three database tables..

    If you create three update modules to insert record..If one of them fails the entire LUW will be rollbacked.

    CALL FUNCTION 'Z1' IN UPDATE TASK

    EXPORTING IM_DATA = Z1.

    CALL FUNCTION 'Z2' IN UPDATE TASK

    EXPORTING IM_DATA = Z2.

    CALL FUNCTION 'Z3' IN UPDATE TASK

    EXPORTING IM_DATA = Z3.

    COMMIT WORK.

    The subsequent commit work triggers the UPDATE modules..The records will be inserted to all the tables..if all of them are successful..Otherwise nothing will be updated..

    Hope this helps..

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 25, 2007 at 07:50 PM

    Hi,

    A function called in update task will not execute until a commit work is encountered.

    For example, if you set a function to be update task and you have some DB access statement like delete or update, and return the function. Those DB access won't be submitted to DB, until you run COMMIT WORK. When run commit, all of update task FMs before this commit will be runned, as they are in the same LUW.

    Also a function called with 'STARTING NEW TASK' will be triggered immediately, but will run asynchronously with respect to your current program.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 08:03 PM

    Hi,

    If you are inserting a record in user exit..It is safe to use a update module and call it in UPDATE TASK...

    If the transaction fails ...then the whole updates will be roll backed..Meaning your ztable and the standard sap tables will be synchronized..

    Thanks,

    Naren.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 07:55 PM

    Hi Rich,

    Thanks. Bunch of updates?

    i need to update 2 Z tables independently from an exit transaction (vf04), so u mean me to write my code for the updates in any call FM.. in update task or wud u suggest me to use two insert /update stmts directly in the include of the exit?

    Waiting for your response.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

    • <i> u suggest me to use two insert /update stmts directly in the include of the exit?</i>

      It depends on your processes, but if you are talking about custom tables where you have definite control, and you know that the update will never fail on either, then simply updating them directly is fine.

      REgards,

      Rich heilman

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 09:00 PM

    Hi Rich,

    Then what is the concept in update bundling ? IS there any inter relations btw update tasks & update bundling?

    Thanks

    Dan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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 <b>Update module</b>radiobutton 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.

      Hope this answers.

      Thanks

      Sanjeev

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.