[Home] [Help]
PACKAGE BODY: APPS.PQH_BGT_SHD
Source
1 Package Body pqh_bgt_shd as
2 /* $Header: pqbgtrhi.pkb 120.1 2005/09/21 03:11:10 hmehta noship $ */
3 --
4 -- ---------------------------------------------------------------------------+
5 -- | Private Global Definitions |
6 -- ---------------------------------------------------------------------------+
7 --
8 g_package varchar2(33) := ' pqh_bgt_shd.'; -- Global package name
9 --
10 --
11 -- ---------------------------------------------------------------------------+
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ---------------------------------------------------------------------------+
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'AVCON_21709591_TRANS_000') Then
23 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
24 hr_utility.set_message_token('PROCEDURE', l_proc);
25 hr_utility.set_message_token('STEP','5');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'PQH_BUDGETS_FK1') Then
28 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','10');
31 hr_utility.raise_error;
32 ElsIf (p_constraint_name = 'PQH_BUDGETS_FK2') Then
33 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('STEP','15');
36 hr_utility.raise_error;
37 ElsIf (p_constraint_name = 'PQH_BUDGETS_FK3') Then
38 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('STEP','20');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'PQH_BUDGETS_FK4') Then
43 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
44 hr_utility.set_message_token('PROCEDURE', l_proc);
45 hr_utility.set_message_token('STEP','25');
46 hr_utility.raise_error;
47 ElsIf (p_constraint_name = 'PQH_BUDGETS_FK5') Then
48 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
49 hr_utility.set_message_token('PROCEDURE', l_proc);
50 hr_utility.set_message_token('STEP','30');
51 hr_utility.raise_error;
52 ElsIf (p_constraint_name = 'PQH_BUDGETS_PK') Then
53 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
54 hr_utility.set_message_token('PROCEDURE', l_proc);
55 hr_utility.set_message_token('STEP','35');
56 hr_utility.raise_error;
57 Else
58 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
59 hr_utility.set_message_token('PROCEDURE', l_proc);
60 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
61 hr_utility.raise_error;
62 End If;
63 --
64 hr_utility.set_location(' Leaving:'||l_proc, 10);
65 End constraint_error;
66 --
67 -- ----------------------------------------------------------------------------+
68 -- |-----------------------------< api_updating >-----------------------------|
69 -- ----------------------------------------------------------------------------+
70 Function api_updating
71 (
72 p_budget_id in number,
73 p_object_version_number in number
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 budget_id,
82 business_group_id,
83 start_organization_id,
84 org_structure_version_id,
85 budgeted_entity_cd,
86 budget_style_cd,
87 budget_name,
88 period_set_name,
89 budget_start_date,
90 budget_end_date,
91 gl_budget_name,
92 psb_budget_flag,
93 transfer_to_gl_flag,
94 transfer_to_grants_flag,
95 status,
96 object_version_number,
97 budget_unit1_id,
98 budget_unit2_id,
99 budget_unit3_id,
100 gl_set_of_books_id,
101 budget_unit1_aggregate,
102 budget_unit2_aggregate,
103 budget_unit3_aggregate,
104 position_control_flag ,
105 valid_grade_reqd_flag ,
106 currency_code,
107 dflt_budget_set_id
108 from pqh_budgets
109 where budget_id = p_budget_id;
110 --
111 l_proc varchar2(72) := g_package||'api_updating';
112 l_fct_ret boolean;
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 If (
118 p_budget_id is null and
119 p_object_version_number is null
120 ) Then
121 --
122 -- One of the primary key arguments is null therefore we must
123 -- set the returning function value to false
124 --
125 l_fct_ret := false;
126 Else
127 If (
128 p_budget_id = g_old_rec.budget_id and
129 p_object_version_number = g_old_rec.object_version_number
130 ) Then
131 hr_utility.set_location(l_proc, 10);
132 --
133 -- The g_old_rec is current therefore we must
134 -- set the returning function to true
135 --
136 l_fct_ret := true;
137 Else
138 --
139 -- Select the current row into g_old_rec
140 --
141 Open C_Sel1;
142 Fetch C_Sel1 Into g_old_rec;
143 If C_Sel1%notfound Then
144 Close C_Sel1;
145 --
146 -- The primary key is invalid therefore we must error
147 --
148 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
149 hr_utility.raise_error;
150 End If;
151 Close C_Sel1;
152 If (p_object_version_number <> g_old_rec.object_version_number) Then
153 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
154 hr_utility.raise_error;
155 End If;
156 hr_utility.set_location(l_proc, 15);
157 l_fct_ret := true;
158 End If;
159 End If;
160 hr_utility.set_location(' Leaving:'||l_proc, 20);
161 Return (l_fct_ret);
162 --
163 End api_updating;
164 --
165 -- ----------------------------------------------------------------------------+
166 -- |---------------------------------< lck >----------------------------------|
167 -- ----------------------------------------------------------------------------+
168 Procedure lck
169 (
170 p_budget_id in number,
171 p_object_version_number in number
172 ) is
173 --
174 -- Cursor selects the 'current' row from the HR Schema
175 --
176 Cursor C_Sel1 is
177 select budget_id,
178 business_group_id,
179 start_organization_id,
180 org_structure_version_id,
181 budgeted_entity_cd,
182 budget_style_cd,
183 budget_name,
184 period_set_name,
185 budget_start_date,
186 budget_end_date,
187 gl_budget_name,
188 psb_budget_flag,
189 transfer_to_gl_flag,
190 transfer_to_grants_flag,
191 status,
192 object_version_number,
193 budget_unit1_id,
194 budget_unit2_id,
195 budget_unit3_id,
196 gl_set_of_books_id,
197 budget_unit1_aggregate,
198 budget_unit2_aggregate,
199 budget_unit3_aggregate,
200 position_control_flag ,
201 valid_grade_reqd_flag ,
202 currency_code,
203 dflt_budget_set_id
204 from pqh_budgets
205 where budget_id = p_budget_id
206 for update nowait;
207 --
208 l_proc varchar2(72) := g_package||'lck';
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 5);
212 --
213 -- Add any mandatory argument checking here:
214 -- Example:
215 -- hr_api.mandatory_arg_error
216 -- (p_api_name => l_proc,
217 -- p_argument => 'object_version_number',
218 -- p_argument_value => p_object_version_number);
219 --
220 Open C_Sel1;
221 Fetch C_Sel1 Into g_old_rec;
222 If C_Sel1%notfound then
223 Close C_Sel1;
224 --
225 -- The primary key is invalid therefore we must error
226 --
227 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
228 hr_utility.raise_error;
229 End If;
230 Close C_Sel1;
231 If (p_object_version_number <> g_old_rec.object_version_number) Then
232 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
233 hr_utility.raise_error;
234 End If;
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
237 --
238 -- We need to trap the ORA LOCK exception
239 --
240 Exception
241 When HR_Api.Object_Locked then
242 --
243 -- The object is locked therefore we need to supply a meaningful
244 -- error message.
245 --
246 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
247 hr_utility.set_message_token('TABLE_NAME', 'pqh_budgets');
248 hr_utility.raise_error;
249 End lck;
250 --
251 -- ----------------------------------------------------------------------------+
252 -- |-----------------------------< convert_args >-----------------------------|
253 -- ----------------------------------------------------------------------------+
254 Function convert_args
255 (
256 p_budget_id in number,
257 p_business_group_id in number,
258 p_start_organization_id in number,
259 p_org_structure_version_id in number,
260 p_budgeted_entity_cd in varchar2,
261 p_budget_style_cd in varchar2,
262 p_budget_name in varchar2,
263 p_period_set_name in varchar2,
264 p_budget_start_date in date,
265 p_budget_end_date in date,
266 p_gl_budget_name in varchar2,
267 p_psb_budget_flag in varchar2,
268 p_transfer_to_gl_flag in varchar2,
269 p_transfer_to_grants_flag in varchar2,
270 p_status in varchar2,
271 p_object_version_number in number,
272 p_budget_unit1_id in number,
273 p_budget_unit2_id in number,
274 p_budget_unit3_id in number,
275 p_gl_set_of_books_id in number,
276 p_budget_unit1_aggregate in varchar2,
277 p_budget_unit2_aggregate in varchar2,
278 p_budget_unit3_aggregate in varchar2,
279 p_position_control_flag in varchar2,
280 p_valid_grade_reqd_flag in varchar2,
281 p_currency_code in varchar2,
282 p_dflt_budget_set_id in number
283 )
284 Return g_rec_type is
285 --
286 l_rec g_rec_type;
287 l_proc varchar2(72) := g_package||'convert_args';
288 --
289 Begin
290 --
291 hr_utility.set_location('Entering:'||l_proc, 5);
292 --
293 -- Convert arguments into local l_rec structure.
294 --
295 l_rec.budget_id := p_budget_id;
296 l_rec.business_group_id := p_business_group_id;
297 l_rec.start_organization_id := p_start_organization_id;
298 l_rec.org_structure_version_id := p_org_structure_version_id;
299 l_rec.budgeted_entity_cd := p_budgeted_entity_cd;
300 l_rec.budget_style_cd := p_budget_style_cd;
301 l_rec.budget_name := p_budget_name;
302 l_rec.period_set_name := p_period_set_name;
303 l_rec.budget_start_date := p_budget_start_date;
304 l_rec.budget_end_date := p_budget_end_date;
305 l_rec.gl_budget_name := p_gl_budget_name;
306 l_rec.psb_budget_flag := p_psb_budget_flag;
307 l_rec.transfer_to_gl_flag := p_transfer_to_gl_flag;
308 l_rec.transfer_to_grants_flag := p_transfer_to_grants_flag;
309 l_rec.status := p_status;
310 l_rec.object_version_number := p_object_version_number;
311 l_rec.budget_unit1_id := p_budget_unit1_id;
312 l_rec.budget_unit2_id := p_budget_unit2_id;
313 l_rec.budget_unit3_id := p_budget_unit3_id;
314 l_rec.gl_set_of_books_id := p_gl_set_of_books_id;
315 l_rec.budget_unit1_aggregate := p_budget_unit1_aggregate;
316 l_rec.budget_unit2_aggregate := p_budget_unit2_aggregate;
317 l_rec.budget_unit3_aggregate := p_budget_unit3_aggregate;
318 l_rec.position_control_flag := p_position_control_flag;
319 l_rec.valid_grade_reqd_flag := p_valid_grade_reqd_flag ;
320 l_rec.currency_code := p_currency_code;
321 l_rec.dflt_budget_set_id := p_dflt_budget_set_id;
322 --
323 -- Return the plsql record structure.
324 --
325 hr_utility.set_location(' Leaving:'||l_proc, 10);
326 Return(l_rec);
327 --
328 End convert_args;
329 --
330 end pqh_bgt_shd;