2024 Nov 06 10:25 AM - edited 2024 Nov 06 10:34 AM
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 3 seconds.
call function 'DEQUEUE_ALL'.
endif.
2024 Nov 06 10:35 AM - edited 2024 Nov 06 10:41 AM
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.
2024 Nov 06 10:53 AM