Hi Experts,
I am facing a problem with info-type update in a workflow process.
I've implemented a class method for assigning to the workflow task, in that method I've used 'HR_INFOTYPE_OPERATION' Fm to update info type.
Please check my code attached below.
Problem is while i am executing the class method directly Info type was getting updated properly
But when i run the complete workflow cycle Only the first record of internal table 'it_item'
was getting updated.
I've tried all the possible ways to achieve it like
* Adding some Wait time
* Using submit Report in method
* Using Call Transaction in method..etc.
am i missing anything..
Please Help me to resolve this problem.
-Thanks In advance
Sundeep.
DATA : infty TYPE prelp-infty,
number TYPE p0001-pernr,
subtype TYPE p0001-subty,
objectid TYPE p0001-objps,
lockindicator TYPE p0001-sprps,
validityend TYPE p0001-endda,
validitybegin TYPE p0001-begda,
recordnumber TYPE p0001-seqnr,
operation TYPE pspar-actio,
tclas TYPE pspar-tclas,
dialog_mode TYPE c,
nocommit TYPE bapi_stand-no_commit,
view_identifier TYPE p0003-viekn,
lw_return TYPE bapireturn1,
return TYPE bapireturn1,
lw_key TYPE bapipakey.
DATA : lt_item TYPE TABLE OF zhcmt066a,
ls_item TYPE zhcmt066a,
wa_item TYPE zhcmt066a,
it_item TYPE TABLE OF zhcmt066a,
ls_pa2006 TYPE p2006,
lv_lines TYPE sy-index,
req_id TYPE zhcmt066-req_id.
CALL METHOD me->get_request
EXPORTING
im_req = im_req
IMPORTING
request = request.
req_id = im_req.
IF request-app_level = 'FA'. " To check the approval Level
SELECT * FROM zhcmt066a
INTO TABLE lt_item
WHERE req_id = req_id
AND approved = 'M'.
IF sy-subrc = 0.
LOOP AT lt_item INTO ls_item.
READ TABLE it_item INTO wa_item WITH KEY req_date = ls_item-req_date.
IF sy-subrc = 0.
wa_item-rec_hrs = wa_item-rec_hrs + ls_item-rec_hrs.
MODIFY it_item FROM wa_item INDEX sy-tabix TRANSPORTING rec_hrs.
ELSE.
APPEND ls_item TO it_item.
ENDIF.
CLEAR : ls_item,wa_item.
ENDLOOP.
* update infotype with all the selected records
LOOP AT it_item INTO wa_item.
ls_pa2006-pernr = request-pernr.
ls_pa2006-subty = '10'.
ls_pa2006-endda = wa_item-req_date.
ls_pa2006-begda = wa_item-req_date.
ls_pa2006-anzhl = wa_item-rec_hrs.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = request-pernr
IMPORTING
return = return.<br>
IF return IS INITIAL.
infty = '2006'.
number = request-pernr.
subtype = '10'.
operation = 'INS'.
lockindicator = 'X'.
validityend = wa_item-req_date.
validitybegin = wa_item-req_date.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '2006'
number = number
subtype = subtype
objectid = objectid
lockindicator = lockindicator
validityend = validityend
validitybegin = validitybegin
record = ls_pa2006
operation = operation
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = lw_return
key = lw_key.
IF lw_return-id = 'E' and lw_return IS NOT INITIAL.
MESSAGE ID return-id TYPE return-type NUMBER return-number
WITH return-message_v1 return-message_v2 return-message_v3 return-message_v4.
ELSEIF lw_return IS INITIAL.
COMMIT WORK.
WAIT UP TO 2 SECONDS.
ENDIF.
ELSEIF return-id = 'E' AND return IS NOT INITIAL.
MESSAGE ID return-id TYPE return-type NUMBER return-number
WITH return-message_v1 return-message_v2 return-message_v3 return-message_v4.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = request-pernr
IMPORTING
return = return.
CLEAR : infty, wa_item, ls_pa2006, return, lw_return, subtype,<br> operation, lockindicator, validityend, validitybegin.
ENDLOOP.
ENDIF.
ENDIF.