replace BAPI_TRANSACTION_COMMIT in called transaction

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 sysubrc ne 0.
    message id symsgid type symsgty number symsgno
          with symsgv1 symsgv2 symsgv3 symsgv4.
    call function ‘BAPI_TRANSACTION_ROLLBACK’.

  else.
*      call function ‘BAPI_TRANSACTION_COMMIT’.

    call function ‘DB_COMMIT’.
    wait up to seconds.

    call function ‘DEQUEUE_ALL’.

  endif.

Scroll to Top