Application Development 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: 

replace BAPI_TRANSACTION_COMMIT in called transaction

0 Kudos
239

Hello!

I need to use call a transaction. In that transaction, there are is a BAPI used (BAPI_MATERIAL_SAVEDATA).
Right after that, there is a BAPI_TRANSACTION_COMMIT.

My problem is that after a commit work (what is executed within BAPI_TRANSACTION_COMMIT), a call transaction is terminated and the user will thrown back into the original transaction.

I managed to bypass that by using call function 'DB_COMMIT'.
But now, this doesn't work.

I checked SM12. There are some tables locked.
When I execute the code with the original BAPI_TRANSACTION_COMMIT, I saw that the locks are also resolved.

What I tried then is DEQUEUE_ALL. The locks are gone this way, what now the called BAPI doesn't work. The material is not added like it is, when BAPI_TRANSACTION_COMMIT is used.

I am going crazy.
Any ideas? =/

  call function 'BAPI_MATERIAL_SAVEDATA'
    exporting
      headdata     lv_mathead
    tables
      extensionin  lt_extensionin
      extensioninx lt_extensioninx.
  if sy-subrc ne 0.
    message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    call function 'BAPI_TRANSACTION_ROLLBACK'.

  else.
*      call function 'BAPI_TRANSACTION_COMMIT'.

    call function 'DB_COMMIT'.
    wait up to seconds.

    call function 'DEQUEUE_ALL'.

  endif.

2 REPLIES 2

raymond_giuseppi
Active Contributor
225

The COMMIT WORK (online help) is required to triger update, release locks, and raise a TRANSACTION_FINISHED event.

You cannot remove it.

To prevent  processing terminaton you could use the statement CALL TRANSACTION USING and set component RACOMMIT of the structure CTU_PARAMS, passed to the statement OPTIONS FROM.

0 Kudos
212

I want to hug you rn...
You are a gem.
Thanks you so much!