DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CSO_SHD

Source


1 Package Body ben_cso_shd as
2 /* $Header: becsorhi.pkb 115.0 2003/03/17 13:37:07 csundar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_cso_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 = 'BEN_CWB_STOCK_OPTN_DTLS_PK') 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   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_cwb_stock_optn_dtls_id               in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        cwb_stock_optn_dtls_id
50       ,grant_id
51       ,grant_number
52       ,grant_name
53       ,grant_type
54       ,grant_date
55       ,grant_shares
56       ,grant_price
57       ,value_at_grant
58       ,current_share_price
59       ,current_shares_outstanding
60       ,vested_shares
61       ,unvested_shares
62       ,exercisable_shares
63       ,exercised_shares
64       ,cancelled_shares
65       ,trading_symbol
66       ,expiration_date
67       ,reason_code
68       ,class
69       ,misc
70       ,employee_number
71       ,person_id
72       ,business_group_id
73       ,prtt_rt_val_id
74       ,object_version_number
75       ,cso_attribute_category
76       ,cso_attribute1
77       ,cso_attribute2
78       ,cso_attribute3
79       ,cso_attribute4
80       ,cso_attribute5
81       ,cso_attribute6
82       ,cso_attribute7
83       ,cso_attribute8
84       ,cso_attribute9
85       ,cso_attribute10
86       ,cso_attribute11
87       ,cso_attribute12
88       ,cso_attribute13
89       ,cso_attribute14
90       ,cso_attribute15
91       ,cso_attribute16
92       ,cso_attribute17
93       ,cso_attribute18
94       ,cso_attribute19
95       ,cso_attribute20
96       ,cso_attribute21
97       ,cso_attribute22
98       ,cso_attribute23
99       ,cso_attribute24
100       ,cso_attribute25
101       ,cso_attribute26
102       ,cso_attribute27
103       ,cso_attribute28
104       ,cso_attribute29
105       ,cso_attribute30
106     from        ben_cwb_stock_optn_dtls
107     where       cwb_stock_optn_dtls_id = p_cwb_stock_optn_dtls_id;
108   --
109   l_fct_ret     boolean;
110   --
111 Begin
112   --
113   If (p_cwb_stock_optn_dtls_id is null and
114       p_object_version_number is null
115      ) Then
116     --
117     -- One of the primary key arguments is null therefore we must
118     -- set the returning function value to false
119     --
120     l_fct_ret := false;
121   Else
122     If (p_cwb_stock_optn_dtls_id
123         = ben_cso_shd.g_old_rec.cwb_stock_optn_dtls_id and
124         p_object_version_number
125         = ben_cso_shd.g_old_rec.object_version_number
126        ) Then
127       --
128       -- The g_old_rec is current therefore we must
129       -- set the returning function to true
130       --
131       l_fct_ret := true;
132     Else
133       --
134       -- Select the current row into g_old_rec
135       --
136       Open C_Sel1;
137       Fetch C_Sel1 Into ben_cso_shd.g_old_rec;
138       If C_Sel1%notfound Then
139         Close C_Sel1;
140         --
141         -- The primary key is invalid therefore we must error
142         --
143         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
144         fnd_message.raise_error;
145       End If;
146       Close C_Sel1;
147       If (p_object_version_number
148           <> ben_cso_shd.g_old_rec.object_version_number) Then
149         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
150         fnd_message.raise_error;
151       End If;
152       l_fct_ret := true;
153     End If;
154   End If;
155   Return (l_fct_ret);
156 --
157 End api_updating;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |---------------------------------< lck >----------------------------------|
161 -- ----------------------------------------------------------------------------
162 Procedure lck
163   (p_cwb_stock_optn_dtls_id               in     number
164   ,p_object_version_number                in     number
165   ) is
166 --
167 -- Cursor selects the 'current' row from the HR Schema
168 --
169   Cursor C_Sel1 is
170     select
171        cwb_stock_optn_dtls_id
172       ,grant_id
173       ,grant_number
174       ,grant_name
175       ,grant_type
176       ,grant_date
177       ,grant_shares
178       ,grant_price
179       ,value_at_grant
180       ,current_share_price
181       ,current_shares_outstanding
182       ,vested_shares
183       ,unvested_shares
184       ,exercisable_shares
185       ,exercised_shares
186       ,cancelled_shares
187       ,trading_symbol
188       ,expiration_date
189       ,reason_code
190       ,class
191       ,misc
192       ,employee_number
193       ,person_id
194       ,business_group_id
195       ,prtt_rt_val_id
196       ,object_version_number
197       ,cso_attribute_category
198       ,cso_attribute1
199       ,cso_attribute2
200       ,cso_attribute3
201       ,cso_attribute4
202       ,cso_attribute5
203       ,cso_attribute6
204       ,cso_attribute7
205       ,cso_attribute8
206       ,cso_attribute9
207       ,cso_attribute10
208       ,cso_attribute11
209       ,cso_attribute12
210       ,cso_attribute13
211       ,cso_attribute14
212       ,cso_attribute15
213       ,cso_attribute16
214       ,cso_attribute17
215       ,cso_attribute18
216       ,cso_attribute19
217       ,cso_attribute20
218       ,cso_attribute21
219       ,cso_attribute22
220       ,cso_attribute23
221       ,cso_attribute24
222       ,cso_attribute25
223       ,cso_attribute26
224       ,cso_attribute27
225       ,cso_attribute28
226       ,cso_attribute29
227       ,cso_attribute30
228     from        ben_cwb_stock_optn_dtls
229     where       cwb_stock_optn_dtls_id = p_cwb_stock_optn_dtls_id
230     for update nowait;
231 --
232   l_proc        varchar2(72) := g_package||'lck';
233 --
234 Begin
235   hr_utility.set_location('Entering:'||l_proc, 5);
236   --
237   hr_api.mandatory_arg_error
238     (p_api_name           => l_proc
239     ,p_argument           => 'CWB_STOCK_OPTN_DTLS_ID'
240     ,p_argument_value     => p_cwb_stock_optn_dtls_id
241     );
242   hr_utility.set_location(l_proc,6);
243   hr_api.mandatory_arg_error
244     (p_api_name           => l_proc
245     ,p_argument           => 'OBJECT_VERSION_NUMBER'
246     ,p_argument_value     => p_object_version_number
247     );
248   --
249   Open  C_Sel1;
250   Fetch C_Sel1 Into ben_cso_shd.g_old_rec;
251   If C_Sel1%notfound then
252     Close C_Sel1;
253     --
254     -- The primary key is invalid therefore we must error
255     --
256     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
257     fnd_message.raise_error;
258   End If;
259   Close C_Sel1;
260   If (p_object_version_number
261       <> ben_cso_shd.g_old_rec.object_version_number) Then
262         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
263         fnd_message.raise_error;
264   End If;
265   --
266   hr_utility.set_location(' Leaving:'||l_proc, 10);
267   --
268   -- We need to trap the ORA LOCK exception
269   --
270 Exception
271   When HR_Api.Object_Locked then
272     --
273     -- The object is locked therefore we need to supply a meaningful
274     -- error message.
275     --
276     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
277     fnd_message.set_token('TABLE_NAME', 'ben_cwb_stock_optn_dtls');
278     fnd_message.raise_error;
279 End lck;
280 --
281 -- ----------------------------------------------------------------------------
282 -- |-----------------------------< convert_args >-----------------------------|
283 -- ----------------------------------------------------------------------------
284 Function convert_args
288   ,p_grant_name                     in varchar2
285   (p_cwb_stock_optn_dtls_id         in number
286   ,p_grant_id                       in number
287   ,p_grant_number                   in varchar2
289   ,p_grant_type                     in varchar2
290   ,p_grant_date                     in date
291   ,p_grant_shares                   in number
292   ,p_grant_price                    in number
293   ,p_value_at_grant                 in number
294   ,p_current_share_price            in number
295   ,p_current_shares_outstanding     in number
296   ,p_vested_shares                  in number
297   ,p_unvested_shares                in number
298   ,p_exercisable_shares             in number
299   ,p_exercised_shares               in number
300   ,p_cancelled_shares               in number
301   ,p_trading_symbol                 in varchar2
302   ,p_expiration_date                in date
303   ,p_reason_code                    in varchar2
304   ,p_class                          in varchar2
305   ,p_misc                           in varchar2
306   ,p_employee_number                in varchar2
307   ,p_person_id                      in number
308   ,p_business_group_id              in number
309   ,p_prtt_rt_val_id                 in number
310   ,p_object_version_number          in number
311   ,p_cso_attribute_category         in varchar2
312   ,p_cso_attribute1                 in varchar2
313   ,p_cso_attribute2                 in varchar2
314   ,p_cso_attribute3                 in varchar2
315   ,p_cso_attribute4                 in varchar2
316   ,p_cso_attribute5                 in varchar2
317   ,p_cso_attribute6                 in varchar2
318   ,p_cso_attribute7                 in varchar2
319   ,p_cso_attribute8                 in varchar2
320   ,p_cso_attribute9                 in varchar2
321   ,p_cso_attribute10                in varchar2
322   ,p_cso_attribute11                in varchar2
323   ,p_cso_attribute12                in varchar2
324   ,p_cso_attribute13                in varchar2
325   ,p_cso_attribute14                in varchar2
326   ,p_cso_attribute15                in varchar2
327   ,p_cso_attribute16                in varchar2
328   ,p_cso_attribute17                in varchar2
329   ,p_cso_attribute18                in varchar2
330   ,p_cso_attribute19                in varchar2
331   ,p_cso_attribute20                in varchar2
332   ,p_cso_attribute21                in varchar2
333   ,p_cso_attribute22                in varchar2
334   ,p_cso_attribute23                in varchar2
335   ,p_cso_attribute24                in varchar2
336   ,p_cso_attribute25                in varchar2
337   ,p_cso_attribute26                in varchar2
338   ,p_cso_attribute27                in varchar2
339   ,p_cso_attribute28                in varchar2
340   ,p_cso_attribute29                in varchar2
341   ,p_cso_attribute30                in varchar2
342   )
343   Return g_rec_type is
344 --
345   l_rec   g_rec_type;
346 --
347 Begin
348   --
349   -- Convert arguments into local l_rec structure.
350   --
351   l_rec.cwb_stock_optn_dtls_id           := p_cwb_stock_optn_dtls_id;
352   l_rec.grant_id                         := p_grant_id;
353   l_rec.grant_number                     := p_grant_number;
354   l_rec.grant_name                       := p_grant_name;
355   l_rec.grant_type                       := p_grant_type;
356   l_rec.grant_date                       := p_grant_date;
357   l_rec.grant_shares                     := p_grant_shares;
358   l_rec.grant_price                      := p_grant_price;
359   l_rec.value_at_grant                   := p_value_at_grant;
360   l_rec.current_share_price              := p_current_share_price;
361   l_rec.current_shares_outstanding       := p_current_shares_outstanding;
362   l_rec.vested_shares                    := p_vested_shares;
363   l_rec.unvested_shares                  := p_unvested_shares;
364   l_rec.exercisable_shares               := p_exercisable_shares;
365   l_rec.exercised_shares                 := p_exercised_shares;
366   l_rec.cancelled_shares                 := p_cancelled_shares;
367   l_rec.trading_symbol                   := p_trading_symbol;
368   l_rec.expiration_date                  := p_expiration_date;
369   l_rec.reason_code                      := p_reason_code;
370   l_rec.class                            := p_class;
371   l_rec.misc                             := p_misc;
372   l_rec.employee_number                  := p_employee_number;
373   l_rec.person_id                        := p_person_id;
374   l_rec.business_group_id                := p_business_group_id;
375   l_rec.prtt_rt_val_id                   := p_prtt_rt_val_id;
376   l_rec.object_version_number            := p_object_version_number;
377   l_rec.cso_attribute_category           := p_cso_attribute_category;
378   l_rec.cso_attribute1                   := p_cso_attribute1;
379   l_rec.cso_attribute2                   := p_cso_attribute2;
380   l_rec.cso_attribute3                   := p_cso_attribute3;
381   l_rec.cso_attribute4                   := p_cso_attribute4;
382   l_rec.cso_attribute5                   := p_cso_attribute5;
383   l_rec.cso_attribute6                   := p_cso_attribute6;
384   l_rec.cso_attribute7                   := p_cso_attribute7;
385   l_rec.cso_attribute8                   := p_cso_attribute8;
386   l_rec.cso_attribute9                   := p_cso_attribute9;
387   l_rec.cso_attribute10                  := p_cso_attribute10;
388   l_rec.cso_attribute11                  := p_cso_attribute11;
389   l_rec.cso_attribute12                  := p_cso_attribute12;
390   l_rec.cso_attribute13                  := p_cso_attribute13;
391   l_rec.cso_attribute14                  := p_cso_attribute14;
392   l_rec.cso_attribute15                  := p_cso_attribute15;
393   l_rec.cso_attribute16                  := p_cso_attribute16;
394   l_rec.cso_attribute17                  := p_cso_attribute17;
395   l_rec.cso_attribute18                  := p_cso_attribute18;
396   l_rec.cso_attribute19                  := p_cso_attribute19;
397   l_rec.cso_attribute20                  := p_cso_attribute20;
398   l_rec.cso_attribute21                  := p_cso_attribute21;
399   l_rec.cso_attribute22                  := p_cso_attribute22;
400   l_rec.cso_attribute23                  := p_cso_attribute23;
401   l_rec.cso_attribute24                  := p_cso_attribute24;
402   l_rec.cso_attribute25                  := p_cso_attribute25;
403   l_rec.cso_attribute26                  := p_cso_attribute26;
404   l_rec.cso_attribute27                  := p_cso_attribute27;
405   l_rec.cso_attribute28                  := p_cso_attribute28;
406   l_rec.cso_attribute29                  := p_cso_attribute29;
407   l_rec.cso_attribute30                  := p_cso_attribute30;
408   --
409   -- Return the plsql record structure.
410   --
411   Return(l_rec);
412 --
413 End convert_args;
414 --
415 end ben_cso_shd;