DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CPY_SHD

Source


1 Package Body ben_cpy_shd as
2 /* $Header: becpyrhi.pkb 120.2 2005/12/19 12:34:35 kmahendr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cpy_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'BEN_POPL_YR_PERD_FK1') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'BEN_POPL_YR_PERD_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   Else
47     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50     hr_utility.raise_error;
51   End If;
52   --
53   hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (
61   p_popl_yr_perd_id                    in number,
62   p_object_version_number              in number
63   )      Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70 	popl_yr_perd_id,
71 	yr_perd_id,
72 	business_group_id,
73 	pl_id,
74 	pgm_id,
75 	ordr_num,
76 	acpt_clm_rqsts_thru_dt,
77 	py_clms_thru_dt,
78 	cpy_attribute_category,
79 	cpy_attribute1,
80 	cpy_attribute2,
81 	cpy_attribute3,
82 	cpy_attribute4,
83 	cpy_attribute5,
84 	cpy_attribute6,
85 	cpy_attribute7,
86 	cpy_attribute8,
87 	cpy_attribute9,
88 	cpy_attribute10,
89 	cpy_attribute11,
90 	cpy_attribute12,
91 	cpy_attribute13,
92 	cpy_attribute14,
93 	cpy_attribute15,
94 	cpy_attribute16,
95 	cpy_attribute17,
96 	cpy_attribute18,
97 	cpy_attribute19,
98 	cpy_attribute20,
99 	cpy_attribute21,
100 	cpy_attribute22,
101 	cpy_attribute23,
102 	cpy_attribute24,
103 	cpy_attribute25,
104 	cpy_attribute26,
105 	cpy_attribute27,
106 	cpy_attribute28,
107 	cpy_attribute29,
108 	cpy_attribute30,
109 	object_version_number
110     from	ben_popl_yr_perd
111     where	popl_yr_perd_id = p_popl_yr_perd_id;
112 --
113   l_proc	varchar2(72)	:= g_package||'api_updating';
114   l_fct_ret	boolean;
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   If (
120 	p_popl_yr_perd_id is null and
121 	p_object_version_number is null
122      ) Then
123     --
124     -- One of the primary key arguments is null therefore we must
125     -- set the returning function value to false
126     --
127     l_fct_ret := false;
128   Else
129     If (
130 	p_popl_yr_perd_id = g_old_rec.popl_yr_perd_id and
131 	p_object_version_number = g_old_rec.object_version_number
132        ) Then
133       hr_utility.set_location(l_proc, 10);
134       --
135       -- The g_old_rec is current therefore we must
136       -- set the returning function to true
137       --
138       l_fct_ret := true;
139     Else
140       --
141       -- Select the current row into g_old_rec
142       --
143       Open C_Sel1;
144       Fetch C_Sel1 Into g_old_rec;
145       If C_Sel1%notfound Then
146         Close C_Sel1;
147         --
148         -- The primary key is invalid therefore we must error
149         --
150         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151         hr_utility.raise_error;
152       End If;
153       Close C_Sel1;
154       If (p_object_version_number <> g_old_rec.object_version_number) Then
155         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156         hr_utility.raise_error;
157       End If;
158       hr_utility.set_location(l_proc, 15);
159       l_fct_ret := true;
160     End If;
161   End If;
162   hr_utility.set_location(' Leaving:'||l_proc, 20);
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (
172   p_popl_yr_perd_id                    in number,
173   p_object_version_number              in number
174   ) is
175 --
176 -- Cursor selects the 'current' row from the HR Schema
177 --
178   Cursor C_Sel1 is
179     select 	popl_yr_perd_id,
180 	yr_perd_id,
181 	business_group_id,
182 	pl_id,
183 	pgm_id,
184 	ordr_num,
185 	acpt_clm_rqsts_thru_dt,
186 	py_clms_thru_dt,
187 	cpy_attribute_category,
188 	cpy_attribute1,
189 	cpy_attribute2,
190 	cpy_attribute3,
191 	cpy_attribute4,
192 	cpy_attribute5,
193 	cpy_attribute6,
194 	cpy_attribute7,
195 	cpy_attribute8,
196 	cpy_attribute9,
197 	cpy_attribute10,
198 	cpy_attribute11,
199 	cpy_attribute12,
200 	cpy_attribute13,
201 	cpy_attribute14,
202 	cpy_attribute15,
203 	cpy_attribute16,
204 	cpy_attribute17,
205 	cpy_attribute18,
206 	cpy_attribute19,
207 	cpy_attribute20,
208 	cpy_attribute21,
209 	cpy_attribute22,
210 	cpy_attribute23,
211 	cpy_attribute24,
212 	cpy_attribute25,
213 	cpy_attribute26,
214 	cpy_attribute27,
215 	cpy_attribute28,
216 	cpy_attribute29,
217 	cpy_attribute30,
218 	object_version_number
219     from	ben_popl_yr_perd
220     where	popl_yr_perd_id = p_popl_yr_perd_id
221     for	update nowait;
222 --
223   l_proc	varchar2(72) := g_package||'lck';
224 --
225 Begin
226   hr_utility.set_location('Entering:'||l_proc, 5);
227   --
228   -- Add any mandatory argument checking here:
229   -- Example:
230   -- hr_api.mandatory_arg_error
231   --   (p_api_name       => l_proc,
232   --    p_argument       => 'object_version_number',
233   --    p_argument_value => p_object_version_number);
234   --
235   Open  C_Sel1;
236   Fetch C_Sel1 Into g_old_rec;
237   If C_Sel1%notfound then
238     Close C_Sel1;
239     --
240     -- The primary key is invalid therefore we must error
241     --
242     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
243     hr_utility.raise_error;
244   End If;
245   Close C_Sel1;
246   If (p_object_version_number <> g_old_rec.object_version_number) Then
247         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
248         hr_utility.raise_error;
249       End If;
250 --
251   hr_utility.set_location(' Leaving:'||l_proc, 10);
252 --
253 -- We need to trap the ORA LOCK exception
254 --
255 Exception
256   When HR_Api.Object_Locked then
257     --
258     -- The object is locked therefore we need to supply a meaningful
259     -- error message.
260     --
261     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
262     hr_utility.set_message_token('TABLE_NAME', 'ben_popl_yr_perd');
263     hr_utility.raise_error;
264 End lck;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |-----------------------------< convert_args >-----------------------------|
268 -- ----------------------------------------------------------------------------
269 Function convert_args
270 	(
271 	p_popl_yr_perd_id               in number,
272 	p_yr_perd_id                    in number,
273 	p_business_group_id             in number,
274 	p_pl_id                         in number,
275 	p_pgm_id                        in number,
276 	p_ordr_num                      in number,
277 	p_acpt_clm_rqsts_thru_dt        in date,
278 	p_py_clms_thru_dt               in date,
279 	p_cpy_attribute_category        in varchar2,
280 	p_cpy_attribute1                in varchar2,
281 	p_cpy_attribute2                in varchar2,
282 	p_cpy_attribute3                in varchar2,
283 	p_cpy_attribute4                in varchar2,
284 	p_cpy_attribute5                in varchar2,
285 	p_cpy_attribute6                in varchar2,
286 	p_cpy_attribute7                in varchar2,
287 	p_cpy_attribute8                in varchar2,
288 	p_cpy_attribute9                in varchar2,
289 	p_cpy_attribute10               in varchar2,
290 	p_cpy_attribute11               in varchar2,
291 	p_cpy_attribute12               in varchar2,
292 	p_cpy_attribute13               in varchar2,
293 	p_cpy_attribute14               in varchar2,
294 	p_cpy_attribute15               in varchar2,
295 	p_cpy_attribute16               in varchar2,
296 	p_cpy_attribute17               in varchar2,
297 	p_cpy_attribute18               in varchar2,
298 	p_cpy_attribute19               in varchar2,
299 	p_cpy_attribute20               in varchar2,
300 	p_cpy_attribute21               in varchar2,
301 	p_cpy_attribute22               in varchar2,
302 	p_cpy_attribute23               in varchar2,
303 	p_cpy_attribute24               in varchar2,
304 	p_cpy_attribute25               in varchar2,
305 	p_cpy_attribute26               in varchar2,
306 	p_cpy_attribute27               in varchar2,
307 	p_cpy_attribute28               in varchar2,
308 	p_cpy_attribute29               in varchar2,
309 	p_cpy_attribute30               in varchar2,
310 	p_object_version_number         in number
311 	)
312 	Return g_rec_type is
313 --
314   l_rec	  g_rec_type;
315   l_proc  varchar2(72) := g_package||'convert_args';
316 --
317 Begin
318   --
319   hr_utility.set_location('Entering:'||l_proc, 5);
320   --
321   -- Convert arguments into local l_rec structure.
322   --
323   l_rec.popl_yr_perd_id                  := p_popl_yr_perd_id;
324   l_rec.yr_perd_id                       := p_yr_perd_id;
325   l_rec.business_group_id                := p_business_group_id;
326   l_rec.pl_id                            := p_pl_id;
327   l_rec.pgm_id                           := p_pgm_id;
328   l_rec.ordr_num                         := p_ordr_num;
329   l_rec.acpt_clm_rqsts_thru_dt           := p_acpt_clm_rqsts_thru_dt;
330   l_rec.py_clms_thru_dt                  := p_py_clms_thru_dt;
331   l_rec.cpy_attribute_category           := p_cpy_attribute_category;
332   l_rec.cpy_attribute1                   := p_cpy_attribute1;
333   l_rec.cpy_attribute2                   := p_cpy_attribute2;
334   l_rec.cpy_attribute3                   := p_cpy_attribute3;
335   l_rec.cpy_attribute4                   := p_cpy_attribute4;
336   l_rec.cpy_attribute5                   := p_cpy_attribute5;
337   l_rec.cpy_attribute6                   := p_cpy_attribute6;
338   l_rec.cpy_attribute7                   := p_cpy_attribute7;
339   l_rec.cpy_attribute8                   := p_cpy_attribute8;
340   l_rec.cpy_attribute9                   := p_cpy_attribute9;
341   l_rec.cpy_attribute10                  := p_cpy_attribute10;
342   l_rec.cpy_attribute11                  := p_cpy_attribute11;
343   l_rec.cpy_attribute12                  := p_cpy_attribute12;
344   l_rec.cpy_attribute13                  := p_cpy_attribute13;
345   l_rec.cpy_attribute14                  := p_cpy_attribute14;
346   l_rec.cpy_attribute15                  := p_cpy_attribute15;
347   l_rec.cpy_attribute16                  := p_cpy_attribute16;
348   l_rec.cpy_attribute17                  := p_cpy_attribute17;
349   l_rec.cpy_attribute18                  := p_cpy_attribute18;
350   l_rec.cpy_attribute19                  := p_cpy_attribute19;
351   l_rec.cpy_attribute20                  := p_cpy_attribute20;
352   l_rec.cpy_attribute21                  := p_cpy_attribute21;
353   l_rec.cpy_attribute22                  := p_cpy_attribute22;
354   l_rec.cpy_attribute23                  := p_cpy_attribute23;
355   l_rec.cpy_attribute24                  := p_cpy_attribute24;
356   l_rec.cpy_attribute25                  := p_cpy_attribute25;
357   l_rec.cpy_attribute26                  := p_cpy_attribute26;
358   l_rec.cpy_attribute27                  := p_cpy_attribute27;
359   l_rec.cpy_attribute28                  := p_cpy_attribute28;
360   l_rec.cpy_attribute29                  := p_cpy_attribute29;
361   l_rec.cpy_attribute30                  := p_cpy_attribute30;
362   l_rec.object_version_number            := p_object_version_number;
363   --
364   -- Return the plsql record structure.
365   --
366   hr_utility.set_location(' Leaving:'||l_proc, 10);
367   Return(l_rec);
368 --
369 End convert_args;
370 --
371 end ben_cpy_shd;