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

module pool programming

Former Member
0 Likes
415

hi,

what exactly is the difference between 'insert' and 'commit work'.

Rgds,

khadeer.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
387

The Commit Work executes a database commit and thus closes a Logical Unit of Work ( LUW).

The updates and insert in a DB are rolled back in case the program abruptly terminates.

In case of successful completion, the Commit work is called.

When u explicitly mention Commit, Commit work is called then n then n u see the entry in the DB.

The reason u dont see entry in the DB sometimes is probably due to abrupt end of program as a result of which the transactions are rolled back.

Lines specified with the INSERT command are not finally

added to the database table until after a database commit

You can use the following syntax for the same:

ROLLBACK WORK.

Since, as a rule, an application program is processed by several work processes in succession, and every change of the work process is linked to an implicit database commit, an application program is not automatically linked to a single database LUW.

This applies in particular to dialog-oriented applications, in which one database LUW is assigned to one dialog step.

To ensure the data consistency of application programs that are executed across different work processes, the application statements are not directly executed in an SAP LUW.

Instead, they are first registered and then executed by a single work process, that is, in a single database LUW.

A SAP LUW is controlled via the Open SQL statements

COMMIT WORK

ROLLBACK WORK

SET UPDATE TASK LOCAL.

Explict Commit after the INSERT statement is necessary to effect the changes to the database.

To use RollBack.

INSERT...

Rollback work.

2 REPLIES 2
Read only

prasanth_kasturi
Active Contributor
0 Likes
387

hi ,

Commit work updates the database after a LUW and even if you dont mention commit work sap includes an implicit commit work statement

check this link

you will have a clear idea on commit work

and also

http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/frameset.htm

regards

prasanth

Read only

Former Member
0 Likes
388

The Commit Work executes a database commit and thus closes a Logical Unit of Work ( LUW).

The updates and insert in a DB are rolled back in case the program abruptly terminates.

In case of successful completion, the Commit work is called.

When u explicitly mention Commit, Commit work is called then n then n u see the entry in the DB.

The reason u dont see entry in the DB sometimes is probably due to abrupt end of program as a result of which the transactions are rolled back.

Lines specified with the INSERT command are not finally

added to the database table until after a database commit

You can use the following syntax for the same:

ROLLBACK WORK.

Since, as a rule, an application program is processed by several work processes in succession, and every change of the work process is linked to an implicit database commit, an application program is not automatically linked to a single database LUW.

This applies in particular to dialog-oriented applications, in which one database LUW is assigned to one dialog step.

To ensure the data consistency of application programs that are executed across different work processes, the application statements are not directly executed in an SAP LUW.

Instead, they are first registered and then executed by a single work process, that is, in a single database LUW.

A SAP LUW is controlled via the Open SQL statements

COMMIT WORK

ROLLBACK WORK

SET UPDATE TASK LOCAL.

Explict Commit after the INSERT statement is necessary to effect the changes to the database.

To use RollBack.

INSERT...

Rollback work.