DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_ILP_SHD

Source


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