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_CUSTOMER_CHANGEFROMDATA1 commit

Former Member
0 Likes
1,521

Is there a way to prevent BAPI_CHANGE_CUSTOMERFROMDATA1 from automatically commiting. I would like to include this function call with other updates and want to control the committing of work to the database until all updates complete successfully.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,453

Hi,

If a BAPI is having a implicit commit in it, then you cannot stop the BAPI for reflecting the changes in the Database, whereas if the BAPI doesn't have the implicit Commit, then you need to call FM BAPI_TRANSACTION_COMMIT, to commit the BAPI changes to Database, and hence you can stop this BAPI to reflect the Database changes by simply not calling the FM BAPI_TRANSACTION_COMMIT.

Hence just check whether your BAPI has got commit work statement or not, and get your answer.

11 REPLIES 11
Read only

Former Member
0 Likes
1,453

guessing you are talking about BAPI_CUSTOMER_CHANGEFROMDATA1, there is no explicit commit in this BAPI, so its upto you when you want to call the Commit.

Read only

0 Likes
1,453

Sorry, a little dislexic there. I thought the same thing, but my Rollback Work statement after the call to BAPI_CUSTOMER_CHANGEFROMDATA1 does not rollback the updates made prior to calling this function.

Read only

0 Likes
1,453

What are the updates you making before this call?

You says youc ant roll back the updates made before this call, so this BAPI itself is fine, You need to see what DB update your code is doing before this call and if there are commits there

Read only

0 Likes
1,453

Hi,

Please try this After your BAPI Call to Rollback your BAPI commit's :

BAPI TRANSACTION ROLLBACK

Read only

0 Likes
1,453

I am making some direct updates to a Z table that I have created to house valid UPS consignee address information. If the addresses in this table are updated, I call the BAPI_CUSTOMER_CHANGEFROMDATA1 function to reflect the address changes on the customer address.

Read only

0 Likes
1,453

Thanks, but I tried BAPI_TRANSACTION_ROLLBACK and it did not rollback the transaction.

Read only

0 Likes
1,453

There do seem to be COMMITS performed in this BAPI. So maybe try updating your Z table after calling this.

Rob

Read only

0 Likes
1,453

nope that woudlnt work, you are not supposed to insert data into DB table in yoru code as then you would nto be able to roll it back.

instead create an Update Function module, call that to update your z table in update task. your code will still have the updated values in Z table. then you can call the BAPI** to update the addresses. if it fails now if youc all BAPI_TRANSACTION_ROLLBACk it will roll back all the changes

If you do direct DB update in your transaction itslef, you cant roll it back

Read only

Former Member
0 Likes
1,454

Hi,

If a BAPI is having a implicit commit in it, then you cannot stop the BAPI for reflecting the changes in the Database, whereas if the BAPI doesn't have the implicit Commit, then you need to call FM BAPI_TRANSACTION_COMMIT, to commit the BAPI changes to Database, and hence you can stop this BAPI to reflect the Database changes by simply not calling the FM BAPI_TRANSACTION_COMMIT.

Hence just check whether your BAPI has got commit work statement or not, and get your answer.

Read only

Former Member
0 Likes
1,453

Thanks for all the suggestions. In my research I thought that BAPIs were not supposed to have Commits embedded in them so i thought that maybe I was doing something wrong. Thanks again for all the replies.

Read only

0 Likes
1,453

Bear in mind that the COMMIT that I found may not be called when you execute the BAPI. You probably should debug to see what is going on.

Rob