[Home] [Help]
PACKAGE BODY: APPS.OTA_CTU_SHD
Source
1 Package Body ota_ctu_shd as
2 /* $Header: otcturhi.pkb 120.2 2005/09/29 05:31:13 pgupta noship $ */
3 --
4 -- ----------------------------------------------------------------------------
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 from ota_category_usages
106 where category_usage_id = p_category_usage_id;
107 --
108 l_fct_ret boolean;
109 --
110 Begin
111 --
112 If (p_category_usage_id is null and
113 p_object_version_number is null
114 ) Then
115 --
116 -- One of the primary key arguments is null therefore we must
117 -- set the returning function value to false
118 --
119 l_fct_ret := false;
120 Else
121 If (p_category_usage_id
122 = ota_ctu_shd.g_old_rec.category_usage_id and
123 p_object_version_number
124 = ota_ctu_shd.g_old_rec.object_version_number
125 ) Then
126 --
127 -- The g_old_rec is current therefore we must
128 -- set the returning function to true
129 --
130 l_fct_ret := true;
131 Else
132 --
133 -- Select the current row into g_old_rec
134 --
135 Open C_Sel1;
136 Fetch C_Sel1 Into ota_ctu_shd.g_old_rec;
137 If C_Sel1%notfound Then
138 Close C_Sel1;
139 --
140 -- The primary key is invalid therefore we must error
141 --
142 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
143 fnd_message.raise_error;
144 End If;
145 Close C_Sel1;
146 If (p_object_version_number
147 <> ota_ctu_shd.g_old_rec.object_version_number) Then
148 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
149 fnd_message.raise_error;
150 End If;
151 l_fct_ret := true;
152 End If;
153 End If;
154 Return (l_fct_ret);
155 --
156 End api_updating;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------------< lck >----------------------------------|
160 -- ----------------------------------------------------------------------------
161 Procedure lck
162 (p_category_usage_id in number
163 ,p_object_version_number in number
164 ) is
165 --
166 -- Cursor selects the 'current' row from the HR Schema
167 --
168 Cursor C_Sel1 is
169 select
170 category_usage_id
171 ,business_group_id
172 ,category
173 ,object_version_number
174 ,type
175 ,start_date_active
176 ,end_date_active
177 ,parent_cat_usage_id
178 ,synchronous_flag
179 ,online_flag
180 ,attribute_category
181 ,attribute1
182 ,attribute2
183 ,attribute3
184 ,attribute4
185 ,attribute5
186 ,attribute6
187 ,attribute7
188 ,attribute8
189 ,attribute9
190 ,attribute10
191 ,attribute11
192 ,attribute12
193 ,attribute13
194 ,attribute14
195 ,attribute15
196 ,attribute16
197 ,attribute17
198 ,attribute18
199 ,attribute19
200 ,attribute20
201 ,data_source
202 ,comments
203 from ota_category_usages
204 where category_usage_id = p_category_usage_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 => 'CATEGORY_USAGE_ID'
215 ,p_argument_value => p_category_usage_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 ota_ctu_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 <> ota_ctu_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', 'ota_category_usages');
253 fnd_message.raise_error;
254 End lck;
255 --
256 -- ----------------------------------------------------------------------------
257 -- |-----------------------------< convert_args >-----------------------------|
258 -- ----------------------------------------------------------------------------
259 Function convert_args
260 (p_category_usage_id in number
261 ,p_business_group_id in number
262 ,p_category in varchar2
263 ,p_object_version_number in number
264 ,p_type in varchar2
265 ,p_start_date_active in date
266 ,p_end_date_active in date
267 ,p_parent_cat_usage_id in number
268 ,p_synchronous_flag in varchar2
269 ,p_online_flag in varchar2
270 ,p_attribute_category in varchar2
271 ,p_attribute1 in varchar2
272 ,p_attribute2 in varchar2
273 ,p_attribute3 in varchar2
274 ,p_attribute4 in varchar2
275 ,p_attribute5 in varchar2
276 ,p_attribute6 in varchar2
277 ,p_attribute7 in varchar2
278 ,p_attribute8 in varchar2
279 ,p_attribute9 in varchar2
280 ,p_attribute10 in varchar2
281 ,p_attribute11 in varchar2
282 ,p_attribute12 in varchar2
283 ,p_attribute13 in varchar2
284 ,p_attribute14 in varchar2
285 ,p_attribute15 in varchar2
286 ,p_attribute16 in varchar2
287 ,p_attribute17 in varchar2
288 ,p_attribute18 in varchar2
289 ,p_attribute19 in varchar2
290 ,p_attribute20 in varchar2
291 ,p_data_source in varchar2
292 ,p_comments in varchar2
293 )
294 Return g_rec_type is
295 --
296 l_rec g_rec_type;
297 --
298 Begin
299 --
300 -- Convert arguments into local l_rec structure.
301 --
302 l_rec.category_usage_id := p_category_usage_id;
303 l_rec.business_group_id := p_business_group_id;
304 l_rec.category := p_category;
305 l_rec.object_version_number := p_object_version_number;
306 l_rec.type := p_type;
307 l_rec.start_date_active := p_start_date_active;
308 l_rec.end_date_active := p_end_date_active;
309 l_rec.parent_cat_usage_id := p_parent_cat_usage_id;
310 l_rec.synchronous_flag := p_synchronous_flag;
311 l_rec.online_flag := p_online_flag;
312 l_rec.attribute_category := p_attribute_category;
313 l_rec.attribute1 := p_attribute1;
314 l_rec.attribute2 := p_attribute2;
315 l_rec.attribute3 := p_attribute3;
316 l_rec.attribute4 := p_attribute4;
317 l_rec.attribute5 := p_attribute5;
318 l_rec.attribute6 := p_attribute6;
319 l_rec.attribute7 := p_attribute7;
320 l_rec.attribute8 := p_attribute8;
321 l_rec.attribute9 := p_attribute9;
322 l_rec.attribute10 := p_attribute10;
323 l_rec.attribute11 := p_attribute11;
324 l_rec.attribute12 := p_attribute12;
325 l_rec.attribute13 := p_attribute13;
326 l_rec.attribute14 := p_attribute14;
327 l_rec.attribute15 := p_attribute15;
328 l_rec.attribute16 := p_attribute16;
329 l_rec.attribute17 := p_attribute17;
330 l_rec.attribute18 := p_attribute18;
331 l_rec.attribute19 := p_attribute19;
332 l_rec.attribute20 := p_attribute20;
333 l_rec.data_source := p_data_source;
334 l_rec.comments := p_comments;
335 --
336 -- Return the plsql record structure.
337 --
338 Return(l_rec);
339 --
340 End convert_args;
341 --
342 end ota_ctu_shd;