Oracle Workflow Developer's Guide Release 2.6.3 Part Number B10284-02 |
![]() |
![]() |
![]() |
![]() |
![]() |
||
Previous | Next | Contents | Index | Glossary |
Result Type
This activity expects a result of 'Yes' or 'No' when the procedure completes to indicate whether the approver has the authority to approve the requisition. These result values are defined in the lookup type called Yes/No, associated with the Standard item type.
PL/SQL Stored Procedure
The PL/SQL stored procedure that this function activity calls is described in detail below. Each section in the procedure is numbered with the notation 1-> for easy referencing. We also use the convention 'l_' to identify local arguments used within the procedure.
procedure VerifyAuthority (itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out varchar2) is
1-> l_forward_to_username varchar2(320);
l_requisition_amount number;
l_spending_limit number;
2-> begin
if (funcmode = 'RUN') then
l_requisition_amount := wf_engine.GetItemAttrNumber (
itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_AMOUNT');
3-> l_forward_to_username := wf_engine.GetItemAttrText (
itemtype => itemtype,
itemkey => itemkey,
aname => 'FORWARD_TO_USERNAME');
4-> if (wf_reqdemo.checkSpendingLimit(l_forward_to_username,
l_requisition_amount)) then
resultout :='COMPLETE:Y';
else
resultout :='COMPLETE:N';
end if;
end if;
5-> if (funcmode = 'CANCEL') then
resultout :='COMPLETE:';
return;
end if;
6-> if (funcmode = 'TIMEOUT') then
resultout :='COMPLETE:';
return;
end if;
7-> exception
when others then
wf_core.context('WF_REQDEMO', 'VerifyAuthority', itemtype,
itemkey, actid, funcmode);
raise;
8-> end VerifyAuthority;
1-> The local arguments l_forward_to_username, l_requisition_amount, and l_spending_limit are declared in this section.
2-> If the value of funcmode is equal to RUN, then assign l_requisition_amount to the value of the REQUISITION_AMOUNT item type attribute, determined by calling the Workflow Engine API GetItemAttrNumber. See: GetItemAttribute, Oracle Workflow API Reference.
3-> This section assigns l_forward_to_username to the value of the FORWARD_TO_USERNAME item type attribute, determined by calling the Workflow Engine API GetItemAttrText.
4-> This section calls the function CheckSpendingLimit for the current approver to determine whether the requisition amount is less than or equal to the approver's spending limit. If the requisition amount is less than or equal to the value in l_spending_limit, meaning the approver has authority to approve, then assign resultout to be COMPLETE:Y. Otherwise, assign resultout to be COMPLETE:N.
5-> If the value of funcmode is CANCEL, then assign resultout to be COMPLETE:.
6-> If the value of funcmode is TIMEOUT, then assign resultout to be COMPLETE:.
7-> This section calls WF_CORE.CONTEXT if an exception occurs, to include context information in the error stack to help you locate the source of an error. See: CONTEXT, Oracle Workflow API Reference.
8-> This section marks the end of the procedure.
Previous | Next | Contents | Index | Glossary |