cancel
Showing results for 
Search instead for 
Did you mean: 

Employee locking issue

Former Member
0 Kudos


Dear Experts,

I am trying to update infotype 0003 using BDC Call transaction method. Before calling BDC, i am using funtion modules to lock the employee. The employee gets successfully locked by the FM and when the program calls the PA30 screen to update the employee, it throws an error  "Person is already being processed by user XXXXX".

I know that BDC internally sets a lock on the employee but i have a requirement to explicitly lock the employee.

Any pointers on this is highly appreciated.

Thanks in advance.

Murthy

Accepted Solutions (0)

Answers (1)

Answers (1)

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

Try like below.

* Enqueue personnel number

    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

      EXPORTING

        number = lv_pernr

      IMPORTING

        return = ls_return.

    IF ls_return-type EQ ' '." 'S'.

      CALL FUNCTION 'HR_INFOTYPE_OPERATION'

        EXPORTING

          infty            = lc_infty

          number           = gs_2001_new-pernr

          subtype          = gs_2001_new-subty

          objectid         = gs_2001_new-objps

          lockindicator    = gs_2001_new-sprps

*         VALIDITYEND      = GS_2001_NEW-ENDDA

*         VALIDITYBEGIN    = GS_2001_NEW-BEGDA

*         RECORDNUMBER     =

          record           = gs_2001_new

          operation        = 'INS'

*         TCLAS            = 'A'

*         DIALOG_MODE      = '2'

*         NOCOMMIT         = 'X'

*         VIEW_IDENTIFIER  =

*         SECONDARY_RECORD =

        IMPORTING

          return           = ls_return2

          key              = ls_key.

      IF  ls_return2 IS NOT INITIAL.

        gs_alv-pernr = gs_2001_new-pernr. "lv_pernr.

        gs_alv-ioper = 'INS'. "gs_2001-ioper.

        gs_alv-mtype = ls_return2-type.

        gs_alv-message = ls_return2-message.

        APPEND gs_alv TO gt_alv.

        CLEAR: gs_alv.

      ELSE.

        COMMIT WORK.

        WAIT UP TO 1 SECONDS.

      ENDIF.

*  IF sy-subrc EQ 0 AND ls_return2-type EQ 'S'.

      CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

        EXPORTING

          number = lv_pernr

        IMPORTING

          return = ls_return1.

    ENDIF.

    CLEAR gs_2001.

    CLEAR: ls_return,ls_return1,ls_return2,ls_key.

Thanks,

Sreeram

Former Member
0 Kudos

Hi Sreeram,

Thanks for your reply.

I think the locking/unlocking function modules will work only with "HR_INFOTYPE_OPERATION".

Currently our requirement is to use BDCs and before calling BDC we need to check whether the employee is locked. While using the enqueue function modules, it locks the employee.

Thanks in advance.