We already know the usefulness of lock objects in ABAP. As soon as we create a lock object 2 Function modules created. We can use them like below :
IF (Check for your condition, If true the lock table)
CALL FUNCTION 'ENQUEUE_E_TABLEE'
EXPORTING
tabname = "Table Name"
varkey = "Key Field"
EXCEPTIONS
foreign_lock = 1
system_failure = 2.
CASE sy-subrc.
Here display some error message saying USER XXXX is editing the table, please try after sometime.
ENDCASE.
ELSE (When editing is done & user come out of that table, unlock the table ).
CALL FUNCTION 'DEQUEUE_E_TABLEE'
EXPORTING
tabname = "Table Name"
varkey = "Key Field"
ENDIF.
0 comments:
Post a Comment