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 plz help me

Former Member
0 Kudos

what is update task?

what is luw ? when it is created?

4 REPLIES 4

Former Member
0 Kudos

LUW - Logical unit of work. It is an inseperable sequence of unit work.

Two types - ABAP LUW, SAP LUW.

It is created when COMMIT work is executed.

<b>pls reward if helpful.</b>

Former Member
0 Kudos

hI

If you call the function module IN UPDATE TASK..You have to give subsequent commit work statement to trigger the update module..

Ex..

CALL FUNCTION 'Y_SAVE_TEXT' IN UPDATE TASK

.........

COMMIT WORK..

<b>COMMIT WORK</b>

Persistent Objects and COMMIT WORK

To apply the changes made to the runtime objects of persistent classes to the actual persistent objects in the database, execute the COMMIT WORK statement. (Alternatively, use COMMIT WORK AND WAIT or SET UPDATE TASK LOCAL). Unless you are executing an object-oriented transaction from within the Transaction Service, you must include the COMMIT WORK statement explicitly in the program. Otherwise, it is encapsulated in the Transaction Service. (If you explicitly include the COMMIT WORK statement as described here, the t op-level transaction runs in compatibility mode).

The function of the COMMIT WORK statement is extended when you use it in conjunction with Object Services. Before COMMIT WORK closes the SAP LUW and triggers an update, it calls internal methods of the Persistence Service. These methods bundle the changes made to managed objects of the Persistence Service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK. Thus the Persistence Service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.

After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).

Local Update

If you want to change managed objects directly, rather than using the update module, you must change the update mode of the implicitly used Transaction Service. That is, the following statements must be executed before the COMMIT WORK statement:

DATA TM type ref to IF_OS_TRANSACTION_MANAGER.

DATA T type ref to IF_OS_TRANSACTION.

...

TM = CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER( ).

T = TM->GET_CURRENT_TRANSACTION( ).

T->SET_MODE_UPDATE( OSCON_DMODE_DIRECT ).

COMMIT WORK.

To ensure database consistency, the local update is activated internally using SET UPDATE TASK LOCAL. In such cases, the system raises an exception if there are already update modules registered in the update task. You can only register additional classical update modules after setting the mode. They will then also be updated locally.

REWARD IF USEFULL

Former Member
0 Kudos

Hi,

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.

Regards,

Padmam.

Former Member
0 Kudos

hi Srinivas

“logical unit of work” (LUW) refers to a collection of “all-or-nothing” actions performed at the database level as a complete unit.

A database transaction is the most basic level. Because a database commit is automatically triggered at every screen change, a basic database LUW lasts (at a maximum) from one screen to the next.

the update LUW lasts until a “COMMIT WORK” or “ROLLBACK WORK” ABAP statement is encountered.

An SAP (or ABAP) transaction is the collection of screens into a transaction code. This type of transaction can include many LUWs.

The ABAP statement “COMMIT WORK” confirms all changes to the database and closes an LUW.

The ABAP statement “ROLLBACK WORK” cancels and “rolls back” all changes in an LUW.

thanks