Sunday, June 23, 2013

Purging errored workflow items ib EBS R12


CREATE OR REPLACE procedure APPS.XX_PURGE_Error_WF_ITEMS (errbuf OUT NOCOPY VARCHAR2,retcode OUT NOCOPY NUMBER)
as
v_Commit NUMBER:=0;
v_commit1 NUMBER:=0;
CURSOR wf_error IS
SELECT item_key
FROM wf_items
WHERE item_type = 'WFERROR'
AND end_date is null;
Begin
/*Aborting errored workflows*/
FOR i IN wf_error LOOP
WF_ENGINE.abortProcess('WFERROR', i.item_key);
END LOOP;
    v_commit:=v_commit1+1;
    IF v_commit=5000 THEN
    v_commit1:=0;
    COMMIT;
    end if;
/*Purging errored work flow item types*/
FOR cur IN   (SELECT wi.item_key     --,WIS.BEGIN_DATE
                      FROM wf_items wi ,wf_item_activity_statuses  wis
                      WHERE wi.item_type LIKE '%WFERROR%'
                      AND wi.end_date IS NOT NULL
                      AND wis.item_key=wi.item_key
                      AND wis.item_type=wi.item_type)
  loop
    wf_purge.items ('WFERROR',cur.item_key,SYSDATE,FALSE,TRUE);
    v_commit1:=v_commit1+1;
    IF v_commit1=5000 THEN
    v_commit1:=0;
    COMMIT;
    END IF;
  END loop;
END;
/

No comments:

Post a Comment