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: 

roll back and commit work in BAPI

Former Member
0 Kudos
436

Hi friends ,

Can u please explain or tell me when does roll back and commit work come into play in BAPI ? What exactly happens during roll back and commit work with regard to BAPI's?

Thank you ,

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
5 REPLIES 5

former_member188685
Active Contributor
0 Kudos
192

commit work updates the data to tables.

but roll back it will roll back the update if any error occurs.

generally we use commit work after sy-subrc = 0.

rool back will be used after sy-subrc <> 0.

vijay

RichHeilman
Developer Advocate
Developer Advocate

Former Member
0 Kudos
192

Normally data is sent to BAPI for processing. Now, if 1 record has been processed successfully, the COMMIT works gets triggered internally. So, Commit works as such when an entry is processed successfully.

When u pass data and inbetween BAPI fails due to some reason, ROLL BACK gets triggered and the updates that has happened for that particular record data are been roll backed.

Pl. award appropriate points.

Former Member
0 Kudos
192

BAPIs are a bit odd. If you are using one to post a transaction for example, you will have to do an explicit COMMIT after the BAPI is complete. You have to examine the contents of the BAPIRETURN table to decide if you want to do this.

However, I've also found that if the BAPI succeeds but no commit is done then the number that was assigned to the document is not rolled back. So you end up with missing document numbers. I haven't tried this, but a ROLLBACK might take care of this.

Rob

0 Kudos
192

I just did a quick check. I ran a BAPI, but instead of doing a commit, I did a rollback. The number range was still updated.

Rob