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_ENQUEUE failed

Former Member
0 Likes
1,850

Hi all,

I am using three functions to modify an employee infotype (0002), but the BAPI_EMPLOYEE_ENQUEUE "failed" ; i dont know where is the problem so anybody help me-> here is the code:

DATA: ls_employee like line of p0002.

DATA: w_bapireturn LIKE bapireturn1.

DATA: w_bapipakey LIKE bapipakey OCCURS 0 WITH HEADER LINE.

......

ls_employee-vorna = 'BRAD'.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = ls_employee-pernr " (Matricule of employee)

IMPORTING

return = w_bapireturn.

IF w_bapireturn-id NE space.

WRITE: / 'Enqueue failed'.

ENDIF.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0002'

number = ls_employee-pernr

record = ls_employee

validitybegin = ls_emplyee-begda

validityend = ls_employee-endda

operation = 'MOD'

IMPORTING

return = w_bapireturn

key = w_bapipakey.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = ls_employee-pernr

IMPORTING

return = w_bapireturn.

Edited by: Jcrios on Mar 9, 2010 3:10 PM

Edited by: Jcrios on Mar 9, 2010 3:11 PM

1 ACCEPTED SOLUTION
Read only

PedroGuarita
Active Contributor
0 Likes
1,551

This BAPI might fail if the employee is already locked for some reason. Check SM12 and see if there is a lock on the employee.

11 REPLIES 11
Read only

PedroGuarita
Active Contributor
0 Likes
1,552

This BAPI might fail if the employee is already locked for some reason. Check SM12 and see if there is a lock on the employee.

Read only

0 Likes
1,551

Thank U a lot Pedro I ll keep you informed even is this the problem

Read only

0 Likes
1,551

Hi pedro,

I haven t any entries locked in the system !

Read only

0 Likes
1,551

Use FM 'ENQUEUE_EPPRELE' directly instead of BAPI.


  CALL FUNCTION 'ENQUEUE_EPPRELE'
    EXPORTING
      PERNR          = pu_pernr
      MODE_PREL      = 'E'
    EXCEPTIONS
      FOREIGN_LOCK   = 2
      SYSTEM_FAILURE = 3.

See if this works.

Read only

0 Likes
1,551

Hi Pedro !

I used this code but still doesn t work :

 CALL FUNCTION 'ENQUEUE_EPPRELE'
    EXPORTING
      PERNR          = ls_employee-pernr
      MODE_PREL      = 'E'
    EXCEPTIONS
      FOREIGN_LOCK   = 2
      SYSTEM_FAILURE = 3.


  CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING
      infty            = '0002'
      number           = ls_employee-pernr
      record           = ls_employee
      validityend      = ls_employee-endda
      validitybegin    = ls_employee-begda
      operation        = 'MOD'
      DIALOG_MODE   = '1'


    IMPORTING
      return           = w_return
      key = record_key.

Read only

0 Likes
1,551

What is the sy-subrc that comes out of the FM ?

Read only

0 Likes
1,551

I exucuted the debugger ! and it returs 0 for both ENQUEUE_EPPRELE and HR_INFOTYPE_OPERATION

Read only

0 Likes
1,551

So, suposedly it works ?

Read only

0 Likes
1,551

Thanx Pedro ,

But the modification still dont work at all ! i tried the

update PA0002 set natio = 'kqjks' where pernr = ls_employee-pernr

-> it s work but the FM doesn t! i dont know where is the problem ! I'm stuck .. so anybody help

Read only

0 Likes
1,551

Thanx Pedro ,

But the modification still dont work at all ! i tried the

update PA0002 set natio = 'kqjks' where pernr = ls_employee-pernr

-> it s work but the FM doesn t! i dont know where is the problem ! I'm stuck .. so anybody help

Read only

0 Likes
1,551

Thanx Pedro ,

But the modification still dont work at all ! i tried the

update PA0002 set natio = 'kqjks' where pernr = ls_employee-pernr

-> it s work but the FM doesn t! i dont know where is the problem ! I'm stuck .. so anybody help