-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathWF AbortProcess.sql
More file actions
70 lines (65 loc) · 2.09 KB
/
WF AbortProcess.sql
File metadata and controls
70 lines (65 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Formatted on 12.03.2019 18:15:54 (QP5 v5.326) Service Desk 280834 Mihail.Vasiljev */
/* OM Order Line */
DECLARE
CURSOR deleteProcess IS
SELECT item_type, item_key
FROM wf_items
WHERE end_date IS NULL
AND (ITEM_TYPE = 'OEOL' OR PARENT_ITEM_TYPE = 'OEOL') /* OM Order Line*/
AND BEGIN_DATE < SYSDATE - 80 -- and ITEM_KEY = 'put_here_item_key_for PO'
;
BEGIN
FOR wfProcess IN deleteProcess
LOOP
wf_engine.AbortProcess (wfProcess.item_type, wfProcess.item_key);
COMMIT;
END LOOP;
END;
/* HUB Standard Approval Process */
DECLARE
CURSOR deleteProcess IS
SELECT item_type, item_key
FROM wf_items
WHERE end_date IS NULL
AND (ITEM_TYPE = 'XXHUBSTD' OR PARENT_ITEM_TYPE = 'XXHUBSTD') /*HUB Standard Approval Process*/
-- and ITEM_KEY = 'put_here_item_key_for PO'
AND BEGIN_DATE < SYSDATE - 80;
BEGIN
FOR wfProcess IN deleteProcess
LOOP
wf_engine.AbortProcess (wfProcess.item_type, wfProcess.item_key);
COMMIT;
END LOOP;
END;
/* Expenses*/
DECLARE
CURSOR deleteProcess IS
SELECT *
FROM wf_items
WHERE end_date IS NULL
AND (ITEM_TYPE = 'APEXP' OR PARENT_ITEM_TYPE = 'APEXP') /*Expenses*/
--and ROOT_ACTIVITY not like '%ERROR%'
AND BEGIN_DATE < SYSDATE - 80;
BEGIN
FOR wfProcess IN deleteProcess
LOOP
wf_engine.AbortProcess (wfProcess.item_type, wfProcess.item_key);
COMMIT;
END LOOP;
END;
/* XXTG ARF Approval */
DECLARE
CURSOR deleteProcess IS
SELECT *
FROM wf_items
WHERE end_date IS NULL
AND (ITEM_TYPE = 'XXOTFAPP' OR PARENT_ITEM_TYPE = 'XXOTFAPP') /*XXTG ARF Approval*/
--and ROOT_ACTIVITY not like '%ERROR%'
AND BEGIN_DATE < SYSDATE - 80;
BEGIN
FOR wfProcess IN deleteProcess
LOOP
wf_engine.AbortProcess (wfProcess.item_type, wfProcess.item_key);
COMMIT;
END LOOP;
END;