[Home] [Help]
PACKAGE BODY: APPS.HXC_APC_SHD
Source
1 Package Body hxc_apc_shd as
2 /* $Header: hxcapcrhi.pkb 120.2 2005/09/23 08:04:24 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_apc_shd.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 Begin
17 --
18 Return (nvl(g_api_dml, false));
19 --
20 End return_api_dml_status;
21 --
22 -- ----------------------------------------------------------------------------
23 -- |---------------------------< constraint_error >---------------------------|
24 -- ----------------------------------------------------------------------------
25 Procedure constraint_error
26 (p_constraint_name in all_constraints.constraint_name%TYPE
27 ) Is
28 --
29 l_proc varchar2(72) := g_package||'constraint_error';
30 --
31 Begin
32 --
33 If (p_constraint_name = 'HXC_APPROVAL_PERIOD_COMPS_FK1') Then
34 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
35 fnd_message.set_token('PROCEDURE', l_proc);
36 fnd_message.set_token('STEP','5');
37 fnd_message.raise_error;
38 ElsIf (p_constraint_name = 'HXC_APPROVAL_PERIOD_COMPS_FK2') Then
39 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
40 fnd_message.set_token('PROCEDURE', l_proc);
41 fnd_message.set_token('STEP','10');
42 fnd_message.raise_error;
43 ElsIf (p_constraint_name = 'HXC_APPROVAL_PERIOD_COMPS_FK3') Then
44 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
45 fnd_message.set_token('PROCEDURE', l_proc);
46 fnd_message.set_token('STEP','15');
47 fnd_message.raise_error;
48 ElsIf (p_constraint_name = 'HXC_APPROVAL_PERIOD_COMPS_PK') Then
49 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
50 fnd_message.set_token('PROCEDURE', l_proc);
51 fnd_message.set_token('STEP','20');
52 fnd_message.raise_error;
53 ElsIf (p_constraint_name = 'HXC_APPROVAL_PERIOD_COMPS_U1') Then
54 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
55 fnd_message.set_token('PROCEDURE', l_proc);
56 fnd_message.set_token('STEP','25');
57 fnd_message.raise_error;
58 Else
59 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
60 fnd_message.set_token('PROCEDURE', l_proc);
61 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
62 fnd_message.raise_error;
63 End If;
64 --
65 End constraint_error;
66 --
67 -- ----------------------------------------------------------------------------
68 -- |-----------------------------< api_updating >-----------------------------|
69 -- ----------------------------------------------------------------------------
70 Function api_updating
71 (p_approval_period_comp_id in number
72 ,p_object_version_number in number
73 )
74 Return Boolean Is
75 --
76 --
77 -- Cursor selects the 'current' row from the HR Schema
78 --
79 Cursor C_Sel1 is
80 select
81 approval_period_comp_id
82 ,time_recipient_id
83 ,recurring_period_id
84 ,approval_period_set_id
85 ,object_version_number
86 from hxc_approval_period_comps
87 where approval_period_comp_id = p_approval_period_comp_id;
88 --
89 l_fct_ret boolean;
90 --
91 Begin
92 --
93 If (p_approval_period_comp_id is null and
94 p_object_version_number is null
95 ) Then
96 --
97 -- One of the primary key arguments is null therefore we must
98 -- set the returning function value to false
99 --
100 l_fct_ret := false;
101 Else
102 If (p_approval_period_comp_id
103 = hxc_apc_shd.g_old_rec.approval_period_comp_id and
104 p_object_version_number
105 = hxc_apc_shd.g_old_rec.object_version_number
106 ) Then
107 --
108 -- The g_old_rec is current therefore we must
109 -- set the returning function to true
110 --
111 l_fct_ret := true;
112 Else
113 --
114 -- Select the current row into g_old_rec
115 --
116 Open C_Sel1;
117 Fetch C_Sel1 Into hxc_apc_shd.g_old_rec;
118 If C_Sel1%notfound Then
119 Close C_Sel1;
120 --
121 -- The primary key is invalid therefore we must error
122 --
123 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
124 fnd_message.raise_error;
125 End If;
126 Close C_Sel1;
127 If (p_object_version_number
128 <> hxc_apc_shd.g_old_rec.object_version_number) Then
129 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
130 fnd_message.raise_error;
131 End If;
132 l_fct_ret := true;
133 End If;
134 End If;
135 Return (l_fct_ret);
136 --
137 End api_updating;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |---------------------------------< lck >----------------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure lck
143 (p_approval_period_comp_id in number
144 ,p_object_version_number in number
145 ) is
146 --
147 -- Cursor selects the 'current' row from the HR Schema
148 --
149 Cursor C_Sel1 is
150 select
151 approval_period_comp_id
152 ,time_recipient_id
153 ,recurring_period_id
154 ,approval_period_set_id
155 ,object_version_number
156 from hxc_approval_period_comps
157 where approval_period_comp_id = p_approval_period_comp_id
158 for update nowait;
159 --
160 l_proc varchar2(72);
161 --
162 Begin
163 g_debug:=hr_utility.debug_enabled;
164 if g_debug then
165 l_proc := g_package||'lck';
166 hr_utility.set_location('Entering:'||l_proc, 5);
167 end if;
168 --
169 hr_api.mandatory_arg_error
170 (p_api_name => l_proc
171 ,p_argument => 'APPROVAL_PERIOD_COMP_ID'
172 ,p_argument_value => p_approval_period_comp_id
173 );
174 --
175 Open C_Sel1;
176 Fetch C_Sel1 Into hxc_apc_shd.g_old_rec;
177 If C_Sel1%notfound then
178 Close C_Sel1;
179 --
180 -- The primary key is invalid therefore we must error
181 --
182 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
183 fnd_message.raise_error;
184 End If;
185 Close C_Sel1;
186 If (p_object_version_number
187 <> hxc_apc_shd.g_old_rec.object_version_number) Then
188 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
189 fnd_message.raise_error;
190 End If;
191 --
192 if g_debug then
193 hr_utility.set_location(' Leaving:'||l_proc, 10);
194 end if;
195 --
196 -- We need to trap the ORA LOCK exception
197 --
198 Exception
199 When HR_Api.Object_Locked then
200 --
201 -- The object is locked therefore we need to supply a meaningful
202 -- error message.
203 --
204 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
205 fnd_message.set_token('TABLE_NAME', 'hxc_approval_period_comps');
206 fnd_message.raise_error;
207 End lck;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |-----------------------------< convert_args >-----------------------------|
211 -- ----------------------------------------------------------------------------
212 Function convert_args
213 (p_approval_period_comp_id in number
214 ,p_time_recipient_id in number
215 ,p_recurring_period_id in number
216 ,p_approval_period_set_id in number
217 ,p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 --
223 Begin
224 --
225 -- Convert arguments into local l_rec structure.
226 --
227 l_rec.approval_period_comp_id := p_approval_period_comp_id;
228 l_rec.time_recipient_id := p_time_recipient_id;
229 l_rec.recurring_period_id := p_recurring_period_id;
230 l_rec.approval_period_set_id := p_approval_period_set_id;
231 l_rec.object_version_number := p_object_version_number;
232 --
233 -- Return the plsql record structure.
234 --
235 Return(l_rec);
236 --
237 End convert_args;
238 --
239 end hxc_apc_shd;
240