DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TPC_SHD

Source


1 Package Body ota_tpc_shd as
2 /* $Header: ottpcrhi.pkb 115.5 2003/06/17 14:27:43 sfmorris noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tpc_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc 	varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_FK1') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   ElsIf (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_FK2') Then
27     fnd_message.set_name('OTA', 'OTA_13828_TPC_NO_TRAINING_PLAN');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   ElsIf (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_FK3') Then
32     fnd_message.set_name('OTA', 'OTA_13829_TPC_NO_BOOKING');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_FK4') Then
37     fnd_message.set_name('OTA', 'OTA_13834_TPC_NO_EVENT');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
44     fnd_message.set_token('STEP','25');
41   ElsIf (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_PK') Then
42     fnd_message.set_name('OTA', 'OTA_13828_TPC_NO_TRAINING_PLAN');
43     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'OTA_TRAINING_PLAN_COSTS_UK2') Then
47     fnd_message.set_name('OTA', 'OTA_13837_TPC_BAD_UNIQUE_COST');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('STEP','30');
50     fnd_message.raise_error;
51   Else
52     fnd_message.set_name(801, 'HR_7877_API_INVALID_CONSTRAINT');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55     fnd_message.raise_error;
56   End If;
57   --
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (p_training_plan_cost_id                in     number
65   ,p_object_version_number                in     number
66   )
67   Return Boolean Is
68 --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74        training_plan_cost_id
75       ,tp_measurement_type_id
76       ,training_plan_id
77       ,booking_id
78       ,event_id
79       ,amount
80       ,currency_code
81       ,business_group_id
82       ,object_version_number
83       ,attribute_category
84       ,attribute1
85       ,attribute2
86       ,attribute3
87       ,attribute4
88       ,attribute5
89       ,attribute6
90       ,attribute7
91       ,attribute8
92       ,attribute9
93       ,attribute10
94       ,attribute11
95       ,attribute12
96       ,attribute13
97       ,attribute14
98       ,attribute15
99       ,attribute16
100       ,attribute17
101       ,attribute18
102       ,attribute19
103       ,attribute20
104       ,attribute21
105       ,attribute22
106       ,attribute23
107       ,attribute24
108       ,attribute25
109       ,attribute26
110       ,attribute27
111       ,attribute28
112       ,attribute29
113       ,attribute30
114       ,information_category
115       ,tp_cost_information1
116       ,tp_cost_information2
117       ,tp_cost_information3
118       ,tp_cost_information4
119       ,tp_cost_information5
120       ,tp_cost_information6
121       ,tp_cost_information7
122       ,tp_cost_information8
123       ,tp_cost_information9
124       ,tp_cost_information10
125       ,tp_cost_information11
126       ,tp_cost_information12
127       ,tp_cost_information13
128       ,tp_cost_information14
129       ,tp_cost_information15
130       ,tp_cost_information16
131       ,tp_cost_information17
132       ,tp_cost_information18
133       ,tp_cost_information19
134       ,tp_cost_information20
135       ,tp_cost_information21
136       ,tp_cost_information22
137       ,tp_cost_information23
138       ,tp_cost_information24
139       ,tp_cost_information25
140       ,tp_cost_information26
141       ,tp_cost_information27
142       ,tp_cost_information28
143       ,tp_cost_information29
144       ,tp_cost_information30
145     from	ota_training_plan_costs
146     where	training_plan_cost_id = p_training_plan_cost_id;
147 --
148   l_fct_ret	boolean;
149 --
150 Begin
151   --
152   If (p_training_plan_cost_id is null and
153       p_object_version_number is null
154      ) Then
155     --
156     -- One of the primary key arguments is null therefore we must
157     -- set the returning function value to false
158     --
159     l_fct_ret := false;
160   Else
161     If (p_training_plan_cost_id
162         = ota_tpc_shd.g_old_rec.training_plan_cost_id and
163         p_object_version_number
164         = ota_tpc_shd.g_old_rec.object_version_number
165        ) Then
166       --
167       -- The g_old_rec is current therefore we must
168       -- set the returning function to true
169       --
170       l_fct_ret := true;
171     Else
172       --
173       -- Select the current row into g_old_rec
174       --
175       Open C_Sel1;
176       Fetch C_Sel1 Into ota_tpc_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           <> ota_tpc_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       l_fct_ret := true;
192     End If;
193   End If;
194   Return (l_fct_ret);
195 --
196 End api_updating;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |---------------------------------< lck >----------------------------------|
200 -- ----------------------------------------------------------------------------
201 Procedure lck
202   (p_training_plan_cost_id                in     number
203   ,p_object_version_number                in     number
207 --
204   ) is
205 --
206 -- Cursor selects the 'current' row from the HR Schema
208   Cursor C_Sel1 is
209     select
210        training_plan_cost_id
211       ,tp_measurement_type_id
212       ,training_plan_id
213       ,booking_id
214       ,event_id
215       ,amount
216       ,currency_code
217       ,business_group_id
218       ,object_version_number
219       ,attribute_category
220       ,attribute1
221       ,attribute2
222       ,attribute3
223       ,attribute4
224       ,attribute5
225       ,attribute6
226       ,attribute7
227       ,attribute8
228       ,attribute9
229       ,attribute10
230       ,attribute11
231       ,attribute12
232       ,attribute13
233       ,attribute14
234       ,attribute15
235       ,attribute16
236       ,attribute17
237       ,attribute18
238       ,attribute19
239       ,attribute20
240       ,attribute21
241       ,attribute22
242       ,attribute23
243       ,attribute24
244       ,attribute25
245       ,attribute26
246       ,attribute27
247       ,attribute28
248       ,attribute29
249       ,attribute30
250       ,information_category
251       ,tp_cost_information1
252       ,tp_cost_information2
253       ,tp_cost_information3
254       ,tp_cost_information4
255       ,tp_cost_information5
256       ,tp_cost_information6
257       ,tp_cost_information7
258       ,tp_cost_information8
259       ,tp_cost_information9
260       ,tp_cost_information10
261       ,tp_cost_information11
262       ,tp_cost_information12
263       ,tp_cost_information13
264       ,tp_cost_information14
265       ,tp_cost_information15
266       ,tp_cost_information16
267       ,tp_cost_information17
268       ,tp_cost_information18
269       ,tp_cost_information19
270       ,tp_cost_information20
271       ,tp_cost_information21
272       ,tp_cost_information22
273       ,tp_cost_information23
274       ,tp_cost_information24
275       ,tp_cost_information25
276       ,tp_cost_information26
277       ,tp_cost_information27
278       ,tp_cost_information28
279       ,tp_cost_information29
280       ,tp_cost_information30
281     from	ota_training_plan_costs
282     where	training_plan_cost_id = p_training_plan_cost_id
283     for	update nowait;
284 --
285   l_proc	varchar2(72) := g_package||'lck';
286 --
287 Begin
288   hr_utility.set_location('Entering:'||l_proc, 5);
289   --
290   hr_api.mandatory_arg_error
291     (p_api_name           => l_proc
292     ,p_argument           => 'TRAINING_PLAN_COST_ID'
293     ,p_argument_value     => p_training_plan_cost_id
294     );
295   --
296   Open  C_Sel1;
297   Fetch C_Sel1 Into ota_tpc_shd.g_old_rec;
298   If C_Sel1%notfound then
299     Close C_Sel1;
300     --
301     -- The primary key is invalid therefore we must error
302     --
303     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
304     fnd_message.raise_error;
305   End If;
306   Close C_Sel1;
307   If (p_object_version_number
308       <> ota_tpc_shd.g_old_rec.object_version_number) Then
309         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
310         fnd_message.raise_error;
311   End If;
312   --
313   hr_utility.set_location(' Leaving:'||l_proc, 10);
314   --
315   -- We need to trap the ORA LOCK exception
316   --
317 Exception
318   When HR_Api.Object_Locked then
319     --
320     -- The object is locked therefore we need to supply a meaningful
321     -- error message.
322     --
323     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
324     fnd_message.set_token('TABLE_NAME', 'ota_training_plan_costs');
325     fnd_message.raise_error;
326 End lck;
327 --
328 -- ----------------------------------------------------------------------------
329 -- |-----------------------------< convert_args >-----------------------------|
330 -- ----------------------------------------------------------------------------
331 Function convert_args
332   (p_training_plan_cost_id          in number
333   ,p_tp_measurement_type_id         in number
334   ,p_training_plan_id               in number
335   ,p_booking_id                     in number
336   ,p_event_id                       in number
337   ,p_amount                         in number
338   ,p_currency_code                  in varchar2
339   ,p_business_group_id              in number
340   ,p_object_version_number          in number
341   ,p_attribute_category             in varchar2
342   ,p_attribute1                     in varchar2
343   ,p_attribute2                     in varchar2
344   ,p_attribute3                     in varchar2
345   ,p_attribute4                     in varchar2
346   ,p_attribute5                     in varchar2
347   ,p_attribute6                     in varchar2
348   ,p_attribute7                     in varchar2
349   ,p_attribute8                     in varchar2
350   ,p_attribute9                     in varchar2
351   ,p_attribute10                    in varchar2
352   ,p_attribute11                    in varchar2
353   ,p_attribute12                    in varchar2
354   ,p_attribute13                    in varchar2
355   ,p_attribute14                    in varchar2
356   ,p_attribute15                    in varchar2
357   ,p_attribute16                    in varchar2
358   ,p_attribute17                    in varchar2
359   ,p_attribute18                    in varchar2
360   ,p_attribute19                    in varchar2
364   ,p_attribute23                    in varchar2
361   ,p_attribute20                    in varchar2
362   ,p_attribute21                    in varchar2
363   ,p_attribute22                    in varchar2
365   ,p_attribute24                    in varchar2
366   ,p_attribute25                    in varchar2
367   ,p_attribute26                    in varchar2
368   ,p_attribute27                    in varchar2
369   ,p_attribute28                    in varchar2
370   ,p_attribute29                    in varchar2
371   ,p_attribute30                    in varchar2
372   ,p_information_category           in varchar2
373   ,p_tp_cost_information1           in varchar2
374   ,p_tp_cost_information2           in varchar2
375   ,p_tp_cost_information3           in varchar2
376   ,p_tp_cost_information4           in varchar2
377   ,p_tp_cost_information5           in varchar2
378   ,p_tp_cost_information6           in varchar2
379   ,p_tp_cost_information7           in varchar2
380   ,p_tp_cost_information8           in varchar2
381   ,p_tp_cost_information9           in varchar2
382   ,p_tp_cost_information10          in varchar2
383   ,p_tp_cost_information11          in varchar2
384   ,p_tp_cost_information12          in varchar2
385   ,p_tp_cost_information13          in varchar2
386   ,p_tp_cost_information14          in varchar2
387   ,p_tp_cost_information15          in varchar2
388   ,p_tp_cost_information16          in varchar2
389   ,p_tp_cost_information17          in varchar2
390   ,p_tp_cost_information18          in varchar2
391   ,p_tp_cost_information19          in varchar2
392   ,p_tp_cost_information20          in varchar2
393   ,p_tp_cost_information21          in varchar2
394   ,p_tp_cost_information22          in varchar2
395   ,p_tp_cost_information23          in varchar2
396   ,p_tp_cost_information24          in varchar2
397   ,p_tp_cost_information25          in varchar2
398   ,p_tp_cost_information26          in varchar2
399   ,p_tp_cost_information27          in varchar2
400   ,p_tp_cost_information28          in varchar2
401   ,p_tp_cost_information29          in varchar2
402   ,p_tp_cost_information30          in varchar2
403   )
404   Return g_rec_type is
405 --
406   l_rec   g_rec_type;
407 --
408 Begin
409   --
410   -- Convert arguments into local l_rec structure.
411   --
412   l_rec.training_plan_cost_id            := p_training_plan_cost_id;
413   l_rec.tp_measurement_type_id           := p_tp_measurement_type_id;
414   l_rec.training_plan_id                 := p_training_plan_id;
415   l_rec.booking_id                       := p_booking_id;
416   l_rec.event_id                         := p_event_id;
417   l_rec.amount                           := p_amount;
418   l_rec.currency_code                    := p_currency_code;
419   l_rec.business_group_id                := p_business_group_id;
420   l_rec.object_version_number            := p_object_version_number;
421   l_rec.attribute_category               := p_attribute_category;
422   l_rec.attribute1                       := p_attribute1;
423   l_rec.attribute2                       := p_attribute2;
424   l_rec.attribute3                       := p_attribute3;
425   l_rec.attribute4                       := p_attribute4;
426   l_rec.attribute5                       := p_attribute5;
427   l_rec.attribute6                       := p_attribute6;
428   l_rec.attribute7                       := p_attribute7;
429   l_rec.attribute8                       := p_attribute8;
430   l_rec.attribute9                       := p_attribute9;
431   l_rec.attribute10                      := p_attribute10;
432   l_rec.attribute11                      := p_attribute11;
433   l_rec.attribute12                      := p_attribute12;
434   l_rec.attribute13                      := p_attribute13;
435   l_rec.attribute14                      := p_attribute14;
436   l_rec.attribute15                      := p_attribute15;
437   l_rec.attribute16                      := p_attribute16;
438   l_rec.attribute17                      := p_attribute17;
439   l_rec.attribute18                      := p_attribute18;
440   l_rec.attribute19                      := p_attribute19;
441   l_rec.attribute20                      := p_attribute20;
442   l_rec.attribute21                      := p_attribute21;
443   l_rec.attribute22                      := p_attribute22;
444   l_rec.attribute23                      := p_attribute23;
445   l_rec.attribute24                      := p_attribute24;
446   l_rec.attribute25                      := p_attribute25;
447   l_rec.attribute26                      := p_attribute26;
448   l_rec.attribute27                      := p_attribute27;
449   l_rec.attribute28                      := p_attribute28;
450   l_rec.attribute29                      := p_attribute29;
451   l_rec.attribute30                      := p_attribute30;
452   l_rec.information_category             := p_information_category;
453   l_rec.tp_cost_information1             := p_tp_cost_information1;
454   l_rec.tp_cost_information2             := p_tp_cost_information2;
455   l_rec.tp_cost_information3             := p_tp_cost_information3;
456   l_rec.tp_cost_information4             := p_tp_cost_information4;
457   l_rec.tp_cost_information5             := p_tp_cost_information5;
458   l_rec.tp_cost_information6             := p_tp_cost_information6;
459   l_rec.tp_cost_information7             := p_tp_cost_information7;
460   l_rec.tp_cost_information8             := p_tp_cost_information8;
461   l_rec.tp_cost_information9             := p_tp_cost_information9;
462   l_rec.tp_cost_information10            := p_tp_cost_information10;
463   l_rec.tp_cost_information11            := p_tp_cost_information11;
464   l_rec.tp_cost_information12            := p_tp_cost_information12;
465   l_rec.tp_cost_information13            := p_tp_cost_information13;
466   l_rec.tp_cost_information14            := p_tp_cost_information14;
467   l_rec.tp_cost_information15            := p_tp_cost_information15;
468   l_rec.tp_cost_information16            := p_tp_cost_information16;
469   l_rec.tp_cost_information17            := p_tp_cost_information17;
470   l_rec.tp_cost_information18            := p_tp_cost_information18;
471   l_rec.tp_cost_information19            := p_tp_cost_information19;
472   l_rec.tp_cost_information20            := p_tp_cost_information20;
473   l_rec.tp_cost_information21            := p_tp_cost_information21;
474   l_rec.tp_cost_information22            := p_tp_cost_information22;
475   l_rec.tp_cost_information23            := p_tp_cost_information23;
476   l_rec.tp_cost_information24            := p_tp_cost_information24;
477   l_rec.tp_cost_information25            := p_tp_cost_information25;
478   l_rec.tp_cost_information26            := p_tp_cost_information26;
479   l_rec.tp_cost_information27            := p_tp_cost_information27;
480   l_rec.tp_cost_information28            := p_tp_cost_information28;
481   l_rec.tp_cost_information29            := p_tp_cost_information29;
482   l_rec.tp_cost_information30            := p_tp_cost_information30;
483   --
484   -- Return the plsql record structure.
485   --
486   Return(l_rec);
487 --
488 End convert_args;
489 --
490 end ota_tpc_shd;