DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ORU_SHD

Source


1 Package Body hr_oru_shd as
2 /* $Header: hrorurhi.pkb 120.2.12020000.2 2012/09/24 09:57:10 swrajapa ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_oru_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc    varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'HR_ORGANIZATION_UNITS_FK1') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'HR_ORGANIZATION_UNITS_FK2') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'HR_ORGANIZATION_UNITS_FK3') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   ElsIf (p_constraint_name = 'HR_ORGANIZATION_UNITS_FK4') Then
48     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('STEP','20');
51     fnd_message.raise_error;
52   ElsIf (p_constraint_name = 'HR_ORGANIZATION_UNITS_PK') Then
53     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
54     fnd_message.set_token('PROCEDURE', l_proc);
55     fnd_message.set_token('STEP','25');
56     fnd_message.raise_error;
57   ElsIf (p_constraint_name = 'HR_ORGANIZATION_UNITS_UK2') Then
58     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
59     fnd_message.set_token('PROCEDURE', l_proc);
60     fnd_message.set_token('STEP','30');
61     fnd_message.raise_error;
62   ElsIf (p_constraint_name = 'HR_OU_INTERNAL_EXTERNAL_FL_CHK') Then
63     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
64     fnd_message.set_token('PROCEDURE', l_proc);
65     fnd_message.set_token('STEP','35');
66     fnd_message.raise_error;
67   Else
68     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
69     fnd_message.set_token('PROCEDURE', l_proc);
70     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
71     fnd_message.raise_error;
72   End If;
73   --
74 End constraint_error;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |-----------------------------< api_updating >-----------------------------|
78 -- ----------------------------------------------------------------------------
79 Function api_updating
80   (p_organization_id                      in     number
81   ,p_object_version_number                in     number
82   )
83   Return Boolean Is
84 --
85   --
86   -- Cursor selects the 'current' row from the HR Schema
87   --
88   Cursor C_Sel1 is
89     select
90        organization_id
91       ,business_group_id
92       ,cost_allocation_keyflex_id
93       ,location_id
94       ,soft_coding_keyflex_id
95       ,date_from
96       ,name
97       ,comments
98       ,date_to
99       ,internal_external_flag
100       ,internal_address_line
101       ,type
102       ,request_id
103       ,program_application_id
104       ,program_id
105       ,program_update_date
106       ,attribute_category
107       ,attribute1
108       ,attribute2
109       ,attribute3
110       ,attribute4
111       ,attribute5
112       ,attribute6
113       ,attribute7
114       ,attribute8
115       ,attribute9
116       ,attribute10
117       ,attribute11
118       ,attribute12
119       ,attribute13
120       ,attribute14
121       ,attribute15
122       ,attribute16
123       ,attribute17
124       ,attribute18
125       ,attribute19
126       ,attribute20
127       -- Enhancement 4040086
128       ,attribute21
129       ,attribute22
130       ,attribute23
131       ,attribute24
132       ,attribute25
133       ,attribute26
134       ,attribute27
135       ,attribute28
136       ,attribute29
137       ,attribute30
138       -- End Enhancement 4040086
139       ,object_version_number
140     from hr_all_organization_units
141     where   organization_id = p_organization_id;
142 --
143   l_fct_ret boolean;
144 --
145 Begin
146   --
147   If (p_organization_id is null and
148       p_object_version_number is null
149      ) Then
150     --
151     -- One of the primary key arguments is null therefore we must
152     -- set the returning function value to false
153     --
154     l_fct_ret := false;
155   Else
156     If (p_organization_id
157         = hr_oru_shd.g_old_rec.organization_id and
158         p_object_version_number
159         = hr_oru_shd.g_old_rec.object_version_number
160        ) Then
161       --
162       -- The g_old_rec is current therefore we must
163       -- set the returning function to true
164       --
165       l_fct_ret := true;
166     Else
167       --
168       -- Select the current row into g_old_rec
169       --
170       Open C_Sel1;
171       Fetch C_Sel1 Into hr_oru_shd.g_old_rec;
172       If C_Sel1%notfound Then
173         Close C_Sel1;
174         --
175         -- The primary key is invalid therefore we must error
176         --
177         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
178         fnd_message.raise_error;
179       End If;
180       Close C_Sel1;
181       If (p_object_version_number
182           <> hr_oru_shd.g_old_rec.object_version_number) Then
183         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
184         fnd_message.raise_error;
185       End If;
186       l_fct_ret := true;
187     End If;
188   End If;
189   Return (l_fct_ret);
190 --
191 End api_updating;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |---------------------------------< lck >----------------------------------|
195 -- ----------------------------------------------------------------------------
196 Procedure lck
197   (p_organization_id                      in     number
198   ,p_object_version_number                in     number
199   ) is
200 --
201 -- Cursor selects the 'current' row from the HR Schema
202 --
203   Cursor C_Sel1 is
204     select
205        organization_id
206       ,business_group_id
207       ,cost_allocation_keyflex_id
208       ,location_id
209       ,soft_coding_keyflex_id
210       ,date_from
211       ,name
212       ,comments
213       ,date_to
214       ,internal_external_flag
215       ,internal_address_line
216       ,type
217       ,request_id
218       ,program_application_id
219       ,program_id
220       ,program_update_date
221       ,attribute_category
222       ,attribute1
223       ,attribute2
224       ,attribute3
225       ,attribute4
226       ,attribute5
227       ,attribute6
228       ,attribute7
229       ,attribute8
230       ,attribute9
231       ,attribute10
232       ,attribute11
233       ,attribute12
234       ,attribute13
235       ,attribute14
236       ,attribute15
237       ,attribute16
238       ,attribute17
239       ,attribute18
240       ,attribute19
241       ,attribute20
242     -- Enhancement 4040086
243       ,attribute21
244       ,attribute22
245       ,attribute23
246       ,attribute24
247       ,attribute25
248       ,attribute26
249       ,attribute27
250       ,attribute28
251       ,attribute29
252       ,attribute30
253       -- End Enhancement 4040086
254       ,object_version_number
255     from hr_all_organization_units
256     where   organization_id = p_organization_id
257     for  update nowait;
258 --
259   l_proc varchar2(72) := g_package||'lck';
260 --
261 Begin
262   hr_utility.set_location('Entering:'||l_proc, 5);
263   --
264   hr_api.mandatory_arg_error
265     (p_api_name           => l_proc
266     ,p_argument           => 'ORGANIZATION_ID'
267     ,p_argument_value     => p_organization_id
268     );
269   --Bug 1790746 Fix Start.
270   hr_api.mandatory_arg_error(p_api_name => l_proc
271                  ,p_argument  => 'object_version_number'
272                  ,p_argument_value => p_object_version_number);
273   -- Bug 1790746 Fix End.
274   Open  C_Sel1;
275   Fetch C_Sel1 Into hr_oru_shd.g_old_rec;
276   If C_Sel1%notfound then
277     Close C_Sel1;
278     --
279     -- The primary key is invalid therefore we must error
280     --
281     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
282     fnd_message.raise_error;
283   End If;
284   Close C_Sel1;
285   If (p_object_version_number
286       <> hr_oru_shd.g_old_rec.object_version_number) Then
287         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
288         fnd_message.raise_error;
289   End If;
290   --
291   hr_utility.set_location(' Leaving:'||l_proc, 10);
292   --
293   -- We need to trap the ORA LOCK exception
294   --
295 Exception
296   When HR_Api.Object_Locked then
297     --
298     -- The object is locked therefore we need to supply a meaningful
299     -- error message.
300     --
301     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
302     fnd_message.set_token('TABLE_NAME', 'hr_all_organization_units');
303     fnd_message.raise_error;
304 End lck;
305 --
306 -- ----------------------------------------------------------------------------
307 -- |-----------------------------< convert_args >-----------------------------|
308 -- ----------------------------------------------------------------------------
309 Function convert_args
310   (p_organization_id                in number
311   ,p_business_group_id              in number
312   ,p_cost_allocation_keyflex_id     in number
313   ,p_location_id                    in number
314   ,p_soft_coding_keyflex_id         in number
315   ,p_date_from                      in date
316   ,p_name                           in varchar2
317   ,p_comments                       in varchar2
318   ,p_date_to                        in date
319   ,p_internal_external_flag         in varchar2
320   ,p_internal_address_line          in varchar2
321   ,p_type                           in varchar2
322   ,p_request_id                     in number
323   ,p_program_application_id         in number
324   ,p_program_id                     in number
325   ,p_program_update_date            in date
326   ,p_attribute_category             in varchar2
327   ,p_attribute1                     in varchar2
328   ,p_attribute2                     in varchar2
329   ,p_attribute3                     in varchar2
330   ,p_attribute4                     in varchar2
331   ,p_attribute5                     in varchar2
332   ,p_attribute6                     in varchar2
333   ,p_attribute7                     in varchar2
334   ,p_attribute8                     in varchar2
335   ,p_attribute9                     in varchar2
336   ,p_attribute10                    in varchar2
337   ,p_attribute11                    in varchar2
338   ,p_attribute12                    in varchar2
339   ,p_attribute13                    in varchar2
340   ,p_attribute14                    in varchar2
341   ,p_attribute15                    in varchar2
342   ,p_attribute16                    in varchar2
343   ,p_attribute17                    in varchar2
344   ,p_attribute18                    in varchar2
345   ,p_attribute19                    in varchar2
346   ,p_attribute20                    in varchar2
347   -- Enhancement 4040086
348   ,p_attribute21                    in varchar2
349   ,p_attribute22                    in varchar2
350   ,p_attribute23                    in varchar2
351   ,p_attribute24                    in varchar2
352   ,p_attribute25                    in varchar2
353   ,p_attribute26                    in varchar2
354   ,p_attribute27                    in varchar2
355   ,p_attribute28                    in varchar2
356   ,p_attribute29                    in varchar2
357   ,p_attribute30                    in varchar2
358   -- End Enhancement 4040086
359   ,p_object_version_number          in number
360   )
361   Return g_rec_type is
362 --
363   l_rec   g_rec_type;
364 --
365 Begin
366   --
367   -- Convert arguments into local l_rec structure.
368   --
369   l_rec.organization_id                  := p_organization_id;
370   l_rec.business_group_id                := p_business_group_id;
371   l_rec.cost_allocation_keyflex_id       := p_cost_allocation_keyflex_id;
372   l_rec.location_id                      := p_location_id;
373   l_rec.soft_coding_keyflex_id           := p_soft_coding_keyflex_id;
374   l_rec.date_from                        := p_date_from;
375   l_rec.name                             := p_name;
376   l_rec.comments                         := p_comments;
377   l_rec.date_to                          := p_date_to;
378   l_rec.internal_external_flag           := p_internal_external_flag;
379   l_rec.internal_address_line            := p_internal_address_line;
380   l_rec.type                             := p_type;
381   l_rec.request_id                       := p_request_id;
382   l_rec.program_application_id           := p_program_application_id;
383   l_rec.program_id                       := p_program_id;
384   l_rec.program_update_date              := p_program_update_date;
385   l_rec.attribute_category               := p_attribute_category;
386   l_rec.attribute1                       := p_attribute1;
387   l_rec.attribute2                       := p_attribute2;
388   l_rec.attribute3                       := p_attribute3;
389   l_rec.attribute4                       := p_attribute4;
390   l_rec.attribute5                       := p_attribute5;
391   l_rec.attribute6                       := p_attribute6;
392   l_rec.attribute7                       := p_attribute7;
393   l_rec.attribute8                       := p_attribute8;
394   l_rec.attribute9                       := p_attribute9;
395   l_rec.attribute10                      := p_attribute10;
396   l_rec.attribute11                      := p_attribute11;
397   l_rec.attribute12                      := p_attribute12;
398   l_rec.attribute13                      := p_attribute13;
399   l_rec.attribute14                      := p_attribute14;
400   l_rec.attribute15                      := p_attribute15;
401   l_rec.attribute16                      := p_attribute16;
402   l_rec.attribute17                      := p_attribute17;
403   l_rec.attribute18                      := p_attribute18;
404   l_rec.attribute19                      := p_attribute19;
405   l_rec.attribute20                      := p_attribute20;
406   -- Enhancement 4040086
407   l_rec.attribute21                      := p_attribute21;
408   l_rec.attribute22                      := p_attribute22;
409   l_rec.attribute23                      := p_attribute23;
410   l_rec.attribute24                      := p_attribute24;
411   l_rec.attribute25                      := p_attribute25;
412   l_rec.attribute26                      := p_attribute26;
413   l_rec.attribute27                      := p_attribute27;
414   l_rec.attribute28                      := p_attribute28;
415   l_rec.attribute29                      := p_attribute29;
416   l_rec.attribute30                      := p_attribute30;
417   -- End Enhancement 4040086
418   l_rec.object_version_number            := p_object_version_number;
419   --
420   -- Return the plsql record structure.
421   --
422   Return(l_rec);
423 --
424 End convert_args;
425 --
426 end hr_oru_shd;