Application Development 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: 

Pernr Not getting lockedwhile doing the infotypes updation in sequence

Former Member
0 Kudos

Hi All,

We are facing a very strange issue with lock and unlock of the PERNR during updating the several infotypes for the same PERNR in a sequence.

Before posting I searched the forum ,but not able to find any solution.

Scenario : In a FM we are first creating a employee using a PA40 BDC Call Transaction ,once its done we are performing the

call function 'BAPI_EMPLOYEE_ENQUEUE'

exporting

number =p_pernr

importing

return = wa_return.

which will be successful.

After this we are updating Infotype 0002,41,105,007 in sequence using below code in loop for SAME PERNR.

"lock the PERNR 
call function'BAPI_EMPLOYEE_ENQUEUE' 
    exporting 
      number = p_pernr 
    importing 
      return = wa_return. 

Perform the operation 

   call function 'HR_INFOTYPE_OPERATION' 
      exporting 
        infty       = p_infotype 
        number      = p_pernr 
        subtype     = p_subtype 
        record      = <fs_pnnnn_new> 
        operation   = p_oper 
        nocommit    = c_commit 
        dialog_mode = v_dialogmode 
      importing 
        return      = return 
        key         = intpakey 
      exceptions 
        others      = 0. 


*Unlock the PERNR. 

call function 'BAPI_EMPLOYEE_DEQUEUE' 
    exporting 
      number = p_pernr 
    importing 
      return = wa_return. 
If  wa_return is not initital 

   call function 'BAPI_TRANSACTION_ROLLBACK' 
        importing 
          return = return_roleback. 
    else. 
      call function 'BAPI_TRANSACTION_COMMIT' 
        exporting 
          wait   = 'X' 
        importing 
          return = return_commit. 
    endif.

But we are getting error saying "Personal Number could not be locked" for some of the info types.

Do any one have idea what the exact issue is this?

Please help.

Regards

Channa

1 ACCEPTED SOLUTION

maciej_domagaa
Contributor
0 Kudos

Also make sure that the module you call - HR_INFOTYPE_OPERATION - does NOT perform commit itself.

If it does perform an asynchronous commit ("COMMIT WORK" without "AND WAIT") then your call to BAPI_TRANSACTION_COMMIT exporting wait = 'X' has no effect because it deals with the next LUW.

So check the parameter NOCOMMIT of HR_INFOTYPE_OPERATION.

regards

5 REPLIES 5

Former Member
0 Kudos

Hi ,

Do any one have any Idea on this ,,please reply.

Regards

Channa

0 Kudos

Hi,

I think the update task for tcode PA40 hasn't finished yet. Make sure to call it in a synchronous update with

CALL TRANSACTION ... UPDATE 'S' ...

or OPTIONS FROM opt, where field UPMODE = 'S'.

Regards,

Klaus

0 Kudos

Hi Klaus ,

Thanks for the suggestion ,but this too not working

Regards

Channa

maciej_domagaa
Contributor
0 Kudos

Also make sure that the module you call - HR_INFOTYPE_OPERATION - does NOT perform commit itself.

If it does perform an asynchronous commit ("COMMIT WORK" without "AND WAIT") then your call to BAPI_TRANSACTION_COMMIT exporting wait = 'X' has no effect because it deals with the next LUW.

So check the parameter NOCOMMIT of HR_INFOTYPE_OPERATION.

regards

0 Kudos

Hi Maciej ,

Thanks a lot ,you suggestion solved my issue.

thanks once again.

Awarded the points.

Regards

Channa