Check for UPDATE Task

By | Last Updated on April 10, 2013 | 3,592

When you write a reusable code to DB related activities, you should consider checking if the call is made in Update Task or without as they are generally happen in ABAP Update Task. If it is with Update Task, you MUST not do COMMIT or ROLLBACK WORK as it would end in short dump. FM TH_IN_UPDATE_TASK would help to determine if it is being called in Update Task or not.

Check if called in UPDATE Task

 
DATA: lv_in_update TYPE i.
*
CALL FUNCTION 'TH_IN_UPDATE_TASK'
  IMPORTING
    in_update_task = lv_in_update.
*
IF lv_in_update = 1.
  "called in update task
  "no need to do COMMIT or ROLLBACK here
ELSE.
  "not called in Update TASK
  "COMMIT or ROLLBACK would be required
ENDIF.
 

Do you have a Code Snippet which you want to share, Submit Code Snippet here

Share It!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{272 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 272 articles.

Load comments

1 Comment

  • steve oldner

    Thanks Naimesh!

    I learned something new today.

Comments on this Post are now closed. If you have something important to share, you can always contact me.