HR_EMPLOYEE_DEQUEUE not workign in background
I am trying to insert new IT0002 record for employees using HR_INFOTYPE_OPERATION. I am enqueuing the employee before the HR_INFOTYPE_OPERATION and use HR_EMPLOYEE_ENQUEUE after that to release the employee. Now the problem is, it works perfect in foreground in all the modes(N,A,E). But when I sechedule the job in background, the employees are not dequeued. If there are more than one record for the employee, then I get the error "Personnel Number locked by..."
It works fine in background too if make the process to wait by adding WAIT UP TO 1 Seconds but I don't want to do that. Please let me know if there is another option or what is wrong in this process.
Suman Jagu replied
Please check if the below code helps in resolving the lock issue.
CALL FUNCTION 'HR_PSBUFFER_INITIALIZE'. PERFORM enqueue_pernr(sapfp50g) USING gv_pernr 'S'. SET UPDATE TASK LOCAL. CALL FUNCTION 'HR_INFOTYPE_OPERATION' ... PERFORM dequeue_pernr(sapfp50g) USING gv_pernr.