I was calling WF_ENGINE.ABORTPROCESS to cancel the Workflow Process in some business scenarios.
I have received the above error few times then realized that if the given Workflow process in completed already and you were trying to cancel the same.
So the workaround could be , call the WF_ENGINE.ITEMSTATUS standard workflow API and get the given workflow status, and if it is in ACTIVE state then CANCEL else do not. Possible values returned for the status are: ACTIVE, COMPLETE, ERROR, or SUSPENDED.
PL/SQL Syntax
procedure ItemStatus
(itemtype in varchar2, itemkey in varchar2, status out varchar2, result out varchar2);
——————————————————————————————-
Sample Call would be:
wf_engine.ItemStatus ( itemtype => itemtype
, itemkey => itemkey
, status => status
, result => result
);
dbms_output.put_line(stat);
if status = ‘ACTIVE’ then
..
elsif status <> ‘ACTIVE’ then
..
end if;
——————————————————————————————-
Thanks,
Senthil
