Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Runtime Detection of In Update Task Error COMMIT_IN_POSTING

Former Member
0 Likes
1,842

Hello Guru's,

Is there a way to detect at run-time whether a method is running in Update Task or not?

Concrete I have an abstract method which sets in an own DB-Table a status flag.  This can happen in a lot of places (why it is abstract) but also for example during BADI of create inbound delivery which then runs in Update Task (rightfully I think).

I would like to see inside my abstract method whether I can do the commit or not but there seems no syst-field (or I missed it)

Thanks and a supercalifragelisticexpialidoucious 2016

Dirk

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,403

You can use the method CL_SYSTEM_TRANSACTION_STATE=>GET_IN_UPDATE_TASK( ).

BR,

Suhas

7 REPLIES 7
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,404

You can use the method CL_SYSTEM_TRANSACTION_STATE=>GET_IN_UPDATE_TASK( ).

BR,

Suhas

Read only

karthikeyan_p3
Contributor
0 Likes
1,403

Hi Tyriad,

The below Function module can be used to check if the program is being called in update task or not.

  CALL FUNCTION 'TH_IN_UPDATE_TASK'

    IMPORTING

      in_update_task = lf_update_task.

Thanks,

Karthikeyan

Read only

Chintu6august
Contributor
0 Likes
1,403

Hi,

>>the COMMIT WORK commit all  database changes and executes  all functions  modules called in update task that's why we need not to call COMMIT WORK in user exits and BADI's.

>> To debug update FM we need to switch on Update Debugger in debugging mode, if your FM is running in Update task your debugging flow will reach it

thanks!!

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,403

Did you read the question? And what is with the all BOLD?

Read only

0 Likes
1,403

hi,

sorry I misinterpreted it!!


Read only

Former Member
0 Likes
1,403

Thanks for the quick and accurate reply your name is fore ever in the code

          IF cl_system_transaction_state=>get_in_update_task( ) = 0.

            COMMIT WORK AND WAIT.  " WeighBridge comes here in UpdateTask(CreateInbound)

          ENDIF.

I have to say that what was suggested in http://scn.sap.com/thread/1294685 (using nativ SQL-commit and accepted) seems to me a lot more dangerous.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,403

Lol