Skip to Content
0
Jul 26, 2013 at 11:35 AM

Can i lock & unlock Z table once on top & bottom, for a multiple updates?

47 Views

Hello,

We have a prog. in production, where in 2 custom Tables are updating (in a subroutine of 150 lines, say my_routine). Now, i have been asked to place the code for LOCKing the table & then UNLOCKING it, well. The exisitng code is as below,

FORM my_routine

1 - 20 lines some validations & data processing

21 st line - DELETE operation on z_table_1

22 - 30 some data processing

31st line - MODIFY operation on z_table_1

32 - 40 data processing

41st line - DELETE operation on z_table_2

like that......couple more DELETE operations, couple more MODIFY, couple more INSERT operations in this routine on 2 tables, at the end commit work as below

COMMIT WORK

ENDFORM.

Pls. let me know, now can I place LOCK & UNCLOCK on the beginning & End of the subroutine my_routine, i mean, just at one place as on top & on bottom instead of placing for each & every INSERT / DELETE / MODIFY statements, as below,

FORM my_routine

1 - 20 lines some validations & data processing


IF lv_delete_insert_modify_on_table_1 IS TRUE.
LOCK the table_1
ENDIF.

IF lv_delete_insert_modify_on_table_2 IS TRUE.

LOCK the table_2

ENDIF.

21 st line - DELETE operation on z_table_1

22 - 30 some data processing

31st line - MODIFY operation on z_table_1

32 - 40 data processing

41st line - DELETE operation on z_table_2

like that......couple more DELETE operations, couple more MODIFY, couple more INSERT operations in this routine

COMMIT WORK

IF lv_delete_insert_modify_on_table_1 IS TRUE.

UN-LOCK the table_1

ENDIF.

IF lv_delete_insert_modify_on_table_2 IS TRUE.

UN-LOCK the table_2

ENDIF.

ENDFORM.

Thank you