DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BBA_SHD

Source


1 Package Body per_bba_shd as
2 /* $Header: pebbarhi.pkb 115.8 2002/12/02 13:03:45 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_bba_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'PER_BF_BALANCE_AMOUNTS_FK1') Then
22     fnd_message.set_name('PER', 'PER_289357_BF_BG_ID_INVALID');
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 = 'PER_BF_BALANCE_AMOUNTS_FK2') Then
27     fnd_message.set_name('PER', 'HR_52938_BAL_TYPE_NOT_EXIST');
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 = 'PER_BF_BALANCE_AMOUNTS_FK3') Then
32     fnd_message.set_name('PER', 'HR_52937_BAD_PROCESSED_ASG_ID');
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 = 'PER_BF_BALANCE_AMOUNTS_PK') Then
37     fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
41   Else
42     fnd_message.set_name('PER', 'HR_7877_API_INVALID_CONSTRAINT');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45     fnd_message.raise_error;
46   End If;
47   --
48   hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (
56 p_balance_amount_id                    in number,
57   p_object_version_number              in number
58   )      Return Boolean Is
59 --
60   --
61   -- Cursor selects the 'current' row from the HR Schema
62   --
63   Cursor C_Sel1 is
64     select
65       balance_amount_id,
66       balance_type_id,
67       processed_assignment_id,
68       business_group_id,
69       ytd_amount,
70       fytd_amount,
71       ptd_amount,
72       mtd_amount,
73       qtd_amount,
74       run_amount,
75       object_version_number,
76       bba_attribute_category,
77       bba_attribute1,
78       bba_attribute2,
79       bba_attribute3,
80       bba_attribute4,
81       bba_attribute5,
82       bba_attribute6,
83       bba_attribute7,
84       bba_attribute8,
85       bba_attribute9,
86       bba_attribute10,
87       bba_attribute11,
88       bba_attribute12,
89       bba_attribute13,
90       bba_attribute14,
91       bba_attribute15,
92       bba_attribute16,
93       bba_attribute17,
94       bba_attribute18,
95       bba_attribute19,
96       bba_attribute20,
97       bba_attribute21,
98       bba_attribute22,
99       bba_attribute23,
100       bba_attribute24,
101       bba_attribute25,
102       bba_attribute26,
103       bba_attribute27,
104       bba_attribute28,
105       bba_attribute29,
106       bba_attribute30
107     from	per_bf_balance_amounts
108     where	balance_amount_id = p_balance_amount_id;
109 --
110   l_proc	varchar2(72)	:= g_package||'api_updating';
111   l_fct_ret	boolean;
112 --
113 Begin
114   hr_utility.set_location('Entering:'||l_proc, 5);
115   --
116   If (
117       p_balance_amount_id is null and
118       p_object_version_number is null
119      ) Then
120     --
121     -- One of the primary key arguments is null therefore we must
122     -- set the returning function value to false
123     --
124     l_fct_ret := false;
125   Else
126     If (
127       p_balance_amount_id = g_old_rec.balance_amount_id and
128       p_object_version_number = g_old_rec.object_version_number
129        ) Then
130       hr_utility.set_location(l_proc, 10);
131       --
132       -- The g_old_rec is current therefore we must
133       -- set the returning function to true
134       --
135       l_fct_ret := true;
136     Else
137       --
138       -- Select the current row into g_old_rec
139       --
140       Open C_Sel1;
141       Fetch C_Sel1 Into g_old_rec;
142       If C_Sel1%notfound Then
143         Close C_Sel1;
144         --
145         -- The primary key is invalid therefore we must error
146         --
147         fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
148         fnd_message.raise_error;
149       End If;
150       Close C_Sel1;
151       If (p_object_version_number <> g_old_rec.object_version_number) Then
152         fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
153         fnd_message.raise_error;
154       End If;
155       hr_utility.set_location(l_proc, 15);
156       l_fct_ret := true;
157     End If;
158   End If;
159   hr_utility.set_location(' Leaving:'||l_proc, 20);
160   Return (l_fct_ret);
161 --
162 End api_updating;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |---------------------------------< lck >----------------------------------|
166 -- ----------------------------------------------------------------------------
167 Procedure lck
168   (
169 p_balance_amount_id                    in number,
170   p_object_version_number              in number
171   ) is
172 --
173 -- Cursor selects the 'current' row from the HR Schema
174 --
175   Cursor C_Sel1 is
176     select       balance_amount_id,
177       balance_type_id,
178       processed_assignment_id,
179       business_group_id,
180       ytd_amount,
181       fytd_amount,
182       ptd_amount,
183       mtd_amount,
184       qtd_amount,
185       run_amount,
186       object_version_number,
187       bba_attribute_category,
188       bba_attribute1,
189       bba_attribute2,
190       bba_attribute3,
191       bba_attribute4,
192       bba_attribute5,
193       bba_attribute6,
194       bba_attribute7,
195       bba_attribute8,
196       bba_attribute9,
197       bba_attribute10,
198       bba_attribute11,
199       bba_attribute12,
200       bba_attribute13,
201       bba_attribute14,
202       bba_attribute15,
203       bba_attribute16,
204       bba_attribute17,
205       bba_attribute18,
206       bba_attribute19,
207       bba_attribute20,
208       bba_attribute21,
209       bba_attribute22,
210       bba_attribute23,
211       bba_attribute24,
212       bba_attribute25,
213       bba_attribute26,
214       bba_attribute27,
215       bba_attribute28,
216       bba_attribute29,
217       bba_attribute30
218     from	per_bf_balance_amounts
219     where	balance_amount_id = p_balance_amount_id
220     for	update nowait;
221 --
222   l_proc	varchar2(72) := g_package||'lck';
223 --
224 Begin
225   hr_utility.set_location('Entering:'||l_proc, 5);
226   --
227   -- Add any mandatory argument checking here:
228   -- Example:
229   -- hr_api.mandatory_arg_error
230   --   (p_api_name       => l_proc,
231   --    p_argument       => 'object_version_number',
232   --    p_argument_value => p_object_version_number);
233   --
234   hr_api.mandatory_arg_error(p_api_name           => l_proc,
235                                p_argument           => 'BALANCE_AMOUNT_ID',
236                                p_argument_value     => p_balance_amount_id);
237   Open  C_Sel1;
238   Fetch C_Sel1 Into g_old_rec;
239   If C_Sel1%notfound then
240     Close C_Sel1;
241     --
242     -- The primary key is invalid therefore we must error
243     --
244     fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
245     fnd_message.raise_error;
246   End If;
247   Close C_Sel1;
248   If (p_object_version_number <> g_old_rec.object_version_number) Then
249         fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
250         fnd_message.raise_error;
251       End If;
252 --
253   hr_utility.set_location(' Leaving:'||l_proc, 10);
254 --
255 -- We need to trap the ORA LOCK exception
256 --
257 Exception
258   When HR_Api.Object_Locked then
259     --
260     -- The object is locked therefore we need to supply a meaningful
261     -- error message.
262     --
263     fnd_message.set_name('PER', 'HR_7165_OBJECT_LOCKED');
264     fnd_message.set_token('TABLE_NAME', 'per_bf_balance_amounts');
265     fnd_message.raise_error;
266 End lck;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |-----------------------------< convert_args >-----------------------------|
270 -- ----------------------------------------------------------------------------
271 Function convert_args
272         (
273       p_balance_amount_id            in number,
274       p_balance_type_id              in number,
275       p_processed_assignment_id      in number,
276       p_business_group_id            in number,
277       p_ytd_amount                   in number,
278       p_fytd_amount                  in number,
279       p_ptd_amount                   in number,
280       p_mtd_amount                   in number,
281       p_qtd_amount                   in number,
282       p_run_amount                   in number,
283       p_object_version_number        in number,
284       p_bba_attribute_category           in varchar2,
285       p_bba_attribute1                   in varchar2,
286       p_bba_attribute2                   in varchar2,
287       p_bba_attribute3                   in varchar2,
288       p_bba_attribute4                   in varchar2,
289       p_bba_attribute5                   in varchar2,
290       p_bba_attribute6                   in varchar2,
291       p_bba_attribute7                   in varchar2,
292       p_bba_attribute8                   in varchar2,
293       p_bba_attribute9                   in varchar2,
294       p_bba_attribute10                  in varchar2,
295       p_bba_attribute11                  in varchar2,
296       p_bba_attribute12                  in varchar2,
297       p_bba_attribute13                  in varchar2,
298       p_bba_attribute14                  in varchar2,
299       p_bba_attribute15                  in varchar2,
300       p_bba_attribute16                  in varchar2,
301       p_bba_attribute17                  in varchar2,
302       p_bba_attribute18                  in varchar2,
303       p_bba_attribute19                  in varchar2,
304       p_bba_attribute20                  in varchar2,
305       p_bba_attribute21                  in varchar2,
306       p_bba_attribute22                  in varchar2,
307       p_bba_attribute23                  in varchar2,
308       p_bba_attribute24                  in varchar2,
309       p_bba_attribute25                  in varchar2,
310       p_bba_attribute26                  in varchar2,
311       p_bba_attribute27                  in varchar2,
312       p_bba_attribute28                  in varchar2,
313       p_bba_attribute29                  in varchar2,
314       p_bba_attribute30                  in varchar2
315 
316         )
317         Return g_rec_type is
318 --
319   l_rec         g_rec_type;
320   l_proc  varchar2(72) := g_package||'convert_args';
321 --
322 Begin
323   --
324   hr_utility.set_location('Entering:'||l_proc, 5);
325   --
326   -- Convert arguments into local l_rec structure.
327   --
328   l_rec.balance_amount_id                := p_balance_amount_id;
329   l_rec.balance_type_id                  := p_balance_type_id;
330   l_rec.processed_assignment_id          := p_processed_assignment_id;
331   l_rec.business_group_id                := p_business_group_id;
332   l_rec.ytd_amount                       := p_ytd_amount;
333   l_rec.fytd_amount                      := p_fytd_amount;
334   l_rec.ptd_amount                       := p_ptd_amount;
335   l_rec.mtd_amount                       := p_mtd_amount;
336   l_rec.qtd_amount                       := p_qtd_amount;
337   l_rec.run_amount                       := p_run_amount;
338   l_rec.object_version_number            := p_object_version_number;
339   l_rec.bba_attribute_category               := p_bba_attribute_category;
340   l_rec.bba_attribute1                       := p_bba_attribute1;
341   l_rec.bba_attribute2                       := p_bba_attribute2;
342   l_rec.bba_attribute3                       := p_bba_attribute3;
343   l_rec.bba_attribute4                       := p_bba_attribute4;
344   l_rec.bba_attribute5                       := p_bba_attribute5;
345   l_rec.bba_attribute6                       := p_bba_attribute6;
346   l_rec.bba_attribute7                       := p_bba_attribute7;
347   l_rec.bba_attribute8                       := p_bba_attribute8;
348   l_rec.bba_attribute9                       := p_bba_attribute9;
349   l_rec.bba_attribute10                      := p_bba_attribute10;
350   l_rec.bba_attribute11                      := p_bba_attribute11;
351   l_rec.bba_attribute12                      := p_bba_attribute12;
352   l_rec.bba_attribute13                      := p_bba_attribute13;
353   l_rec.bba_attribute14                      := p_bba_attribute14;
354   l_rec.bba_attribute15                      := p_bba_attribute15;
355   l_rec.bba_attribute16                      := p_bba_attribute16;
356   l_rec.bba_attribute17                      := p_bba_attribute17;
357   l_rec.bba_attribute18                      := p_bba_attribute18;
358   l_rec.bba_attribute19                      := p_bba_attribute19;
359   l_rec.bba_attribute20                      := p_bba_attribute20;
360   l_rec.bba_attribute21                      := p_bba_attribute21;
361   l_rec.bba_attribute22                      := p_bba_attribute22;
362   l_rec.bba_attribute23                      := p_bba_attribute23;
363   l_rec.bba_attribute24                      := p_bba_attribute24;
364   l_rec.bba_attribute25                      := p_bba_attribute25;
365   l_rec.bba_attribute26                      := p_bba_attribute26;
366   l_rec.bba_attribute27                      := p_bba_attribute27;
367   l_rec.bba_attribute28                      := p_bba_attribute28;
368   l_rec.bba_attribute29                      := p_bba_attribute29;
369   l_rec.bba_attribute30                      := p_bba_attribute30;
370 --
371 -- Return the plsql record structure.
372 --
373   hr_utility.set_location(' Leaving:'||l_proc, 10);
374   Return(l_rec);
375 --
376 End convert_args;
377 --
378 end per_bba_shd;