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

Former Member
0 Likes
1,236

Hi,

If we want to update data in database tables, we can do using commit. What is the purpose if use BAPI_Commit ? Can we use Commit inside BAPI ?

Thanks.

Regards,

Tushar.

5 REPLIES 5
Read only

Former Member
0 Likes
1,000

bapi commit is used when you call a BAPI as a BAPI is remote enabled and with regular commit i am not sure if the databases will be updated.

Within a bapi a regular commit can be called unless if you are calling a standard bapi within a bapi.

Read only

Former Member
0 Likes
1,000

Some BAPIs are by default commited and some are not ( inside BAPI it is programmed with 'COMMIT').

If you are using BAPIs in your program and then finally if you need to COMMIT , you need to use this BAPI_Commit.( Inorder to COMMIT your previous code externally ... you need to use this ).

Please let us know , you have more doubts.

Thanks

Read only

Clemenss
Active Contributor
0 Likes
1,000

Function BAPI_TRANSACTION_COMMIT does nothing else but a simple COMMIT WORK.

COMMIT WORK not only commits all database changes (insert, update, delete) to the database making them available for all other and later processes and transactions. In BAPI function modules, many database changens are not done directly but using the ABAP syntax PERFORM ... ON COMMIT:

That means, the form is not executed until the next COMMIT WORK ( or Call of BAPI_TRANSACTION_COMMIT).

All INSERT, UPDATE and DELETE is committed automatically at the end of transaction or execution of a report. PERFORM ... ON COMMIT needs the explicit COMMIT WORK.

Thats the reason why you will never find objects (orders, assets,...) created using BAPI in test environment using SE37 althoug you receive a success message. You must do it in program and after the BAPI call issue COMMIT WORK or call function BAPI_TRANSACTION_COMMIT.

You should be aware, that COMMIT WORK will commit everything to the database in the current LUW (transaction, logical unit of work), not only what you created.

If your routine is a child routine of a standard process, never use COMMIT WORK. The calling transaction will know the right time to commit and all changes you did are committed as well - or rolled back if an error occurred.

Regards,

Clemens

Message was edited by:

Clemens Li

Read only

Former Member
0 Likes
1,000

A custom program which selects the contracts from VBKD to update actual shipping quantity and additional status field. At last passing to the final internal table using BAPI_SALESORDER_CHANGE and BAPI_COMMIT passing the data to BAPI and updating the fields in the table.

Problem : selecting the contracts from table but skipping some of the contracts to update the table. If process is in foreground program selecting and updating all the contracts . If it is in background it is skiapping afew records with no update in the data base eventhough it is not a rejected contract. Please send us a clue regarding this issue.

Thanks and Regards,

Raj.

Read only

Former Member
0 Likes
1,000

Hi,

I am using BAPI_SALESORDER_CHANGE to update field VBKD-EMPST and additional custom status (VBKD-KDKG5) in Contracts and then calling BAPI_COMMIT. When scheduling the program in background for a range of contracts, some of the contracts are not updated. This occurs randomly.

The same program works fine if running in the fore ground. Please provide your valuable suggestions as this is an Urgent Issue.

Thanks,

Raj.