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

BAPI Commit in Update task

Former Member
0 Likes
3,298

Hi Experts,

I am using the BAPI - BAPI_SALESORDER_CREATEFROMDAT2

to generate Sales Orders, in a Loop.

After processing this Loop, there is a subsequent step in my program where the order number generated is going for a quantity update using another BAPI.

The problem is that I want the BAPI_transaction_commit

to get triggered for the first step only if both the steps are successful.

I tried to use the Update task function module to commit the bapi transaction but it does not work. Though the order number gets generated which is passed to the Update BAPI but no order gets saved in the database.

How can I achieve this? Basically, I want to commit or rollback the first step (bapi for order create) only in the end (after the second step i.e.update bapi, is over).

Thanks in advance.

Message was edited by: Akriti

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,624

Hello Akriti

Recently, I used BAPI_CUSTOMER_CREATEFROMDATA1 to create a new customer. However, before committing I wanted to change the old customer number of the newly created debitor. Thus, instead of committing I called afterwards function module SD_CUSTOMER_MAINTAIN_ALL which modified the new debitor in the buffer! After the successful modify I committed and only then the newly created debitor was saved in the DB tables.

Therefore, I do not see any problem to call your two BAPIs subsequently. However, in your loop you must call both BAPIs for a single sales order and then commit (or rollback) before creating the next sales order.

Regards

Uwe

2 REPLIES 2
Read only

Former Member
0 Likes
1,624

yes, till you say Explicit COMMIT for that BAPI,those changes will not be reflected.so first you COMMIT .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = L_WAIT.

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,625

Hello Akriti

Recently, I used BAPI_CUSTOMER_CREATEFROMDATA1 to create a new customer. However, before committing I wanted to change the old customer number of the newly created debitor. Thus, instead of committing I called afterwards function module SD_CUSTOMER_MAINTAIN_ALL which modified the new debitor in the buffer! After the successful modify I committed and only then the newly created debitor was saved in the DB tables.

Therefore, I do not see any problem to call your two BAPIs subsequently. However, in your loop you must call both BAPIs for a single sales order and then commit (or rollback) before creating the next sales order.

Regards

Uwe