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: 

luw and comitt work

Former Member
0 Kudos

Hi All,

can any body tell me about logical unit of work and comitt work.

Thanks in advance

nagendra

5 REPLIES 5

Former Member
0 Kudos

Hi,

The R/3 system is multi user system and many users access the same information at the same time, which is mainly DATA. Consider the case where one user is modifying a record, and second user is trying to delete the same record. If the second user is successful in deleting the record then the first user will face problem for modifying the record that is already deleted. The avoid such situation, R/3 system has provided Logical Unit of Work, which is defined as a locking mechanism to protect transaction integrity. Of course, there are other measures, which ensures data integrity like check table i.e. foreign key relationship. Within SAP system there are three types of transaction and may be distinguished as:

• Database transaction known as LUW. It can be defined as a period in which operation requested must be performed as a unit, i.e. all or nothing operation. At the end of LUW, either of the database changes are committed or rolled back.

• Update transaction or SAP LUW. One SAP LUW can have several databases LUW. So a set of a database is either committed or rolled back. The special ABAP/4 command COMMIT WORK, marks the end of a SAP LUW.

• ABAP/4 transaction. Is made up of a set of related task combined under one transaction code. ABAP/4 transactions are for programming environment, in which ABAP/4 transaction functions like one complete object containing screens, menus and transaction codes.

R/3 system has provided in built locking mechanism, which defines the Logical Unit of Work. Also user can set his own locking mechanism. The LUW starts when a lock entry in the system table is created, and it ends when the lock is released.

To provide the user the facility to communicate with the table in order to modify or delete or insert data, R/3 has provided tool called SCREEN PAINTER. This tool allows you to design screen, process screen through program and update the database table. SAP has provided one and only one way to update the database table, i.e. transaction. Though you can update database table by using open SQL statement through program, SAP usually doesn’t recommend this kind of updating. Many standard transactions are available to update standard table but if the need arises, the developer should be able to develop new transaction, which allows the updating of database tables. This can be achieved by using various components of screen painter.

COMMIT work commits the data to database.

reward if useful

regards,

Anji

Former Member
0 Kudos

Commit Work:

This statement will apply any outstanding database updates and wait until they have actually been put on the database before proceeding to the next statement.

An ordinary commit work will initiate the process to update the databases in a separate task and will press on in your abap.

COMMIT WORK: ( Asynchronous)

Your program does not wait for any acknowledgement. it just start executing the next statment after COMMIT WORK.

LUW: A logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAP LUW. Unlike a database LUW, an SAP LUW can span several dialog steps, and be executed using a series of different work processes. If an SAP LUW contains database changes, you should either write all of them or none at all to the database. To ensure that this happens, you must include a database commit when your transaction has ended successfully, and a database rollback in case the program detects an error. However, since database changes from a database LUW cannot be reversed in a subsequent database LUW, you must make all of the database changes for the SAP LUW in a single database LUW

Former Member
0 Kudos

chk this

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm">LUW</a>

Former Member
0 Kudos

Hi Nagendar,

Check this info.

A Logical Unit of Work (LUW or database transaction) is an inseparable sequence of database operations which must be executed either in its entirety or not at all. For the database system, it thus constitutes a unit.

LUWs help to guarantee database integrity. When an LUW has been successfully concluded, the database is once again in a correct state. If, however, an error occurs within an LUW, all database changes made since the beginning of the LUW are canceled and the database is then in the same state as before the LUW started.

An LUW begins

o each time you start a transaction

o when the database changes of the previous LUW have been confirmed (database

commit) or

o when the database changes of the previous LUW have been cancelled (database rollback)

An LUW ends

o when the database changes have been confirmed (database commit) or

o when the database changes have been canceled (database rollback)

COMMIT WORK.

Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that

  • all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and

  • all database locks are released.

COMMIT WORK also

  • calls the subroutines specified by PERFORM ... ON COMMIT * executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK ) specified in these subroutines or started just before,

  • processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK ,

  • cancels all existing locks (see SAP locking concept ) if no update requests exist,

  • closes all open database cursors (see OPEN CURSOR ) and

  • resets the time slice counter to 0.

COMMIT WORK belongs to the Open SQL command set.

Return code value

The SY-SUBRC is set to 0.

ROLLBACK WORK.

Closes a logical processing unit by reversing all database changes made since the last COMMIT .

You use this statement if you cannot be certain that all the database changes have been executed correctly.

The update routines are not performed.

ROLLBACK WORK belongs to the Open SQL command set.

Note

If the ROLLBACK statement occurs within a SELECT loop, the processing cannot continue because the database cursor is invalid. After the ROLLBACK statement, you should therefore ensure that all SELECT processing has been explicitly terminated.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Former Member
0 Kudos