Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_EMPLOYEE_DEQUEUE lock not being released until Loop is finished

Former Member
0 Likes
1,725

I am processing 2000+ records in a loop and the function BAPI_EMPLOYEE_DEQUEUE is not releasing any of the employees until the entire loop has finished. A very simplistic version of my code is:

LOOP AT rec.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

CALL FUNCTION 'HR_INFOTYPE_GETDETAIL'

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

ENDLOOP.

Does anyone know why it is not releasing the employee until the end of the loop or how I can get this to happen? I did check and I am passing these functions the correct employee #'s.

Points will be rewarded.

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
1,399

Hi,

Please try to add COMMIT WORK after FM 'HR_INFOTYPE_OPERATION' when the update is successfully. Then you can call FM BAPI_EMPLOYEE_DEQUEUE'.

Regards,

Ferry Lianto

9 REPLIES 9
Read only

ferry_lianto
Active Contributor
0 Likes
1,400

Hi,

Please try to add COMMIT WORK after FM 'HR_INFOTYPE_OPERATION' when the update is successfully. Then you can call FM BAPI_EMPLOYEE_DEQUEUE'.

Regards,

Ferry Lianto

Read only

0 Likes
1,399

Good suggestion, but it did not work. Any other ideas?

Read only

Former Member
0 Likes
1,399

Hi,

Try ..COMMIT WORK AND WAIT...For V1 updates to get completed..

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

Thanks,

Naren

Read only

0 Likes
1,399

Darn thing. I tried both the COMMIT WORK AND WAIT.

and COMMIT WORK in vairous places and it still does not release the employee until after the entire loop is finished. Doesn't make any sense to me. Any other ideas?

Read only

0 Likes
1,399

I'm still not having any luck. If someone has some sample code could you perhaps send it to me? thx

Read only

Former Member
0 Likes
1,399

Hi janice,

1. I had also done this kind of loop, but it was working fine.

2. Maybe ucan try commit work after

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

regards,

amit m.

Read only

Former Member
0 Likes
1,399

Hi,

Instead of calling Enqueue..Dequeue..

Try calling the FM BAPI_EMPLCOMM_CHANGE directly..

Thanks,

Naren

Read only

0 Likes
1,399

This is obviously my day to be a blond. Somedays you just can't see the obvious. I just figured it out.

My 2 function calls were calling different employee #'s .... one was calling '1234' and the other was calling '00001234'. I can't believe I have been struggling with this!!

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

thx for your responses. I am still going to reward points because I appreciated the responses.

Read only

Former Member
0 Likes
1,399

Hi Janice,

I just figured out that I did the same mistake as you did and have been struggling for hours. You made my day.

Cheers,

Amber