LUW Table Lock Object
*-----------------------------------------------------------------------
*
* Company XXX Company Limited
*
* ProgrameName: ZZW_LUW_ENQUEUE
*
* Author: Wei_Zhu
*
* Date: 08/01/2007
*
* Description: Study SAP In Program How Update Table Use LUW Enqueue
*
*
*-----------------------------------------------------------------------
REPORT ZZW_LUW_ENQUEUE Message-ID 00 .
*-----Table-------
Tables: ZTBTEST.
*-----Defined Structure-----
Types: Begin Of Stab,
Id like ZTBTEST-Z_USER_ID,
User_Name like ZTBTEST-Z_User_Name,
Text like ZTBTEST-Z_TEXT,
End Of Stab.
Data: wa_tab type Stab.
wa_tab-id = '1'.
wa_tab-user_name = 'Lilo Enqueue'.
wa_tab-text = 'LUW Lock Object'.
*Select-Options Sid for ztbtest-z_user_id no intervals.
Start-Of-Selection.
Call Function 'ENQUEUE_EZTBTEST'
Exporting
Mode_Ztbtest = 'X'
Z_USER_ID = wa_tab-id
Exceptions
foreign_lock = 1
system_failure = 2
Others = 3.
If Sy-Subrc <> 0.
Message ID Sy-msgid Type Sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
elseif Sy-Subrc EQ 0.
Write:/ 'Table [ ZTBTEST ] Lock OK.'.
EndIf.
update ztbtest set z_user_name = wa_tab-user_name
z_text = wa_tab-text
where z_user_id = wa_tab-id.
Call Function 'DEQUEUE_EZTBTEST'.
IF sy-subrc NE 0.
MESSAGE s398
WITH 'Error occured during unblocking for table ZTBTEST '.
STOP.
elseIf sy-subrc EQ 0.
Write: /'Table [ ZTBTEST ] Unlock OK.'.
ENDIF.