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

commit statement

Former Member
0 Likes
788

Hi,

I am using the BAPI BAPI_OUTB_DELIVERY_CHANGE for updating the serial number of an item in a delivery.

For the changes to be reflected, do i need to use the commit after the BAPI is called in my code.?

I tried using the commit statement in the code, the delivery is updating. If the COMMIT statement is removed the update is not taking place.

Question is do we need to explicitly call the commit statement after the BAPI?

Thanks,

Kumar

5 REPLIES 5
Read only

peter_ruiz2
Active Contributor
0 Likes
691

hi kumar,

use a bapi to commit your transaction

BAPI_TRANSACTION_COMMIT

regards,

Peter

Read only

Former Member
0 Likes
691

Hi,

BAPI_TRANSACTION_COMMIT.

This method executes a COMMIT WORK command. It is required for transactions developed outside the SAP system that change data in the SAP system by using BAPI calls.

When you call BAPIs in your program that change data in the SAP system, you must then call this method to write the changes to the database.

Regards

Manoj

Read only

Former Member
0 Likes
691

hi

ya, it is necessary to write commit work after using BAPI as it will update many tables, so commit work vl add all of them in a queue and update. Sometimes, even this is not enough..

So, it is recommended to use

FM

BAPI_TRANSACTION_COMMIT.

Regards,

Nishant

Read only

Former Member
Read only

Former Member
0 Likes
691

Hi Kumar,

Calling the BAPI in the program, most of the times or may be always, kind of simulates the data. It does not actually update the database. You used COMMIT WORK and the database got updated.

There is standard way to do it. Call the BAPI, read the return table. Depending on that call one of the following BAPI's.

1. This will confirm the changes to the database.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

2. This will rollback the changes.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

  • IMPORTING

  • RETURN =

.

Let me know if you need anything else.

Thanks,

Ganesh Khumse