cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Lock Objects

Former Member
0 Likes
1,745

Is creating Lock objects,admin job or ABAPer job?

What is the ABAPer work regarding Lock objects?

Can ABAPer use the ENQUEUE and DEQUEUE function modules for locking and unlocking?

View Entire Topic
Former Member
0 Likes

Hi Lalitha.

Answer 1: Locking can be done by an ABAP consultant.

Answer 2: An ABAP programmer has to follows important strategies:

1. Setting of Lock mode:

Status that determines whether a user has exclusive access to an object, or whether access is shared with other users.

The lock mode (either "Shared" or "Exclusive") is assigned to the tables of a lock object on definition.

2. Activation of lock object (Calling Function Modules):

Use of various function modules (ENQUEUE and DEQUEUE) to facilitate the locking and unlocking mechanisms.

I would like to show you some code where you can understand some basic locking and releasing mechanism for HR Infotype modifications :

tables:
  pa0001.

data:
  t_pa0001 like table of pa0001.

data:
  fs_pa0001 like p0001.

parameters:
  p_pernr like pa0001-pernr.

select single *
from pa0001
into  corresponding fields of fs_pa0001
where pernr = p_pernr.


fs_pa0001-gsber = '1000'.
fs_pa0001-infty = '0001'.


call function 'BAPI_EMPLOYEE_ENQUEUE'
  exporting
    number = p_pernr.

call function 'HR_INFOTYPE_OPERATION'
  exporting
    infty                  = '0001'
    number                 = p_pernr
*   SUBTYPE                =
*   OBJECTID               =
*   LOCKINDICATOR          =
   validityend            = '99991231'
   validitybegin          = '20080628'
*   RECORDNUMBER           =
    record                 = fs_pa0001
    operation              = 'MOD'
*   TCLAS                  = 'A'
*   DIALOG_MODE            = '0'
*   NOCOMMIT               =
*   VIEW_IDENTIFIER        =
*   SECONDARY_RECORD       =
* IMPORTING
*   return                 = return
*   KEY                    =
          .
          call function 'BAPI_TRANSACTION_COMMIT'
*           EXPORTING
*             WAIT          =
*           IMPORTING
*             RETURN        =
                    .


call function 'BAPI_EMPLOYEE_DEQUEUE'
  exporting
    number = p_pernr.

Reward Points if you find this information usefull.

Regards

Harsh