DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PMA_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body pay_pma_shd as
2 /* $Header: pypmarhi.pkb 115.2 2002/12/11 11:12:57 ssivasu2 noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pma_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 = 'PAY_CA_PMED_ACCOUNTS_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 = 'PAY_CA_PMED_ACCOUNTS_FK2') 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   ElsIf (p_constraint_name = 'PAY_CA_PMED_ACCOUNTS_PK') Then
47     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('STEP','15');
50     hr_utility.raise_error;
51   Else
52     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
55     hr_utility.raise_error;
56   End If;
57   --
58   hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65   (
66   p_source_id                          in number,
67   p_object_version_number              in number
68   )      Return Boolean Is
69 --
70   --
71   -- Cursor selects the 'current' row from the HR Schema
72   --
73   Cursor C_Sel1 is
74     select
75 		organization_id,
76 	source_id,
77 	account_number,
78 	enabled,
79 	description,
80 	business_group_id,
81 	attribute_category,
82 	attribute1,
83 	attribute2,
84 	attribute3,
85 	attribute4,
86 	attribute5,
87 	attribute6,
88 	attribute7,
89 	attribute8,
90 	attribute9,
91 	attribute10,
92 	attribute11,
93 	attribute12,
94 	attribute13,
95 	attribute14,
96 	attribute15,
97 	attribute16,
98 	attribute17,
99 	attribute18,
100 	attribute19,
101 	attribute20,
102 	attribute21,
103 	attribute22,
104 	attribute23,
105 	attribute24,
106 	attribute25,
107 	attribute26,
108 	attribute27,
109 	attribute28,
110 	attribute29,
111 	attribute30,
112 	object_version_number
113     from	pay_ca_pmed_accounts
114     where	source_id = p_source_id;
115 --
116   l_proc	varchar2(72)	:= g_package||'api_updating';
117   l_fct_ret	boolean;
118 --
119 Begin
120   hr_utility.set_location('Entering:'||l_proc, 5);
121   --
122   If (
123 	p_source_id is null and
124 	p_object_version_number is null
125      ) Then
126     --
127     -- One of the primary key arguments is null therefore we must
128     -- set the returning function value to false
129     --
130     l_fct_ret := false;
131   Else
132     If (
133 	p_source_id = g_old_rec.source_id and
134 	p_object_version_number = g_old_rec.object_version_number
135        ) Then
136       hr_utility.set_location(l_proc, 10);
137       --
138       -- The g_old_rec is current therefore we must
139       -- set the returning function to true
140       --
141       l_fct_ret := true;
142     Else
143       --
144       -- Select the current row into g_old_rec
145       --
146       Open C_Sel1;
147       Fetch C_Sel1 Into g_old_rec;
151         -- The primary key is invalid therefore we must error
148       If C_Sel1%notfound Then
149         Close C_Sel1;
150         --
152         --
153         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
154         hr_utility.raise_error;
155       End If;
156       Close C_Sel1;
157       If (p_object_version_number <> g_old_rec.object_version_number) Then
158         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
159         hr_utility.raise_error;
160       End If;
161       hr_utility.set_location(l_proc, 15);
162       l_fct_ret := true;
163     End If;
164   End If;
165   hr_utility.set_location(' Leaving:'||l_proc, 20);
166   Return (l_fct_ret);
167 --
168 End api_updating;
169 --
170 -- ----------------------------------------------------------------------------
171 -- |---------------------------------< lck >----------------------------------|
172 -- ----------------------------------------------------------------------------
173 Procedure lck
174   (
175   p_source_id                          in number,
176   p_object_version_number              in number
177   ) is
178 --
179 -- Cursor selects the 'current' row from the HR Schema
180 --
181   Cursor C_Sel1 is
182     select 	organization_id,
183 	source_id,
184 	account_number,
185 	enabled,
186 	description,
187 	business_group_id,
188 	attribute_category,
189 	attribute1,
193 	attribute5,
190 	attribute2,
191 	attribute3,
192 	attribute4,
194 	attribute6,
195 	attribute7,
196 	attribute8,
197 	attribute9,
198 	attribute10,
199 	attribute11,
200 	attribute12,
201 	attribute13,
202 	attribute14,
203 	attribute15,
204 	attribute16,
205 	attribute17,
206 	attribute18,
207 	attribute19,
208 	attribute20,
209 	attribute21,
210 	attribute22,
211 	attribute23,
212 	attribute24,
213 	attribute25,
214 	attribute26,
215 	attribute27,
216 	attribute28,
217 	attribute29,
218 	attribute30,
219 	object_version_number
220     from	pay_ca_pmed_accounts
221     where	source_id = p_source_id
222     for	update nowait;
223 --
224   l_proc	varchar2(72) := g_package||'lck';
225 --
226 Begin
227   hr_utility.set_location('Entering:'||l_proc, 5);
228   --
229   -- Add any mandatory argument checking here:
230   -- Example:
231   -- hr_api.mandatory_arg_error
232   --   (p_api_name       => l_proc,
233   --    p_argument       => 'object_version_number',
234   --    p_argument_value => p_object_version_number);
235   --
236   Open  C_Sel1;
237   Fetch C_Sel1 Into g_old_rec;
238   If C_Sel1%notfound then
239     Close C_Sel1;
240     --
241     -- The primary key is invalid therefore we must error
242     --
243     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
244     hr_utility.raise_error;
245   End If;
246   Close C_Sel1;
247   If (p_object_version_number <> g_old_rec.object_version_number) Then
248         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
249         hr_utility.raise_error;
250       End If;
251 --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253 --
254 -- We need to trap the ORA LOCK exception
255 --
256 Exception
257   When HR_Api.Object_Locked then
258     --
259     -- The object is locked therefore we need to supply a meaningful
260     -- error message.
261     --
262     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
263     hr_utility.set_message_token('TABLE_NAME', 'pay_ca_pmed_accounts');
264     hr_utility.raise_error;
265 End lck;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |-----------------------------< convert_args >-----------------------------|
269 -- ----------------------------------------------------------------------------
270 Function convert_args
271 	(
272 	p_organization_id               in number,
273 	p_source_id                     in number,
274 	p_account_number                in varchar2,
275 	p_enabled                       in varchar2,
276 	p_description                   in varchar2,
277 	p_business_group_id             in number,
278 	p_attribute_category            in varchar2,
279 	p_attribute1                    in varchar2,
280 	p_attribute2                    in varchar2,
281 	p_attribute3                    in varchar2,
282 	p_attribute4                    in varchar2,
283 	p_attribute5                    in varchar2,
284 	p_attribute6                    in varchar2,
285 	p_attribute7                    in varchar2,
286 	p_attribute8                    in varchar2,
287 	p_attribute9                    in varchar2,
288 	p_attribute10                   in varchar2,
289 	p_attribute11                   in varchar2,
290 	p_attribute12                   in varchar2,
291 	p_attribute13                   in varchar2,
292 	p_attribute14                   in varchar2,
293 	p_attribute15                   in varchar2,
294 	p_attribute16                   in varchar2,
295 	p_attribute17                   in varchar2,
296 	p_attribute18                   in varchar2,
297 	p_attribute19                   in varchar2,
298 	p_attribute20                   in varchar2,
299 	p_attribute21                   in varchar2,
300 	p_attribute22                   in varchar2,
301 	p_attribute23                   in varchar2,
302 	p_attribute24                   in varchar2,
303 	p_attribute25                   in varchar2,
304 	p_attribute26                   in varchar2,
305 	p_attribute27                   in varchar2,
306 	p_attribute28                   in varchar2,
307 	p_attribute29                   in varchar2,
308 	p_attribute30                   in varchar2,
309 	p_object_version_number         in number
310 	)
311 	Return g_rec_type is
312 --
313   l_rec	  g_rec_type;
314   l_proc  varchar2(72) := g_package||'convert_args';
315 --
316 Begin
317   --
318   hr_utility.set_location('Entering:'||l_proc, 5);
319   --
320   -- Convert arguments into local l_rec structure.
321   --
322   l_rec.organization_id                  := p_organization_id;
323   l_rec.source_id                        := p_source_id;
324   l_rec.account_number                   := p_account_number;
325   l_rec.enabled                          := p_enabled;
326   l_rec.description                      := p_description;
327   l_rec.business_group_id                := p_business_group_id;
328   l_rec.attribute_category               := p_attribute_category;
329   l_rec.attribute1                       := p_attribute1;
330   l_rec.attribute2                       := p_attribute2;
331   l_rec.attribute3                       := p_attribute3;
332   l_rec.attribute4                       := p_attribute4;
333   l_rec.attribute5                       := p_attribute5;
334   l_rec.attribute6                       := p_attribute6;
335   l_rec.attribute7                       := p_attribute7;
336   l_rec.attribute8                       := p_attribute8;
340   l_rec.attribute12                      := p_attribute12;
337   l_rec.attribute9                       := p_attribute9;
338   l_rec.attribute10                      := p_attribute10;
339   l_rec.attribute11                      := p_attribute11;
341   l_rec.attribute13                      := p_attribute13;
342   l_rec.attribute14                      := p_attribute14;
343   l_rec.attribute15                      := p_attribute15;
344   l_rec.attribute16                      := p_attribute16;
345   l_rec.attribute17                      := p_attribute17;
346   l_rec.attribute18                      := p_attribute18;
347   l_rec.attribute19                      := p_attribute19;
348   l_rec.attribute20                      := p_attribute20;
349   l_rec.attribute21                      := p_attribute21;
350   l_rec.attribute22                      := p_attribute22;
351   l_rec.attribute23                      := p_attribute23;
352   l_rec.attribute24                      := p_attribute24;
356   l_rec.attribute28                      := p_attribute28;
353   l_rec.attribute25                      := p_attribute25;
354   l_rec.attribute26                      := p_attribute26;
355   l_rec.attribute27                      := p_attribute27;
357   l_rec.attribute29                      := p_attribute29;
358   l_rec.attribute30                      := p_attribute30;
359   l_rec.object_version_number            := p_object_version_number;
360   --
361   -- Return the plsql record structure.
362   --
363   hr_utility.set_location(' Leaving:'||l_proc, 10);
364   Return(l_rec);
365 --
366 End convert_args;
367 --
368 end pay_pma_shd;