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: 

Help in BAPI Transaction Commit

Former Member
0 Kudos

Hi All,

I have a requirement to approve the Purchase Order created from a Purchase requisition.

To implement the same, I am calling ‘BAPI_TRANSACTION_COMMIT’ after each ‘BAPI_PO_RELEASE’.

I am facing the following problem:

The purchase order is getting approved successfully for the first release code but is giving an error ‘Prerequisite not fulfilled’ for the 2nd release code. The same is working fine in Debugging mode.

I think that the commit is not working properly in this case.

We have tried calling the ‘BAPI_TRANSACTION_COMMIT’ by passing the wait parameter and also called the SET UPDATE TASK LOCAL before calling commit.

If anyone has worked on this before please let me know.

Thanks in advance.

Thanks and Regards,

Lavanya.

4 REPLIES 4

Former Member
0 Kudos

Try calling BAPI_TRANSACTION_COMMIT after ALL BAPI_PO_RELEASE had been running through.

Put the BAPI_TRANSACTION_COMMIT at the very last.

Former Member
0 Kudos

Hello Lavanya,

I am facing exactly the same issue.

I have tried putting SET UPDATE TASK LOCAL before each commit and BAPI_TRANSACTION_COMMIT after every commit.

Still the release code is not getting set correctly. The first BAPI call is succesful, no error is raised during BAPI call, but the release code is not being set in table level. As there is no error, the worklow is moving to the next approval. For the next BAPI Call, I am getting an error "Pre-requisite not fulfilled". This is happening randomly for some PO's, not for all.

Could you tell me if you found some solution for this?

Thanks,

Sravanthi Dingari.

Former Member
0 Kudos

Hi Friends,

Before Calling 2nd Bapi, You can check if data was created and commited successfully to database.

You can create an infinite DO-ENDDO and SELECT data from DB, if success then be sure that data is commited and then EXIT from DO-ENDDO.

it should be like following ;

DO.

SELECT COUNT(*) from ZZTABLE WHERE ZZFILED = 'ZZNUMBER'.


if   sy-subrc = 0 ." be sure data is commited to DB and EXIT

EXIT.

ENDIF.

ENDDO.

hope it works..

Former Member
0 Kudos

Hi Lavanya,

Have you provided BAPI_TRANSACTION_COMMIT for both BAPIs you're using? I think you need commit fm for each bapi you use. And also provide wait for both commit. If its working in debugger then it must be time out problem. Try to use something like: 'wait for 30 seconds'. Hope it works.

regards,

Pranav.