DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APPROVAL_STATUS_PKG

Source


1 package body hxc_approval_status_pkg as
2 /* $Header: hxcapvst.pkb 120.4.12000000.3 2007/04/09 05:27:44 rchennur ship $ */
3 --
4 g_debug	boolean	:=hr_utility.debug_enabled;
5 --
6 -- procedure
7 --   update_status
8 --
9 -- description
10 --   Wrapper procedure the updates the status of an APPLICATION PERIOD
11 --   building block. Performs a validation to check if the correct
12 --   Time Building Block is being updated. Calls the Workflow to transisition
13 --   to HXC_APP_SET_PERIODS node.
14 -- parameters
15 --	      p_approvals     -PL/SQL Type holding item_type,key,aprv_comments.
16 --            p_aprv_status   - new status of approval form row
17 --
18 --
19 PROCEDURE update_status
20             (p_approvals   in APPROVAL_REC_TABLE_TYPE,
21 	     p_aprv_status in VARCHAR2) IS
22 --
23 --
24 l_index Number;
25 
26 BEGIN
27 
28 l_index := p_approvals.first;
29 
30 WHILE p_approvals.exists(l_index)
31   LOOP
32   Begin
33 	--
34 	-- Set Approval Status
35 	--
36 	wf_engine.SetItemAttrText(itemtype  => p_approvals(l_index).item_type,
37                           itemkey   => p_approvals(l_index).item_key,
38                           aname     => 'APPROVAL_STATUS',
39                           avalue    =>  p_aprv_status);
40 	-- Set Comments
41 	--
42 	wf_engine.SetItemAttrText(itemtype  => p_approvals(l_index).item_type,
43                           itemkey   => p_approvals(l_index).item_key,
44                           aname     => 'APR_REJ_REASON',
45                           avalue    =>  p_approvals(l_index).aprv_comments);
46 	--
47 	-- hr_utility.trace('Completing activity');
48 	--
49 	-- Check that there is a NOTIFIED activity to complete.
50 	--
51 	   wf_engine.CompleteActivityInternalName
52 	       (itemtype    => p_approvals(l_index).item_type
53 	       ,itemkey     => p_approvals(l_index).item_key
54 	       ,activity    => 'APPROVAL_NOTIFICATION:TC_APR_NOTIFICATION'
55 	       ,result      => p_aprv_status);       -- not using a result code
56 
57 	--
58 	-- hr_utility.trace('Completed activity');
59 	--
60 	--
61 Exception
62    When others then
63    -- Probably errored with XXXX is not a notified activity for HXCEMP/XXXXX
64    -- Try the other notification
65    wf_engine.CompleteActivityInternalName
66        (itemtype    => p_approvals(l_index).item_type
67        ,itemkey     => p_approvals(l_index).item_key
68        ,activity    => 'FIND_AND_NOTIFY_APPROVERS:TC_APR_NOTIFICATION'
69        ,result      => p_aprv_status);
70 END;
71 l_index := p_approvals.next(l_index);
72 END LOOP;
73 
74 END update_status;
75 --
76 END hxc_approval_status_pkg;