on 11-27-2007 9:03 AM
Hi,
How can check if a pernr is locked or not? I do not want to lock the pernr. All the enqueue and dequeue function modules lock or unlock a pernr.
Thanks & Regards,
Reena
HI,
You can use the FM
HR_EMPLOYEE_ENQUEUE'
Thanks
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi reena,
If you need to use it in your code , you can do it this way.
'BAPI_EMPLOYEE_ENQUEUE' to lock the *employee before updating
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = wa_2011-pernr
IMPORTING
return = l_bapireturn.
L_bapireturn wont be initial if the emlpoyee is
already locked
IF l_bapireturn IS INITIAL.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '2011'
number = wa_2011-pernr
subtype = wa_2011-subty
OBJECTID =
LOCKINDICATOR =
validityend = wa_2011-ldate
validitybegin = wa_2011-ldate
RECORDNUMBER =
record = wa_2011
operation = 'INS'
tclas = 'A'
dialog_mode = '0'
nocommit = ''
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
return = ws_return
key = ws_key.
.
IF ws_key-employeeno = wa_2011-pernr AND
ws_key-validend = wa_2011-ldate AND
ws_key-validbegin = wa_2011-ldate.
IF ws_return IS INITIAL.
ADD 1 TO g_lines_uploaded.
ELSE.
PERFORM get_unique_id.
wa_zhrtid003-zuid = g_zuid.
wa_zhrtid003-srno = it_finaldata-srno.
wa_zhrtid003-stid = it_finaldata-stid.
wa_zhrtid003-pernr = it_finaldata-pernr.
wa_zhrtid003-ldate = it_finaldata-ldate.
wa_zhrtid003-ltime = it_finaldata-ltime.
wa_zhrtid003-satza = it_finaldata-satza.
wa_zhrtid003-errtype = '4'.
APPEND wa_zhrtid003 TO it_zhrtid003.
CLEAR wa_zhrtid003.
ENDIF.
ENDIF.
Use 'BAPI_EMPLOYEE_DEQUEUE' to un-lock the employee before updating
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = wa_2011-pernr
IMPORTING
return = l_bapireturn.
ENDIF.
Hope this helps .
Reward if found useful.
Regards,
SureshP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the function module "IF_HR_ENQUEUE_OBJECT" to check whether a PERNR is locked by any user or not.
Pass the PLVAR = '01'
OTYPE = 'O'
and OBJID = PERNR
to the function module and it will return the user who locked the pernr.
Hope this will help.
Regards,
Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
guname = '*'
gname = 'PREL'
garg = pernr
IMPORTING
subrc = subrc
TABLES
enq = enq
EXCEPTIONS
OTHERS = 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ann,
Thanks for the function module. I have a small problem in executing the function module. If I pass penr in parameter 'GARG', I do not get any result. But without pernr I get all the locked entries. Do you have any idea as why this happens and how I can check for a particular pernr?
Regards,
Reena
You want to lock an Employee?
or you want to check whether employee is locked or not ?
or you want to check who has locked the employee?
if you go to PA30 and enter the Employee number then it displays that Employee is locked by the USERNAME.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Reena,
Check for the standard coding.
Goto program FP50GE00. Check for the subroutine "FORM enqueue_pernr USING enq_pernr enq_react".
This is used to check whether the employee is locked or not. The same is called in PA30 for employee lock check.
You can make use of this subroutine in your program or can copy it and change as per your needs.
Hope this helps you.
Regards,
Subbu.
If you try to lock an Employee using BAPI_EMPLOYEE_ENQUEUE FM and if it is not locked then the return value will be zero
if the employee is being used by others means if the Employee is locked then you get the message that Employee cannont be locked in Return value of this FM
C, if the Employee is not locked then you can lock him/her using BAPI_EMPLOYEE_ENQUE and do your Application and release the Employee by BAPI_EMPLOYEE_DEQUEUE
if the Employee is already in use then you get the message that Employee cannot be locked at the time of you try to lock the employee. so you can skip the process.
User | Count |
---|---|
91 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.