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

hr_infotype_operation errors when called within a user exit

Former Member
0 Likes
664

Hi there.

I am doing an enhancement in userexit PBAS0001 for CE using the enhancement framework.Whenever I am trying to change the payroll area in IT0001 by PA30 it has to give a message saying that 'all the assignments will change to new payroll areas do you want to continue?'if i say yes then the payroll areas for all the assignments should be chnaged to the current payroll area which I am trying to change.So after the pop up I am looping at all the assignments and calling the function module hr_infotype_operation.It gives an error Complex Application error.I debugged and saw that when it calls the function module the user exit gets triggered again and goes to the starting within the function call and hits the function module again and keep going like this.I checked the structure and all the parameters.looks fine below is the code where I am using the function module.I am trying to update IT0001 when somebody tries to change the IT0001(is that an issue??) i tried by submitting a program by calling the function module in the program.Didnt work too.Is there any way we can do it by BDC??

Check if the payroll areas are equal

IF ls_i0001-abkrs NE new_p0001-abkrs.

*

  • If the payroll areas are not equal then generate a message pop-up with 'YES' and 'NO' buttons

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Warning'

text_question = 'Payroll Area specified is different with other assignments.Do you want to move all the other assignments to the same payroll area?'

text_button_1 = 'Yes'

icon_button_1 = ' '

text_button_2 = 'No'

icon_button_2 = ' '

default_button = '1'

start_column = 25

start_row = 6

IMPORTING

answer = lv_case

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

CASE lv_case.

WHEN '2'. "For 'NO' button

LEAVE TO SCREEN '2010'.

WHEN 'A'. "For 'CANCEL' button

LEAVE TO SCREEN '2010'.

WHEN '1'. "For 'YES' button

  • Second Pop-up confirm

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Warning'

text_question = 'System will update all other assignments to the new payroll area'

text_button_1 = 'Yes'

icon_button_1 = ' '

text_button_2 = 'No'

icon_button_2 = ' '

default_button = '1'

display_cancel_button = 'X'

start_column = 25

start_row = 6

IMPORTING

answer = lv_case1

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

CASE lv_case1.

WHEN '2'. "For 'NO' button

LEAVE TO SCREEN '2010'.

WHEN 'A'. "For 'CANCEL' button

LEAVE TO SCREEN '2010'.

WHEN '1'. "For 'YES' button

  • For all the assignments read the infotype 0001 and update the payroll area

LOOP AT lt_pernr INTO ls_pernr.

CLEAR:lt_i0001,ls_i0001.

REFRESH lt_i0001.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

tclas = 'A'

pernr = ls_pernr

infty = '0001'

begda = new_p0001-begda

endda = new_p0001-endda

bypass_buffer = 'X'

IMPORTING

subrc = lv_subrc

TABLES

infty_tab = lt_i0001

EXCEPTIONS

infty_not_found = 1

OTHERS = 2.

SORT lt_i0001 BY endda DESCENDING.

READ TABLE lt_i0001 INTO ls_i0001 INDEX 1.

ls_i0001-abkrs = new_p0001-abkrs.

  • lv_record = ls_i0001.

  • Lock the employee

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = ls_i0001-pernr

IMPORTING

return = lv_return.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0001'

number = ls_i0001-pernr

validityend = '12302006'

validitybegin = '12012006'

record = ls_i0001

operation = 'INS'

IMPORTING

return = return.

*unlock the employee

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = ls_i0001-pernr

IMPORTING

return = lv_return.

**

  • SUBMIT zhr_infotype_operation_py_area USING SELECTION-SCREEN '1000'

  • WITH p_infty = '0001'

  • WITH p_pernr = ls_i0001-pernr

  • WITH p_endda = new_p0001-endda

  • WITH p_begda = new_p0001-begda

  • WITH p_record = lv_record

  • WITH p_opera = 'INS'

  • WITH p_tclas = 'A'

  • AND RETURN.

ENDLOOP.

ENDCASE.

ENDCASE.

ENDIF.

The employee in change mode is already locked so enque is failing and you are still trying to update it. Its too late though but in process of searcing an answer I found this question..

2 REPLIES 2
Read only

Former Member
0 Likes
478

maybe a little late, but I had found this message today (searching for different problem) but maybe the date for HR_infotype_operation might do a little problem, cause you are filling it with: DDMMYYYY but it should be YYYYMMDD so it just translate it that this is really far in the past so that might be a problem. Try sy-datum instead and for the end of validity try '99991231' dont worry, when you will update the same infotype again, the FM will end the previous infotype to previous day and the new one will get validity from sy-datum till the end ....

Read only

Former Member
0 Likes
478

The employee in change mode is already locked so enque is failing and you are still trying to update it. Its too late though but in process of searcing an answer I found this question..