DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PDT_SHD

Source


1 Package Body ben_pdt_shd as
2 /* $Header: bepdtrhi.pkb 115.0 2003/10/30 09:33 rpillay noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_pdt_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_PYMT_CHECK_DET_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
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_pymt_check_det_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        pymt_check_det_id
50       ,person_id
51       ,business_group_id
52       ,check_num
53       ,pymt_dt
54       ,pymt_amt
55       ,pdt_attribute_category
56       ,pdt_attribute1
57       ,pdt_attribute2
58       ,pdt_attribute3
59       ,pdt_attribute4
60       ,pdt_attribute5
61       ,pdt_attribute6
62       ,pdt_attribute7
63       ,pdt_attribute8
64       ,pdt_attribute9
65       ,pdt_attribute10
66       ,pdt_attribute11
67       ,pdt_attribute12
68       ,pdt_attribute13
69       ,pdt_attribute14
70       ,pdt_attribute15
71       ,pdt_attribute16
72       ,pdt_attribute17
73       ,pdt_attribute18
74       ,pdt_attribute19
75       ,pdt_attribute20
76       ,pdt_attribute21
77       ,pdt_attribute22
78       ,pdt_attribute23
79       ,pdt_attribute24
80       ,pdt_attribute25
81       ,pdt_attribute26
82       ,pdt_attribute27
83       ,pdt_attribute28
84       ,pdt_attribute29
85       ,pdt_attribute30
86       ,object_version_number
87     from        ben_pymt_check_det
88     where       pymt_check_det_id = p_pymt_check_det_id;
89   --
90   l_fct_ret     boolean;
91   --
92 Begin
93   --
94   If (p_pymt_check_det_id is null and
95       p_object_version_number is null
96      ) Then
97     --
98     -- One of the primary key arguments is null therefore we must
99     -- set the returning function value to false
100     --
101     l_fct_ret := false;
102   Else
103     If (p_pymt_check_det_id
104         = ben_pdt_shd.g_old_rec.pymt_check_det_id and
105         p_object_version_number
106         = ben_pdt_shd.g_old_rec.object_version_number
107        ) Then
108       --
109       -- The g_old_rec is current therefore we must
110       -- set the returning function to true
111       --
112       l_fct_ret := true;
113     Else
114       --
115       -- Select the current row into g_old_rec
116       --
117       Open C_Sel1;
118       Fetch C_Sel1 Into ben_pdt_shd.g_old_rec;
119       If C_Sel1%notfound Then
120         Close C_Sel1;
121         --
122         -- The primary key is invalid therefore we must error
123         --
124         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
125         fnd_message.raise_error;
126       End If;
127       Close C_Sel1;
128       If (p_object_version_number
129           <> ben_pdt_shd.g_old_rec.object_version_number) Then
130         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
131         fnd_message.raise_error;
132       End If;
133       l_fct_ret := true;
134     End If;
135   End If;
136   Return (l_fct_ret);
137 --
138 End api_updating;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |---------------------------------< lck >----------------------------------|
142 -- ----------------------------------------------------------------------------
143 Procedure lck
144   (p_pymt_check_det_id                    in     number
145   ,p_object_version_number                in     number
146   ) is
147 --
148 -- Cursor selects the 'current' row from the HR Schema
149 --
150   Cursor C_Sel1 is
151     select
152        pymt_check_det_id
153       ,person_id
154       ,business_group_id
155       ,check_num
156       ,pymt_dt
157       ,pymt_amt
158       ,pdt_attribute_category
159       ,pdt_attribute1
160       ,pdt_attribute2
161       ,pdt_attribute3
162       ,pdt_attribute4
163       ,pdt_attribute5
164       ,pdt_attribute6
165       ,pdt_attribute7
166       ,pdt_attribute8
167       ,pdt_attribute9
168       ,pdt_attribute10
169       ,pdt_attribute11
170       ,pdt_attribute12
171       ,pdt_attribute13
172       ,pdt_attribute14
173       ,pdt_attribute15
174       ,pdt_attribute16
175       ,pdt_attribute17
176       ,pdt_attribute18
177       ,pdt_attribute19
178       ,pdt_attribute20
179       ,pdt_attribute21
180       ,pdt_attribute22
181       ,pdt_attribute23
182       ,pdt_attribute24
183       ,pdt_attribute25
184       ,pdt_attribute26
185       ,pdt_attribute27
186       ,pdt_attribute28
187       ,pdt_attribute29
188       ,pdt_attribute30
189       ,object_version_number
190     from        ben_pymt_check_det
191     where       pymt_check_det_id = p_pymt_check_det_id
192     for update nowait;
193 --
197   hr_utility.set_location('Entering:'||l_proc, 5);
194   l_proc        varchar2(72) := g_package||'lck';
195 --
196 Begin
198   --
199   hr_api.mandatory_arg_error
200     (p_api_name           => l_proc
201     ,p_argument           => 'PYMT_CHECK_DET_ID'
202     ,p_argument_value     => p_pymt_check_det_id
203     );
204   hr_utility.set_location(l_proc,6);
205   hr_api.mandatory_arg_error
206     (p_api_name           => l_proc
207     ,p_argument           => 'OBJECT_VERSION_NUMBER'
208     ,p_argument_value     => p_object_version_number
209     );
210   --
211   Open  C_Sel1;
212   Fetch C_Sel1 Into ben_pdt_shd.g_old_rec;
213   If C_Sel1%notfound then
214     Close C_Sel1;
215     --
216     -- The primary key is invalid therefore we must error
217     --
218     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
219     fnd_message.raise_error;
220   End If;
221   Close C_Sel1;
222   If (p_object_version_number
223       <> ben_pdt_shd.g_old_rec.object_version_number) Then
224         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
225         fnd_message.raise_error;
226   End If;
227   --
228   hr_utility.set_location(' Leaving:'||l_proc, 10);
229   --
230   -- We need to trap the ORA LOCK exception
231   --
232 Exception
233   When HR_Api.Object_Locked then
234     --
235     -- The object is locked therefore we need to supply a meaningful
236     -- error message.
237     --
238     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
239     fnd_message.set_token('TABLE_NAME', 'ben_pymt_check_det');
240     fnd_message.raise_error;
241 End lck;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-----------------------------< convert_args >-----------------------------|
245 -- ----------------------------------------------------------------------------
246 Function convert_args
247   (p_pymt_check_det_id              in number
248   ,p_person_id                      in number
249   ,p_business_group_id              in number
250   ,p_check_num                      in varchar2
251   ,p_pymt_dt                        in date
252   ,p_pymt_amt                       in number
253   ,p_pdt_attribute_category         in varchar2
254   ,p_pdt_attribute1                 in varchar2
255   ,p_pdt_attribute2                 in varchar2
256   ,p_pdt_attribute3                 in varchar2
257   ,p_pdt_attribute4                 in varchar2
258   ,p_pdt_attribute5                 in varchar2
259   ,p_pdt_attribute6                 in varchar2
260   ,p_pdt_attribute7                 in varchar2
261   ,p_pdt_attribute8                 in varchar2
262   ,p_pdt_attribute9                 in varchar2
263   ,p_pdt_attribute10                in varchar2
264   ,p_pdt_attribute11                in varchar2
265   ,p_pdt_attribute12                in varchar2
266   ,p_pdt_attribute13                in varchar2
267   ,p_pdt_attribute14                in varchar2
268   ,p_pdt_attribute15                in varchar2
269   ,p_pdt_attribute16                in varchar2
270   ,p_pdt_attribute17                in varchar2
271   ,p_pdt_attribute18                in varchar2
272   ,p_pdt_attribute19                in varchar2
273   ,p_pdt_attribute20                in varchar2
274   ,p_pdt_attribute21                in varchar2
275   ,p_pdt_attribute22                in varchar2
276   ,p_pdt_attribute23                in varchar2
277   ,p_pdt_attribute24                in varchar2
278   ,p_pdt_attribute25                in varchar2
279   ,p_pdt_attribute26                in varchar2
280   ,p_pdt_attribute27                in varchar2
281   ,p_pdt_attribute28                in varchar2
282   ,p_pdt_attribute29                in varchar2
283   ,p_pdt_attribute30                in varchar2
284   ,p_object_version_number          in number
285   )
286   Return g_rec_type is
287 --
288   l_rec   g_rec_type;
289 --
290 Begin
291   --
292   -- Convert arguments into local l_rec structure.
293   --
294   l_rec.pymt_check_det_id                := p_pymt_check_det_id;
295   l_rec.person_id                        := p_person_id;
296   l_rec.business_group_id                := p_business_group_id;
297   l_rec.check_num                        := p_check_num;
298   l_rec.pymt_dt                          := p_pymt_dt;
299   l_rec.pymt_amt                         := p_pymt_amt;
300   l_rec.pdt_attribute_category           := p_pdt_attribute_category;
301   l_rec.pdt_attribute1                   := p_pdt_attribute1;
302   l_rec.pdt_attribute2                   := p_pdt_attribute2;
303   l_rec.pdt_attribute3                   := p_pdt_attribute3;
304   l_rec.pdt_attribute4                   := p_pdt_attribute4;
305   l_rec.pdt_attribute5                   := p_pdt_attribute5;
306   l_rec.pdt_attribute6                   := p_pdt_attribute6;
307   l_rec.pdt_attribute7                   := p_pdt_attribute7;
308   l_rec.pdt_attribute8                   := p_pdt_attribute8;
309   l_rec.pdt_attribute9                   := p_pdt_attribute9;
310   l_rec.pdt_attribute10                  := p_pdt_attribute10;
311   l_rec.pdt_attribute11                  := p_pdt_attribute11;
312   l_rec.pdt_attribute12                  := p_pdt_attribute12;
313   l_rec.pdt_attribute13                  := p_pdt_attribute13;
314   l_rec.pdt_attribute14                  := p_pdt_attribute14;
315   l_rec.pdt_attribute15                  := p_pdt_attribute15;
316   l_rec.pdt_attribute16                  := p_pdt_attribute16;
317   l_rec.pdt_attribute17                  := p_pdt_attribute17;
318   l_rec.pdt_attribute18                  := p_pdt_attribute18;
319   l_rec.pdt_attribute19                  := p_pdt_attribute19;
320   l_rec.pdt_attribute20                  := p_pdt_attribute20;
321   l_rec.pdt_attribute21                  := p_pdt_attribute21;
322   l_rec.pdt_attribute22                  := p_pdt_attribute22;
323   l_rec.pdt_attribute23                  := p_pdt_attribute23;
324   l_rec.pdt_attribute24                  := p_pdt_attribute24;
325   l_rec.pdt_attribute25                  := p_pdt_attribute25;
326   l_rec.pdt_attribute26                  := p_pdt_attribute26;
327   l_rec.pdt_attribute27                  := p_pdt_attribute27;
328   l_rec.pdt_attribute28                  := p_pdt_attribute28;
329   l_rec.pdt_attribute29                  := p_pdt_attribute29;
330   l_rec.pdt_attribute30                  := p_pdt_attribute30;
331   l_rec.object_version_number            := p_object_version_number;
332   --
333   -- Return the plsql record structure.
334   --
335   Return(l_rec);
336 --
337 End convert_args;
338 --
339 end ben_pdt_shd;