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 Work in Custom BAPI | BAPI Documentation says NO COMMIT inside FM

Former Member
0 Likes
1,237

We need to create a BAPI/Remote enabled Function Module for creating Sales Order for integration with 3rd party application. We are using the standard BAPI BAPI_SALESORDER_CREATEFROMDAT2 for creating SO, after the successful execution BAPI_TRANSACTION_COMMIT is needed to be called for updating the database because of which we have created a wrapper remote enabled function module inside which we have called both the above BAPIs.


Now I recently read the documentation of creating BAPI where it is written COMMIT WORK should not be called inside a FM.

Please let me know what is the SAP recommended best practice in such case.



1 ACCEPTED SOLUTION
Read only

paul_bakker2
Active Contributor
0 Likes
1,055

Hi,

When SAP provides BAPIs they do not put a COMMIT WORK inside them.

This is so that you can call multiple BAPIs in a row, and then COMMIT the whole lot at once.

You are free to do whatever you like in your own FM/BAPI.

cheers

Paul

5 REPLIES 5
Read only

paul_bakker2
Active Contributor
0 Likes
1,056

Hi,

When SAP provides BAPIs they do not put a COMMIT WORK inside them.

This is so that you can call multiple BAPIs in a row, and then COMMIT the whole lot at once.

You are free to do whatever you like in your own FM/BAPI.

cheers

Paul

Read only

0 Likes
1,055

Hi Paul

Thanks for the reply.

So I am assuming this is one of the best ways to go ahead for integrating SAP with other apps.

Read only

0 Likes
1,055

Hi,

Sure, but use standard BAPIs wherever you can!

cheers

Paul

Read only

kairatalaichi
Discoverer
0 Likes
1,055

BAPI_EQMT_MODIFY is an example of SAP putting COMMIT WORK inside

Read only

0 Likes
1,055

Some BAPI modules created until Release 3.1H usually executed the COMMIT, this changed in Release 4.x (6?)

For compatibility reason SAP didn't remove those COMMIT, but there is a comment in the BAPI source, look at FM IWWW_SET_NO_COMMIT of the same function group to deactivate the commit.