[Home] [Help]
PACKAGE BODY: APPS.OTA_CTU_SHD
Source
4 -- ----------------------------------------------------------------------------
1 Package Body ota_ctu_shd as
2 /* $Header: otcturhi.pkb 120.2.12010000.2 2009/07/24 10:53:50 shwnayak ship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_ctu_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 Begin
17 --
18 Return (nvl(g_api_dml, false));
19 --
20 End return_api_dml_status;
21 --
22 -- ----------------------------------------------------------------------------
23 -- |---------------------------< constraint_error >---------------------------|
24 -- ----------------------------------------------------------------------------
25 Procedure constraint_error
26 (p_constraint_name in all_constraints.constraint_name%TYPE
27 ) Is
28 --
29 l_proc varchar2(72) := g_package||'constraint_error';
30 --
31 Begin
32 --
33 If (p_constraint_name = 'OTA_CATEGORY_USAGES_PK') Then
34 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
35 fnd_message.set_token('PROCEDURE', l_proc);
36 fnd_message.set_token('STEP','5');
37 fnd_message.raise_error;
38 ElsIf (p_constraint_name = 'OTA_CATEGORY_USAGES_UK2') Then
39 fnd_message.set_name('OTA', 'OTA_443337_CTU_DUP_NAME');
40 fnd_message.raise_error;
41 ElsIf (p_constraint_name = 'OTA_TCU_START_DATE_ACTIVE_CHK') Then
42 fnd_message.set_name('OTA', 'OTA_13312_GEN_DATE_ORDER');
43 fnd_message.raise_error;
44 ElsIf (p_constraint_name = 'OTA_TCU_TYPE_CHK') Then
45 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
46 fnd_message.set_token('PROCEDURE', l_proc);
47 fnd_message.set_token('STEP','20');
48 fnd_message.raise_error;
49 Else
50 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
51 fnd_message.set_token('PROCEDURE', l_proc);
52 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
53 fnd_message.raise_error;
54 End If;
55 --
56 End constraint_error;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |-----------------------------< api_updating >-----------------------------|
60 -- ----------------------------------------------------------------------------
61 Function api_updating
62 (p_category_usage_id in number
63 ,p_object_version_number in number
64 )
65 Return Boolean Is
66 --
67 --
68 -- Cursor selects the 'current' row from the HR Schema
69 --
70 Cursor C_Sel1 is
71 select
72 category_usage_id
73 ,business_group_id
74 ,category
75 ,object_version_number
76 ,type
77 ,start_date_active
78 ,end_date_active
79 ,parent_cat_usage_id
80 ,synchronous_flag
81 ,online_flag
82 ,attribute_category
83 ,attribute1
84 ,attribute2
85 ,attribute3
86 ,attribute4
87 ,attribute5
88 ,attribute6
89 ,attribute7
90 ,attribute8
91 ,attribute9
92 ,attribute10
93 ,attribute11
94 ,attribute12
95 ,attribute13
96 ,attribute14
97 ,attribute15
98 ,attribute16
99 ,attribute17
100 ,attribute18
101 ,attribute19
102 ,attribute20
103 ,data_source
104 ,comments
105 ,user_group_id
106 from ota_category_usages
107 where category_usage_id = p_category_usage_id;
108 --
109 l_fct_ret boolean;
110 --
111 Begin
112 --
113 If (p_category_usage_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_category_usage_id
123 = ota_ctu_shd.g_old_rec.category_usage_id and
124 p_object_version_number
125 = ota_ctu_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 ota_ctu_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
151 End If;
148 <> ota_ctu_shd.g_old_rec.object_version_number) Then
149 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
150 fnd_message.raise_error;
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_category_usage_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 category_usage_id
172 ,business_group_id
173 ,category
174 ,object_version_number
175 ,type
176 ,start_date_active
177 ,end_date_active
178 ,parent_cat_usage_id
179 ,synchronous_flag
180 ,online_flag
181 ,attribute_category
182 ,attribute1
183 ,attribute2
184 ,attribute3
185 ,attribute4
186 ,attribute5
187 ,attribute6
188 ,attribute7
189 ,attribute8
190 ,attribute9
191 ,attribute10
192 ,attribute11
193 ,attribute12
194 ,attribute13
195 ,attribute14
196 ,attribute15
197 ,attribute16
198 ,attribute17
199 ,attribute18
200 ,attribute19
201 ,attribute20
202 ,data_source
203 ,comments
204 ,user_group_id
205 from ota_category_usages
206 where category_usage_id = p_category_usage_id
207 for update nowait;
208 --
209 l_proc varchar2(72) := g_package||'lck';
210 --
211 Begin
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 hr_api.mandatory_arg_error
215 (p_api_name => l_proc
216 ,p_argument => 'CATEGORY_USAGE_ID'
217 ,p_argument_value => p_category_usage_id
218 );
219 hr_utility.set_location(l_proc,6);
220 hr_api.mandatory_arg_error
221 (p_api_name => l_proc
222 ,p_argument => 'OBJECT_VERSION_NUMBER'
223 ,p_argument_value => p_object_version_number
224 );
225 --
226 Open C_Sel1;
227 Fetch C_Sel1 Into ota_ctu_shd.g_old_rec;
228 If C_Sel1%notfound then
229 Close C_Sel1;
230 --
231 -- The primary key is invalid therefore we must error
232 --
233 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
234 fnd_message.raise_error;
235 End If;
236 Close C_Sel1;
237 If (p_object_version_number
238 <> ota_ctu_shd.g_old_rec.object_version_number) Then
239 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
240 fnd_message.raise_error;
241 End If;
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 --
245 -- We need to trap the ORA LOCK exception
246 --
247 Exception
248 When HR_Api.Object_Locked then
249 --
250 -- The object is locked therefore we need to supply a meaningful
251 -- error message.
252 --
253 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
254 fnd_message.set_token('TABLE_NAME', 'ota_category_usages');
255 fnd_message.raise_error;
256 End lck;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |-----------------------------< convert_args >-----------------------------|
260 -- ----------------------------------------------------------------------------
261 Function convert_args
262 (p_category_usage_id in number
263 ,p_business_group_id in number
264 ,p_category in varchar2
265 ,p_object_version_number in number
266 ,p_type in varchar2
267 ,p_start_date_active in date
268 ,p_end_date_active in date
269 ,p_parent_cat_usage_id in number
270 ,p_synchronous_flag in varchar2
271 ,p_online_flag in varchar2
272 ,p_attribute_category in varchar2
273 ,p_attribute1 in varchar2
274 ,p_attribute2 in varchar2
275 ,p_attribute3 in varchar2
276 ,p_attribute4 in varchar2
277 ,p_attribute5 in varchar2
278 ,p_attribute6 in varchar2
279 ,p_attribute7 in varchar2
280 ,p_attribute8 in varchar2
281 ,p_attribute9 in varchar2
282 ,p_attribute10 in varchar2
283 ,p_attribute11 in varchar2
284 ,p_attribute12 in varchar2
285 ,p_attribute13 in varchar2
286 ,p_attribute14 in varchar2
287 ,p_attribute15 in varchar2
288 ,p_attribute16 in varchar2
289 ,p_attribute17 in varchar2
290 ,p_attribute18 in varchar2
291 ,p_attribute19 in varchar2
292 ,p_attribute20 in varchar2
293 ,p_data_source in varchar2
294 ,p_comments in varchar2
298 --
295 ,p_user_group_id in number default null
296 )
297 Return g_rec_type is
299 l_rec g_rec_type;
300 --
301 Begin
302 --
303 -- Convert arguments into local l_rec structure.
304 --
305 l_rec.category_usage_id := p_category_usage_id;
306 l_rec.business_group_id := p_business_group_id;
307 l_rec.category := p_category;
308 l_rec.object_version_number := p_object_version_number;
309 l_rec.type := p_type;
310 l_rec.start_date_active := p_start_date_active;
311 l_rec.end_date_active := p_end_date_active;
312 l_rec.parent_cat_usage_id := p_parent_cat_usage_id;
313 l_rec.synchronous_flag := p_synchronous_flag;
314 l_rec.online_flag := p_online_flag;
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.data_source := p_data_source;
337 l_rec.comments := p_comments;
338 l_rec.user_group_id := p_user_group_id;
339 --
340 -- Return the plsql record structure.
341 --
342 Return(l_rec);
343 --
344 End convert_args;
345 --
346 end ota_ctu_shd;