[Home] [Help]
PACKAGE BODY: APPS.OTA_ANC_SHD
Source
1 Package Body ota_anc_shd as
2 /* $Header: otancrhi.pkb 115.0 2003/12/01 05:59:22 arkashya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_anc_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'OTA_ANNOUNCEMENTS_PK1') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_announcement_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 announcement_id
50 ,business_group_id
51 ,object_version_number
52 ,start_date_active
53 ,end_date_active
54 ,owner_id
55 ,attribute_category
56 ,attribute1
57 ,attribute2
58 ,attribute3
59 ,attribute4
60 ,attribute5
61 ,attribute6
62 ,attribute7
63 ,attribute8
64 ,attribute9
65 ,attribute10
66 ,attribute11
67 ,attribute12
68 ,attribute13
69 ,attribute14
70 ,attribute15
71 ,attribute16
72 ,attribute17
73 ,attribute18
74 ,attribute19
75 ,attribute20
76 from ota_announcements
77 where announcement_id = p_announcement_id;
78 --
79 l_fct_ret boolean;
80 --
81 Begin
82 --
83 If (p_announcement_id is null and
84 p_object_version_number is null
85 ) Then
86 --
87 -- One of the primary key arguments is null therefore we must
88 -- set the returning function value to false
89 --
90 l_fct_ret := false;
91 Else
92 If (p_announcement_id
93 = ota_anc_shd.g_old_rec.announcement_id and
94 p_object_version_number
95 = ota_anc_shd.g_old_rec.object_version_number
96 ) Then
97 --
98 -- The g_old_rec is current therefore we must
99 -- set the returning function to true
100 --
101 l_fct_ret := true;
102 Else
103 --
104 -- Select the current row into g_old_rec
105 --
106 Open C_Sel1;
107 Fetch C_Sel1 Into ota_anc_shd.g_old_rec;
108 If C_Sel1%notfound Then
109 Close C_Sel1;
110 --
111 -- The primary key is invalid therefore we must error
112 --
113 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
114 fnd_message.raise_error;
115 End If;
116 Close C_Sel1;
117 If (p_object_version_number
118 <> ota_anc_shd.g_old_rec.object_version_number) Then
119 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
120 fnd_message.raise_error;
121 End If;
122 l_fct_ret := true;
123 End If;
124 End If;
125 Return (l_fct_ret);
126 --
127 End api_updating;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------------< lck >----------------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure lck
133 (p_announcement_id in number
134 ,p_object_version_number in number
135 ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139 Cursor C_Sel1 is
140 select
141 announcement_id
142 ,business_group_id
143 ,object_version_number
144 ,start_date_active
145 ,end_date_active
146 ,owner_id
147 ,attribute_category
148 ,attribute1
149 ,attribute2
150 ,attribute3
151 ,attribute4
152 ,attribute5
153 ,attribute6
154 ,attribute7
155 ,attribute8
156 ,attribute9
157 ,attribute10
158 ,attribute11
159 ,attribute12
160 ,attribute13
161 ,attribute14
162 ,attribute15
163 ,attribute16
164 ,attribute17
165 ,attribute18
166 ,attribute19
167 ,attribute20
168 from ota_announcements
169 where announcement_id = p_announcement_id
170 for update nowait;
171 --
172 l_proc varchar2(72) := g_package||'lck';
173 --
174 Begin
175 hr_utility.set_location('Entering:'||l_proc, 5);
176 --
177 hr_api.mandatory_arg_error
178 (p_api_name => l_proc
179 ,p_argument => 'ANNOUNCEMENT_ID'
180 ,p_argument_value => p_announcement_id
181 );
182 hr_utility.set_location(l_proc,6);
183 hr_api.mandatory_arg_error
184 (p_api_name => l_proc
185 ,p_argument => 'OBJECT_VERSION_NUMBER'
186 ,p_argument_value => p_object_version_number
187 );
188 --
189 Open C_Sel1;
190 Fetch C_Sel1 Into ota_anc_shd.g_old_rec;
191 If C_Sel1%notfound then
192 Close C_Sel1;
193 --
194 -- The primary key is invalid therefore we must error
195 --
196 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
197 fnd_message.raise_error;
198 End If;
199 Close C_Sel1;
200 If (p_object_version_number
201 <> ota_anc_shd.g_old_rec.object_version_number) Then
202 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
203 fnd_message.raise_error;
204 End If;
205 --
206 hr_utility.set_location(' Leaving:'||l_proc, 10);
207 --
208 -- We need to trap the ORA LOCK exception
209 --
210 Exception
211 When HR_Api.Object_Locked then
212 --
213 -- The object is locked therefore we need to supply a meaningful
214 -- error message.
215 --
216 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
217 fnd_message.set_token('TABLE_NAME', 'ota_announcements');
218 fnd_message.raise_error;
219 End lck;
220 --
221 -- ----------------------------------------------------------------------------
222 -- |-----------------------------< convert_args >-----------------------------|
223 -- ----------------------------------------------------------------------------
224 Function convert_args
225 (p_announcement_id in number
226 ,p_business_group_id in number
227 ,p_object_version_number in number
228 ,p_start_date_active in date
229 ,p_end_date_active in date
230 ,p_owner_id in number
231 ,p_attribute_category in varchar2
232 ,p_attribute1 in varchar2
233 ,p_attribute2 in varchar2
234 ,p_attribute3 in varchar2
235 ,p_attribute4 in varchar2
236 ,p_attribute5 in varchar2
237 ,p_attribute6 in varchar2
238 ,p_attribute7 in varchar2
239 ,p_attribute8 in varchar2
240 ,p_attribute9 in varchar2
241 ,p_attribute10 in varchar2
242 ,p_attribute11 in varchar2
243 ,p_attribute12 in varchar2
244 ,p_attribute13 in varchar2
245 ,p_attribute14 in varchar2
246 ,p_attribute15 in varchar2
247 ,p_attribute16 in varchar2
248 ,p_attribute17 in varchar2
249 ,p_attribute18 in varchar2
250 ,p_attribute19 in varchar2
251 ,p_attribute20 in varchar2
252 )
253 Return g_rec_type is
254 --
255 l_rec g_rec_type;
256 --
257 Begin
258 --
259 -- Convert arguments into local l_rec structure.
260 --
261 l_rec.announcement_id := p_announcement_id;
262 l_rec.business_group_id := p_business_group_id;
263 l_rec.object_version_number := p_object_version_number;
264 l_rec.start_date_active := p_start_date_active;
265 l_rec.end_date_active := p_end_date_active;
266 l_rec.owner_id := p_owner_id;
267 l_rec.attribute_category := p_attribute_category;
268 l_rec.attribute1 := p_attribute1;
269 l_rec.attribute2 := p_attribute2;
270 l_rec.attribute3 := p_attribute3;
271 l_rec.attribute4 := p_attribute4;
272 l_rec.attribute5 := p_attribute5;
273 l_rec.attribute6 := p_attribute6;
274 l_rec.attribute7 := p_attribute7;
275 l_rec.attribute8 := p_attribute8;
276 l_rec.attribute9 := p_attribute9;
277 l_rec.attribute10 := p_attribute10;
278 l_rec.attribute11 := p_attribute11;
279 l_rec.attribute12 := p_attribute12;
280 l_rec.attribute13 := p_attribute13;
281 l_rec.attribute14 := p_attribute14;
282 l_rec.attribute15 := p_attribute15;
283 l_rec.attribute16 := p_attribute16;
284 l_rec.attribute17 := p_attribute17;
285 l_rec.attribute18 := p_attribute18;
286 l_rec.attribute19 := p_attribute19;
287 l_rec.attribute20 := p_attribute20;
288 --
289 -- Return the plsql record structure.
290 --
291 Return(l_rec);
292 --
293 End convert_args;
294 --
295 end ota_anc_shd;