DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IDP_SHD

Source


1 Package Body irc_idp_shd as
2 /* $Header: iridprhi.pkb 120.0.12010000.2 2008/08/05 10:49:00 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_idp_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'IRC_DEFAULT_POSTINGS_FK2') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'IRC_DEFAULT_POSTINGS_FK3') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'IRC_DEFAULT_POSTINGS_PK') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   Else
48     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51     fnd_message.raise_error;
52   End If;
53   --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (p_default_posting_id                   in     number
61   ,p_object_version_number                in     number
62   )
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        default_posting_id
71       ,position_id
72       ,job_id
73       ,attribute_category
74       ,organization_id
75       ,attribute1
76       ,attribute2
77       ,attribute3
78       ,attribute4
79       ,attribute5
80       ,attribute6
81       ,attribute7
82       ,attribute8
83       ,attribute9
84       ,attribute10
85       ,attribute11
86       ,attribute12
87       ,attribute13
88       ,attribute14
89       ,attribute15
90       ,attribute16
91       ,attribute17
92       ,attribute18
93       ,attribute19
94       ,attribute20
95       ,attribute21
96       ,attribute22
97       ,attribute23
98       ,attribute24
99       ,attribute25
100       ,attribute26
101       ,attribute27
102       ,attribute28
103       ,attribute29
104       ,attribute30
105       ,object_version_number
106     from        irc_default_postings
107     where       default_posting_id = p_default_posting_id;
108   --
109   l_fct_ret     boolean;
110   --
111 Begin
112   --
113   If (p_default_posting_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_default_posting_id
123         = irc_idp_shd.g_old_rec.default_posting_id and
124         p_object_version_number
125         = irc_idp_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 irc_idp_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           <> irc_idp_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_default_posting_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        default_posting_id
172       ,position_id
173       ,job_id
174       ,attribute_category
175       ,organization_id
176       ,attribute1
177       ,attribute2
178       ,attribute3
179       ,attribute4
180       ,attribute5
181       ,attribute6
182       ,attribute7
183       ,attribute8
184       ,attribute9
185       ,attribute10
186       ,attribute11
187       ,attribute12
188       ,attribute13
189       ,attribute14
190       ,attribute15
191       ,attribute16
192       ,attribute17
193       ,attribute18
194       ,attribute19
195       ,attribute20
196       ,attribute21
197       ,attribute22
198       ,attribute23
199       ,attribute24
200       ,attribute25
201       ,attribute26
202       ,attribute27
203       ,attribute28
204       ,attribute29
205       ,attribute30
206       ,object_version_number
207     from        irc_default_postings
208     where       default_posting_id = p_default_posting_id
209     for update nowait;
210 --
211   l_proc        varchar2(72) := g_package||'lck';
212 --
213 Begin
214   hr_utility.set_location('Entering:'||l_proc, 5);
215   --
216   hr_api.mandatory_arg_error
217     (p_api_name           => l_proc
218     ,p_argument           => 'DEFAULT_POSTING_ID'
219     ,p_argument_value     => p_default_posting_id
220     );
221   hr_utility.set_location(l_proc,6);
222   hr_api.mandatory_arg_error
223     (p_api_name           => l_proc
224     ,p_argument           => 'OBJECT_VERSION_NUMBER'
225     ,p_argument_value     => p_object_version_number
226     );
227   --
228   Open  C_Sel1;
229   Fetch C_Sel1 Into irc_idp_shd.g_old_rec;
230   If C_Sel1%notfound then
231     Close C_Sel1;
232     --
233     -- The primary key is invalid therefore we must error
234     --
235     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
236     fnd_message.raise_error;
237   End If;
238   Close C_Sel1;
239   If (p_object_version_number
240       <> irc_idp_shd.g_old_rec.object_version_number) Then
241         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
242         fnd_message.raise_error;
243   End If;
244   --
245   hr_utility.set_location(' Leaving:'||l_proc, 10);
246   --
247   -- We need to trap the ORA LOCK exception
248   --
249 Exception
250   When HR_Api.Object_Locked then
251     --
252     -- The object is locked therefore we need to supply a meaningful
253     -- error message.
254     --
255     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
256     fnd_message.set_token('TABLE_NAME', 'irc_default_postings');
257     fnd_message.raise_error;
258 End lck;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |-----------------------------< convert_args >-----------------------------|
262 -- ----------------------------------------------------------------------------
263 Function convert_args
264   (p_default_posting_id             in number
265   ,p_position_id                    in number
266   ,p_job_id                         in number
267   ,p_attribute_category             in varchar2
268   ,p_organization_id                in number
269   ,p_attribute1                     in varchar2
270   ,p_attribute2                     in varchar2
271   ,p_attribute3                     in varchar2
272   ,p_attribute4                     in varchar2
273   ,p_attribute5                     in varchar2
274   ,p_attribute6                     in varchar2
275   ,p_attribute7                     in varchar2
276   ,p_attribute8                     in varchar2
277   ,p_attribute9                     in varchar2
278   ,p_attribute10                    in varchar2
279   ,p_attribute11                    in varchar2
280   ,p_attribute12                    in varchar2
281   ,p_attribute13                    in varchar2
282   ,p_attribute14                    in varchar2
283   ,p_attribute15                    in varchar2
284   ,p_attribute16                    in varchar2
285   ,p_attribute17                    in varchar2
286   ,p_attribute18                    in varchar2
287   ,p_attribute19                    in varchar2
288   ,p_attribute20                    in varchar2
289   ,p_attribute21                    in varchar2
290   ,p_attribute22                    in varchar2
291   ,p_attribute23                    in varchar2
292   ,p_attribute24                    in varchar2
293   ,p_attribute25                    in varchar2
294   ,p_attribute26                    in varchar2
295   ,p_attribute27                    in varchar2
296   ,p_attribute28                    in varchar2
297   ,p_attribute29                    in varchar2
298   ,p_attribute30                    in varchar2
299   ,p_object_version_number          in number
300   )
301   Return g_rec_type is
302 --
303   l_rec   g_rec_type;
304 --
305 Begin
306   --
307   -- Convert arguments into local l_rec structure.
308   --
309   l_rec.default_posting_id               := p_default_posting_id;
310   l_rec.position_id                      := p_position_id;
311   l_rec.job_id                           := p_job_id;
312   l_rec.attribute_category               := p_attribute_category;
313   l_rec.organization_id                  := p_organization_id;
314   l_rec.attribute1                       := p_attribute1;
315   l_rec.attribute2                       := p_attribute2;
316   l_rec.attribute3                       := p_attribute3;
317   l_rec.attribute4                       := p_attribute4;
318   l_rec.attribute5                       := p_attribute5;
319   l_rec.attribute6                       := p_attribute6;
320   l_rec.attribute7                       := p_attribute7;
321   l_rec.attribute8                       := p_attribute8;
322   l_rec.attribute9                       := p_attribute9;
323   l_rec.attribute10                      := p_attribute10;
324   l_rec.attribute11                      := p_attribute11;
325   l_rec.attribute12                      := p_attribute12;
326   l_rec.attribute13                      := p_attribute13;
327   l_rec.attribute14                      := p_attribute14;
328   l_rec.attribute15                      := p_attribute15;
329   l_rec.attribute16                      := p_attribute16;
330   l_rec.attribute17                      := p_attribute17;
331   l_rec.attribute18                      := p_attribute18;
332   l_rec.attribute19                      := p_attribute19;
333   l_rec.attribute20                      := p_attribute20;
334   l_rec.attribute21                      := p_attribute21;
335   l_rec.attribute22                      := p_attribute22;
336   l_rec.attribute23                      := p_attribute23;
337   l_rec.attribute24                      := p_attribute24;
338   l_rec.attribute25                      := p_attribute25;
339   l_rec.attribute26                      := p_attribute26;
340   l_rec.attribute27                      := p_attribute27;
341   l_rec.attribute28                      := p_attribute28;
342   l_rec.attribute29                      := p_attribute29;
343   l_rec.attribute30                      := p_attribute30;
344   l_rec.object_version_number            := p_object_version_number;
345   --
346   -- Return the plsql record structure.
347   --
348   Return(l_rec);
349 --
350 End convert_args;
351 --
352 end irc_idp_shd;