Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
DECLARE
CURSOR potoreset is
SELECT wf_item_type, wf_item_key, po_header_id, segment1,
revision_num, type_lookup_code
FROM po_headers_all
WHERE segment1 = '&po_number'
and org_id = &org_id
and authorization_status IN ('IN PROCESS', 'PRE-APPROVED')
and NVL(cancel_flag, 'N') = 'N'
and NVL(closed_code, 'OPEN') != 'FINALLY_CLOSED';
submitseq po_action_history.sequence_num%type;
nullseq po_action_history.sequence_num%type;
BEGIN
dbms_output.put_line('------------------------------------');
dbms_output.put_line('Data Manipulation Scripts Disclaimer');
dbms_output.put_line('------------------------------------');
dbms_output.put_line('As always please ask customer to run the scripts on their
test instance first ');
dbms_output.put_line('before applying it on production. Make sure the data is
validated for ');
dbms_output.put_line('correctness and related functionality is verified after the
script has been ');
dbms_output.put_line('run on a test instance. Customer is responsible to
authenticate and verify ');
dbms_output.put_line('correctness of data manipulation scripts.');
dbms_output.put_line('Closing Notifications...');
BEGIN
EXCEPTION
WHEN OTHERS THEN
null;
END;
dbms_output.put_line('Aborting Workflow...');
BEGIN
WF_Engine.AbortProcess(pos.wf_item_type, pos.wf_item_key);
EXCEPTION
WHEN OTHERS THEN
null;
END;
dbms_output.put_line('Updating PO Status...');
UPDATE po_headers_all
set authorization_status = decode(pos.revision_num, 0, 'INCOMPLETE',
'REQUIRES REAPPROVAL'),
wf_item_type = NULL,
wf_item_key = NULL,
approved_flag = decode(pos.revision_num, 0, 'N', 'R')
where po_header_id = pos.po_header_id;
dbms_output.put_line('Done Processing.');
dbms_output.put_line('................');
dbms_output.put_line('Please issue commit, if no errors found.');
END LOOP;
END;
/