Sometimes a HCM Process just needs to be deleted (cancelled). I've found that occasionally there will be a hung request out there that no user is able to process. It only happens very rarely, but being able to quickly cancel the request and any associated workflow is a handy thing to do. So here is a quick and dirty program which allows you to choose a process by reference number and cancel both the request and any workflows associated with it. thanks..
report zupd_proc_status.
data: t_t5asrprocesses type t5asrprocesses.
data: t_sww_wi2obj type sww_wi2obj.
selection-screen begin of block b1 with frame title text-002.
selection-screen begin of line.
selection-screen comment 1(27) text-005.
parameter: p_refn like t5asrprocesses-reference_number.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(27) text-004.
parameter : p_stat like t5asrprocesses-status default 'WITHDRAWN'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(27) text-007.
parameter : p_wf type char1 default 'X'.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(27) text-006.
parameter : p_test type char1 default 'X'.
selection-screen end of line.
selection-screen end of block b1.
start-of-selection.
select single * into t_t5asrprocesses from t5asrprocesses
where reference_number = p_refn.
if sy-subrc <> 0.
message i103(hrasr00_process) with p_refn.
exit.
else.
if t_t5asrprocesses-status eq p_stat.
message 'Status is already the requested status.' type 'I'.
exit.
else.
if p_test is initial.
t_t5asrprocesses-status = p_stat.
if t_t5asrprocesses-status = 'DRAFT' or t_t5asrprocesses-status = 'STARTED'.
clear t_t5asrprocesses-completion_date.
clear t_t5asrprocesses-completion_time.
else.
t_t5asrprocesses-completion_date = sy-datum.
t_t5asrprocesses-completion_time = sy-uzeit.
endif.
update t5asrprocesses from t_t5asrprocesses.
if sy-subrc eq 0.
commit work.
message 'Update Complete.' type 'I'.
if not ( p_wf is initial ).
if not ( t_t5asrprocesses-status = 'DRAFT' ) and not ( t_t5asrprocesses-status = 'STARTED' ).
select single * into t_sww_wi2obj from sww_wi2obj
where instid = t_t5asrprocesses-case_guid
and catid = 'CL'
and typeid = 'CL_HRASR00_WF_PROCESS_OBJECT'
and wi_reltype = '99'
and wi_rh_task like 'WS%'.
if sy-subrc eq 0.
call function 'SWW_WI_ADMIN_CANCEL'
exporting
wi_id = t_sww_wi2obj-wi_id.
if sy-subrc = 0.
message 'Update Complete. WF Cancelled.' type 'I'.
endif.
endif.
endif.
endif.
exit.
endif.
else.
message 'Update Can Be Done.' type 'I'.
exit.
endif.
endif.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |