0% found this document useful (0 votes)
76 views4 pages

SSHR and Tickets Pending Request Delete Steps

The document contains scripts to cancel pending SSHR and ticket requests by: 1) Taking backups of relevant tables to preserve data; 2) Creating procedures that use cursors to iterate through impacted transactions and requests, abort associated workflows, and update statuses; 3) Calling the procedures to execute the cancellation logic.

Uploaded by

Saquib.Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views4 pages

SSHR and Tickets Pending Request Delete Steps

The document contains scripts to cancel pending SSHR and ticket requests by: 1) Taking backups of relevant tables to preserve data; 2) Creating procedures that use cursors to iterate through impacted transactions and requests, abort associated workflows, and update statuses; 3) Calling the procedures to execute the cancellation logic.

Uploaded by

Saquib.Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

/*****************************************************************************

----------------Taking Backup Before Caneling SSHR Pending Request------------


******************************************************************************/

CREATE TABLE HR_API_TRANS_STEPS_BKP_060417


AS
SELECT *
FROM HR_API_TRANSACTION_STEPS HTS
where HTS.TRANSACTION_ID in (
select HAT.TRANSACTION_ID from
HR_API_TRANSACTIONS HAT
where HAT.CREATOR_PERSON_ID IN
(SELECT PPX.PERSON_ID
FROM PER_PEOPLE_X PPX
WHERE PPX.BUSINESS_GROUP_ID = 81));

CREATE TABLE HR_API_TRANS_VALUES_BKP_060417


AS
SELECT *
FROM HR_API_TRANSACTION_VALUES htv
WHERE HTV.TRANSACTION_STEP_ID IN
(SELECT HTS.TRANSACTION_STEP_ID
FROM HR_API_TRANSACTION_STEPS HTS
WHERE HTS.TRANSACTION_ID IN
(SELECT HAT.TRANSACTION_ID
FROM HR_API_TRANSACTIONS HAT
WHERE HAT.CREATOR_PERSON_ID IN
(SELECT PPX.PERSON_ID
FROM PER_PEOPLE_X PPX
WHERE PPX.BUSINESS_GROUP_ID =
81)));

/*****************************************************************************
---------Taking Backup Before Caneling Worflow for SSHR Pending Request-------

******************************************************************************/
CREATE TABLE XXPRC_WF_NOTIF_BKP_060417 AS
SELECT *
FROM WF_NOTIFICATIONS A
WHERE A.MESSAGE_TYPE = 'HRSSA'
AND A.STATUS = 'OPEN'
AND A.ITEM_KEY IN
(SELECT ITEM_KEY
FROM HR_API_TRANSACTIONS HAT
WHERE 1 = 1
AND HAT.CREATOR_PERSON_ID IN
(SELECT PPX.PERSON_ID
FROM PER_PEOPLE_X PPX
WHERE PPX.BUSINESS_GROUP_ID = 81));
/*****************************************************************************
---------Taking Backup Before Caneling Ticket Requests-------
******************************************************************************/
CREATE TABLE XXPRC_TKT_REQ_MST_BKP_060417 AS
SELECT * FROM XXAPU_PER_TICKET_REQUESTS;
CREATE TABLE XXPRC_TKT_REQ_DTL_BKP_060417 AS
SELECT * FROM XXAPU_PER_TICKET_DETAILS;
/*****************************************************************************
---------Script for Canceling SSHR Pending Requests-------
******************************************************************************/
CREATE OR REPLACE PROCEDURE xxprc_delete_sshr_pen_req AS
--DECLARE
CURSOR c1 IS
SELECT item_type,
item_key,
process_name,
hat.TRANSACTION_ID,
status
FROM hr_api_transactions hat
WHERE 1 = 1
AND status IN ('Y',
'YS',
'RI',
'RIS')
AND hat.CREATOR_PERSON_ID IN
(SELECT ppx.PERSON_ID
FROM per_people_x ppx
WHERE ppx.BUSINESS_GROUP_ID = 81);
BEGIN
FOR i IN c1 LOOP
BEGIN
BEGIN
WF_ENGINE.ABORTPROCESS(ITEMTYPE => I.ITEM_TYPE,
ITEMKEY => I.ITEM_KEY
--RESULT => 'REJECTED'
--PROCESS => I.PROCESS_NAME,
);
BEGIN
HR_TRANSACTION_API.ROLLBACK_TRANSACTION(I.TRANSACTION_ID);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT. put_line('HR_TRANSACTION_API Exception: ' /*
||

SUBSTR(SQLERRM,

1,

200) */
|| ' - ' || i.TRANSACTION_ID);
END;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT. put_line('WF_ENGINE Exception: ' /*||

SUBSTR(SQLERRM,

1,

200) */
|| ' - ' || i.item_key);
END;
--COMMIT;
DBMS_OUTPUT.put_line('Item Key has been Aborted/Cancelled: ' ||
i.item_key);
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line('Main Exception: ' /* ||

SUBSTR(SQLERRM,

1,

200)*/);
END;
-----------------------------------------------------
--Executing SSHR Pending Transaction Delete Procedure
-----------------------------------------------------
begin
-- Call the procedure
xxprc_delete_sshr_pen_req;
end;
-------------------------

/*****************************************************************************
---------------------Script for Canceling Ticket Pending Requests-------------
******************************************************************************/
CREATE OR REPLACE PROCEDURE xxprc_delete_ticket_pen_req AS
--DECLARE
CURSOR c1 IS
SELECT STATUS,
WF_ITEM_KEY,
WF_ITEM_TYPE
FROM XXAPU_PER_TICKET_REQUESTS
WHERE upper(STATUS) IN ('SUBMITTED FOR APPROVAL',
'SUBMITTED FOR CANCELLATION');
BEGIN
FOR i IN c1 LOOP
BEGIN
BEGIN
WF_ENGINE.ABORTPROCESS(ITEMTYPE => I.WF_ITEM_TYPE,
ITEMKEY => I.WF_ITEM_KEY
--RESULT => 'REJECTED'
--PROCESS => I.PROCESS_NAME,
);
UPDATE XXAPU_PER_TICKET_REQUESTS r
SET STATUS = 'Cancelled'
WHERE r.wf_item_key = i.wf_item_key
AND r.status = i.status;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT. put_line('WF_ENGINE Exception: ' /*||

SUBSTR(SQLERRM,

1,

200) */
|| ' - ' || i.WF_ITEM_KEY);
END;
DBMS_OUTPUT.put_line('Item Key has been Aborted/Cancelled: ' ||
i.WF_ITEM_KEY);
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line('Main Exception: ' /* ||

SUBSTR(SQLERRM,

1,

200)*/);
END;
-------------------------------------------------------
--Executing Ticket Pending Transaction Delete Procedure
-------------------------------------------------------
begin
-- Call the procedure
xxprc_delete_ticket_pen_req;
end;

You might also like