06-13-2011 6:23 PM
Hi All,
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.
Thanks.
06-13-2011 8:01 PM
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.
06-13-2011 8:01 PM
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.
06-13-2011 9:06 PM
Thanks Suman it workd.
Setting the update task as local did it. I just added that part with my old code and it runs like a charm now.
Thanks again,
Daniel.