Skip to Content
0

IT0416 When Unlocked Does not Correctly Consider the Quota using HR_INFOTYPE_OPERATION EDQ

Nov 30, 2016 at 07:44 AM

69

avatar image

We currently have a process where by employees are allowed to request to buy leave through ESS. When this happens a locked Quota Compensation (0416) record is created and a workflow sent to a line manager for approval. When the manager approves the 0416 is unlocked.

I am unlocking the 0416 using FM HR_INFOTYPE_OPERATION but have found that the days from the 0416 are more than the days on quota(it2006) So the FM does allow me to unlock even though the days on quota are less that it416,Which is wrong.
If I unlock the 0416 manually using transaction PA30 then It doesn't which is correct
I have included the code I'm using to call the FM below . Any ideas would be appreciated

l_opran = 'EDQ'.

ASSIGN COMPONENT 'PERNR' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_pernr.
UNASSIGN <fld>.

ASSIGN COMPONENT 'BEGDA' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_begda.
UNASSIGN <fld>.

ASSIGN COMPONENT 'ENDDA' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_endda.
UNASSIGN <fld>.

ASSIGN COMPONENT 'SUBTY' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_subty.
UNASSIGN <fld>.

ASSIGN COMPONENT 'SEQNR' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_seqnr.
UNASSIGN <fld>.

ASSIGN COMPONENT 'SPRPS' OF STRUCTURE <dyn_wa_temp> TO <fld>.
MOVE <fld> TO l_sprps.
UNASSIGN <fld>.

"Expected result of SPRPS
IF l_sprps NE 'X'.
l_sprps_result = 'X'.
ENDIF.

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = l_pernr.

CALL FUNCTION 'HR_INITIALIZE_BUFFER'
EXPORTING
pernr = l_pernr.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_infty
number = l_pernr
subtype = l_subty
lockindicator = l_sprps
validityend = l_endda
validitybegin = l_begda
recordnumber = l_seqnr
record = <dyn_wa_temp>
operation = l_opran
IMPORTING
return = ls_return.
"error handling
IF ls_return-type EQ 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = ls_return-id
lang = sy-langu
no = ls_return-number
v1 = ls_return-message_v1
v2 = ls_return-message_v2
v3 = ls_return-message_v3
v4 = ls_return-message_v4
IMPORTING
msg = l_msg " Message text
EXCEPTIONS
not_found = 1
OTHERS = 2.
p_emsg = l_msg.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
PERFORM update_zhrlockedrec USING 'RM' CHANGING l_msg.
ENDIF.

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = l_pernr.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
BHEKA NKONYANE Nov 30, 2016 at 09:33 AM
0

You need to find the function module that checks the leave quota before unlocking the quota compensation record. This function module should read infotype 2006 for the quota hopefully. So set a breakpoint on the function module for reading infotypes,(I think it's HR_INFOTYPE_READ).

Next, perform the manual process via PA30 to unlock the compensation record, this should break for debugging at your breakpoint. Pay particular attention to calls to this function with infotype 2006 and check the parameters as well as whether this function module returns errors when the compensation days exceed the quota. You can then incorporate this check into your code above.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Bheka Thanks.

I ended up making direct check before FM HR_INFOTYPE_OPERATION for IT416 using FM

REMAINING_TIMEQUOTA .Now It looks fine.

0