[Home] [Help]
PACKAGE BODY: APPS.OZF_AE_HEADER_PVT
Source
1 PACKAGE BODY OZF_Ae_Header_PVT as
2 /* $Header: ozfvaehb.pls 115.5 2004/07/13 10:28:39 upoluri ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- OZF_Ae_Header_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 -- NOTE
12 --
13 -- End of Comments
14 -- ===============================================================
15
16
17 G_PKG_NAME CONSTANT VARCHAR2(30):= 'OZF_Ae_Header_PVT';
18 G_FILE_NAME CONSTANT VARCHAR2(12) := 'ozfvaehb.pls';
19
20 G_DEBUG BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
21
22 -- Hint: Primary key needs to be returned.
23 PROCEDURE Create_Ae_Header(
24 p_api_version_number IN NUMBER,
25 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
26 p_commit IN VARCHAR2 := FND_API.G_FALSE,
27 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
28
29 x_return_status OUT NOCOPY VARCHAR2,
30 x_msg_count OUT NOCOPY NUMBER,
31 x_msg_data OUT NOCOPY VARCHAR2,
32
33 p_ae_header_rec IN ae_header_rec_type := g_miss_ae_header_rec,
34 x_ae_header_id OUT NOCOPY NUMBER
35 )
36
37 IS
38 L_API_NAME CONSTANT VARCHAR2(30) := 'Create_Ae_Header';
39 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
40 l_return_status_full VARCHAR2(1);
41 l_object_version_number NUMBER := 1;
42 l_org_id NUMBER := p_ae_header_rec.org_id;
43 l_AE_HEADER_ID NUMBER;
44 l_dummy NUMBER;
45
46 CURSOR c_id IS
47 SELECT OZF_AE_HEADERS_ALL_s.NEXTVAL
48 FROM dual;
49
50 CURSOR c_id_exists (l_id IN NUMBER) IS
51 SELECT count(ae_header_id) FROM OZF_AE_HEADERS_ALL
52 WHERE AE_HEADER_ID = l_id;
53
54 BEGIN
55 -- Standard Start of API savepoint
56 SAVEPOINT CREATE_Ae_Header_PVT;
57
58 -- Standard call to check for call compatibility.
59 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
60 p_api_version_number,
61 l_api_name,
62 G_PKG_NAME)
63 THEN
64 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
65 END IF;
66
67 -- Initialize message list if p_init_msg_list is set to TRUE.
68 IF FND_API.to_Boolean( p_init_msg_list )
69 THEN
70 FND_MSG_PUB.initialize;
71 END IF;
72
73 -- Debug Message
74 IF g_debug THEN
75 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
76 END IF;
77
78
79 -- Initialize API return status to SUCCESS
80 x_return_status := FND_API.G_RET_STS_SUCCESS;
81
82 -- Local variable initialization
83
84 IF p_ae_header_rec.AE_HEADER_ID IS NULL OR
85 p_ae_header_rec.AE_HEADER_ID = FND_API.g_miss_num
86 THEN
87 LOOP
88 l_dummy := NULL;
89 OPEN c_id;
90 FETCH c_id INTO l_AE_HEADER_ID;
91 CLOSE c_id;
92
93 OPEN c_id_exists(l_AE_HEADER_ID);
94 FETCH c_id_exists INTO l_dummy;
95 CLOSE c_id_exists;
96 -- Exit when the identifier uniqueness is established
97 EXIT WHEN l_dummy = 0;
98 END LOOP;
99 END IF;
100
101 -- =========================================================================
102 -- Validate Environment
103 -- =========================================================================
104
105 IF FND_GLOBAL.User_Id IS NULL
106 THEN
107 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_USER_PROFILE_MISSING');
108 RAISE FND_API.G_EXC_ERROR;
109 END IF;
110
111 /*
112 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
113 THEN
114 -- Debug message
115 IF g_debug THEN
116 OZF_UTILITY_PVT.debug_message('Private API: Validate_Ae_Header');
117 END IF;
118
119 -- Invoke validation procedures
120 Validate_ae_header(
121 p_api_version_number => 1.0,
122 p_init_msg_list => FND_API.G_FALSE,
123 p_validation_level => p_validation_level,
124 p_ae_header_rec => p_ae_header_rec,
125 x_return_status => x_return_status,
126 x_msg_count => x_msg_count,
127 x_msg_data => x_msg_data);
128 END IF;
129
130 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
131 RAISE FND_API.G_EXC_ERROR;
132 END IF;
133 */
134
135 -- Debug Message
136 IF g_debug THEN
137 OZF_UTILITY_PVT.debug_message( 'Private API: Calling create table handler');
138 END IF;
139
140 -- Invoke table handler(OZF_AE_HEADERS_PKG.Insert_Row)
141 OZF_AE_HEADERS_PKG.Insert_Row(
142 px_ae_header_id => l_ae_header_id,
143 px_object_version_number => l_object_version_number,
144 p_last_update_date => SYSDATE,
145 p_last_updated_by => FND_GLOBAL.USER_ID,
146 p_creation_date => SYSDATE,
147 p_created_by => FND_GLOBAL.USER_ID,
148 p_last_update_login => FND_GLOBAL.CONC_LOGIN_ID,
149 p_request_id => p_ae_header_rec.request_id,
150 p_program_application_id => p_ae_header_rec.program_application_id,
151 p_program_update_date => p_ae_header_rec.program_update_date,
152 p_program_id => p_ae_header_rec.program_id,
153 p_accounting_event_id => p_ae_header_rec.accounting_event_id,
154 p_accounting_date => p_ae_header_rec.accounting_date,
155 p_accounting_error_code => p_ae_header_rec.accounting_error_code,
156 p_ae_category => p_ae_header_rec.ae_category,
157 p_ae_sequence_id => p_ae_header_rec.ae_sequence_id,
158 p_ae_sequence_value => p_ae_header_rec.ae_sequence_value,
159 p_cross_currency_flag => p_ae_header_rec.cross_currency_flag,
160 p_description => p_ae_header_rec.description,
161 p_gl_reversal_flag => p_ae_header_rec.gl_reversal_flag,
162 p_gl_transfer_error_code => p_ae_header_rec.gl_transfer_error_code,
163 p_gl_transfer_flag => p_ae_header_rec.gl_transfer_flag,
164 p_gl_transfer_run_id => p_ae_header_rec.gl_transfer_run_id,
165 px_org_id => l_org_id,
166 p_period_name => p_ae_header_rec.period_name,
167 p_set_of_books_id => p_ae_header_rec.set_of_books_id,
168 p_attribute_category => p_ae_header_rec.attribute_category,
169 p_attribute1 => p_ae_header_rec.attribute1,
170 p_attribute2 => p_ae_header_rec.attribute2,
171 p_attribute3 => p_ae_header_rec.attribute3,
172 p_attribute4 => p_ae_header_rec.attribute4,
173 p_attribute5 => p_ae_header_rec.attribute5,
174 p_attribute6 => p_ae_header_rec.attribute6,
175 p_attribute7 => p_ae_header_rec.attribute7,
176 p_attribute8 => p_ae_header_rec.attribute8,
177 p_attribute9 => p_ae_header_rec.attribute9,
178 p_attribute10 => p_ae_header_rec.attribute10,
179 p_attribute11 => p_ae_header_rec.attribute11,
180 p_attribute12 => p_ae_header_rec.attribute12,
181 p_attribute13 => p_ae_header_rec.attribute13,
182 p_attribute14 => p_ae_header_rec.attribute14,
183 p_attribute15 => p_ae_header_rec.attribute15);
184 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
185 RAISE FND_API.G_EXC_ERROR;
186 END IF;
187 x_ae_header_id:= l_ae_header_id;
188 --
189 -- End of API body
190 --
191
192 -- Standard check for p_commit
193 IF FND_API.to_Boolean( p_commit )
194 THEN
195 COMMIT WORK;
196 END IF;
197
198
199 -- Debug Message
200 IF g_debug THEN
201 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
202 END IF;
203
204 -- Standard call to get message count and if count is 1, get message info.
205 FND_MSG_PUB.Count_And_Get
206 (p_count => x_msg_count,
207 p_data => x_msg_data
208 );
209 EXCEPTION
210
211 WHEN OZF_Utility_PVT.resource_locked THEN
212 x_return_status := FND_API.g_ret_sts_error;
213 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
214 WHEN FND_API.G_EXC_ERROR THEN
215 ROLLBACK TO CREATE_Ae_Header_PVT;
216 x_return_status := FND_API.G_RET_STS_ERROR;
217 -- Standard call to get message count and if count=1, get the message
218 FND_MSG_PUB.Count_And_Get (
219 p_encoded => FND_API.G_FALSE,
220 p_count => x_msg_count,
221 p_data => x_msg_data
222 );
223 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
224 ROLLBACK TO CREATE_Ae_Header_PVT;
225 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
226 -- Standard call to get message count and if count=1, get the message
227 FND_MSG_PUB.Count_And_Get (
228 p_encoded => FND_API.G_FALSE,
229 p_count => x_msg_count,
230 p_data => x_msg_data
231 );
232 WHEN OTHERS THEN
233 ROLLBACK TO CREATE_Ae_Header_PVT;
234 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
235 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
236 THEN
237 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
238 END IF;
239 -- Standard call to get message count and if count=1, get the message
240 FND_MSG_PUB.Count_And_Get (
241 p_encoded => FND_API.G_FALSE,
242 p_count => x_msg_count,
243 p_data => x_msg_data
244 );
245 End Create_Ae_Header;
246
247 PROCEDURE Update_Ae_Header(
248 p_api_version_number IN NUMBER,
249 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
250 p_commit IN VARCHAR2 := FND_API.G_FALSE,
251 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
252
253 x_return_status OUT NOCOPY VARCHAR2,
254 x_msg_count OUT NOCOPY NUMBER,
255 x_msg_data OUT NOCOPY VARCHAR2,
256
257 p_ae_header_rec IN ae_header_rec_type,
258 x_object_version_number OUT NOCOPY NUMBER
259 )
260
261 IS
262
263 CURSOR c_get_ae_header(p_ae_header_id NUMBER) IS
264 SELECT *
265 FROM OZF_AE_HEADERS_ALL
266 WHERE ae_header_id = p_ae_header_id;
267
268 L_API_NAME CONSTANT VARCHAR2(30) := 'Update_Ae_Header';
269 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
270 -- Local Variables
271 l_object_version_number NUMBER;
272 l_AE_HEADER_ID NUMBER;
273 l_ref_ae_header_rec c_get_Ae_Header%ROWTYPE ;
274 l_tar_ae_header_rec OZF_Ae_Header_PVT.ae_header_rec_type := P_ae_header_rec;
275 l_rowid ROWID;
276
277 BEGIN
278 -- Standard Start of API savepoint
279 SAVEPOINT UPDATE_Ae_Header_PVT;
280
281 -- Standard call to check for call compatibility.
282 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
283 p_api_version_number,
284 l_api_name,
285 G_PKG_NAME)
286 THEN
287 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
288 END IF;
289
290 -- Initialize message list if p_init_msg_list is set to TRUE.
291 IF FND_API.to_Boolean( p_init_msg_list )
292 THEN
293 FND_MSG_PUB.initialize;
294 END IF;
295
296 -- Debug Message
297 IF g_debug THEN
298 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
299 END IF;
300
301
302 -- Initialize API return status to SUCCESS
303 x_return_status := FND_API.G_RET_STS_SUCCESS;
304
305 -- Debug Message
306 IF g_debug THEN
307 OZF_UTILITY_PVT.debug_message('Private API: - Open Cursor to Select');
308 END IF;
309
310 /*
311 OPEN c_get_Ae_Header( l_tar_ae_header_rec.ae_header_id);
312
313 FETCH c_get_Ae_Header INTO l_ref_ae_header_rec ;
314
315 If ( c_get_Ae_Header%NOTFOUND) THEN
316 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RECORD_NOT_FOUND');
317 RAISE FND_API.G_EXC_ERROR;
318 END IF;
319 -- Debug Message
320 IF g_debug THEN
321 OZF_UTILITY_PVT.debug_message('Private API: - Close Cursor');
322 END IF;
323 CLOSE c_get_Ae_Header;
324 */
325
326
327 If (l_tar_ae_header_rec.object_version_number is NULL or
328 l_tar_ae_header_rec.object_version_number = FND_API.G_MISS_NUM ) Then
329 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_NO_OBJ_VER_NUM');
330 raise FND_API.G_EXC_ERROR;
331 End if;
332 -- Check Whether record has been changed by someone else
333 If (l_tar_ae_header_rec.object_version_number <> l_ref_ae_header_rec.object_version_number) Then
334 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
335 raise FND_API.G_EXC_ERROR;
336 End if;
337 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
338 THEN
339 -- Debug message
340 IF g_debug THEN
341 OZF_UTILITY_PVT.debug_message('Private API: Validate_Ae_Header');
342 END IF;
343
344 -- Invoke validation procedures
345 Validate_ae_header(
346 p_api_version_number => 1.0,
347 p_init_msg_list => FND_API.G_FALSE,
348 p_validation_level => p_validation_level,
349 p_ae_header_rec => p_ae_header_rec,
350 x_return_status => x_return_status,
351 x_msg_count => x_msg_count,
352 x_msg_data => x_msg_data);
353 END IF;
354
355 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
356 RAISE FND_API.G_EXC_ERROR;
357 END IF;
358
359
360 -- Debug Message
361 IF g_debug THEN
362 OZF_UTILITY_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, 'Private API: Calling update table handler');
363 END IF;
364
365 -- Invoke table handler(OZF_AE_HEADERS_PKG.Update_Row)
366 OZF_AE_HEADERS_PKG.Update_Row(
367 p_ae_header_id => p_ae_header_rec.ae_header_id,
368 p_object_version_number => p_ae_header_rec.object_version_number,
369 p_last_update_date => SYSDATE,
370 p_last_updated_by => FND_GLOBAL.USER_ID,
371 p_last_update_login => FND_GLOBAL.CONC_LOGIN_ID,
372 p_request_id => p_ae_header_rec.request_id,
373 p_program_application_id => p_ae_header_rec.program_application_id,
374 p_program_update_date => p_ae_header_rec.program_update_date,
375 p_program_id => p_ae_header_rec.program_id,
376 p_accounting_event_id => p_ae_header_rec.accounting_event_id,
377 p_accounting_date => p_ae_header_rec.accounting_date,
378 p_accounting_error_code => p_ae_header_rec.accounting_error_code,
379 p_ae_category => p_ae_header_rec.ae_category,
380 p_ae_sequence_id => p_ae_header_rec.ae_sequence_id,
381 p_ae_sequence_value => p_ae_header_rec.ae_sequence_value,
382 p_cross_currency_flag => p_ae_header_rec.cross_currency_flag,
383 p_description => p_ae_header_rec.description,
384 p_gl_reversal_flag => p_ae_header_rec.gl_reversal_flag,
385 p_gl_transfer_error_code => p_ae_header_rec.gl_transfer_error_code,
386 p_gl_transfer_flag => p_ae_header_rec.gl_transfer_flag,
387 p_gl_transfer_run_id => p_ae_header_rec.gl_transfer_run_id,
388 p_org_id => p_ae_header_rec.org_id,
389 p_period_name => p_ae_header_rec.period_name,
390 p_set_of_books_id => p_ae_header_rec.set_of_books_id,
391 p_attribute_category => p_ae_header_rec.attribute_category,
392 p_attribute1 => p_ae_header_rec.attribute1,
393 p_attribute2 => p_ae_header_rec.attribute2,
394 p_attribute3 => p_ae_header_rec.attribute3,
395 p_attribute4 => p_ae_header_rec.attribute4,
396 p_attribute5 => p_ae_header_rec.attribute5,
397 p_attribute6 => p_ae_header_rec.attribute6,
398 p_attribute7 => p_ae_header_rec.attribute7,
399 p_attribute8 => p_ae_header_rec.attribute8,
400 p_attribute9 => p_ae_header_rec.attribute9,
401 p_attribute10 => p_ae_header_rec.attribute10,
402 p_attribute11 => p_ae_header_rec.attribute11,
403 p_attribute12 => p_ae_header_rec.attribute12,
404 p_attribute13 => p_ae_header_rec.attribute13,
405 p_attribute14 => p_ae_header_rec.attribute14,
406 p_attribute15 => p_ae_header_rec.attribute15);
407 --
408 -- End of API body.
409 --
410
411 -- Standard check for p_commit
412 IF FND_API.to_Boolean( p_commit )
413 THEN
414 COMMIT WORK;
415 END IF;
416
417
418 -- Debug Message
419 IF g_debug THEN
420 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
421 END IF;
422
423 -- Standard call to get message count and if count is 1, get message info.
424 FND_MSG_PUB.Count_And_Get
425 (p_count => x_msg_count,
426 p_data => x_msg_data
427 );
428 EXCEPTION
429
430 WHEN OZF_Utility_PVT.resource_locked THEN
431 x_return_status := FND_API.g_ret_sts_error;
432 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
433
434 WHEN FND_API.G_EXC_ERROR THEN
435 ROLLBACK TO UPDATE_Ae_Header_PVT;
436 x_return_status := FND_API.G_RET_STS_ERROR;
437 -- Standard call to get message count and if count=1, get the message
438 FND_MSG_PUB.Count_And_Get (
439 p_encoded => FND_API.G_FALSE,
440 p_count => x_msg_count,
441 p_data => x_msg_data
442 );
443
444 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
445 ROLLBACK TO UPDATE_Ae_Header_PVT;
446 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
447 -- Standard call to get message count and if count=1, get the message
448 FND_MSG_PUB.Count_And_Get (
449 p_encoded => FND_API.G_FALSE,
450 p_count => x_msg_count,
451 p_data => x_msg_data
452 );
453
454 WHEN OTHERS THEN
455 ROLLBACK TO UPDATE_Ae_Header_PVT;
456 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
457 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
458 THEN
459 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
460 END IF;
461 -- Standard call to get message count and if count=1, get the message
462 FND_MSG_PUB.Count_And_Get (
463 p_encoded => FND_API.G_FALSE,
464 p_count => x_msg_count,
465 p_data => x_msg_data
466 );
467 End Update_Ae_Header;
468
469
470 PROCEDURE Delete_Ae_Header(
471 p_api_version_number IN NUMBER,
472 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
473 p_commit IN VARCHAR2 := FND_API.G_FALSE,
474 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
475 x_return_status OUT NOCOPY VARCHAR2,
476 x_msg_count OUT NOCOPY NUMBER,
477 x_msg_data OUT NOCOPY VARCHAR2,
478 p_ae_header_id IN NUMBER,
479 p_object_version_number IN NUMBER
480 )
481
482 IS
483 L_API_NAME CONSTANT VARCHAR2(30) := 'Delete_Ae_Header';
484 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
485 l_object_version_number NUMBER;
486
487 BEGIN
488 -- Standard Start of API savepoint
489 SAVEPOINT DELETE_Ae_Header_PVT;
490
491 -- Standard call to check for call compatibility.
492 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
493 p_api_version_number,
494 l_api_name,
495 G_PKG_NAME)
496 THEN
497 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
498 END IF;
499
500 -- Initialize message list if p_init_msg_list is set to TRUE.
501 IF FND_API.to_Boolean( p_init_msg_list )
502 THEN
503 FND_MSG_PUB.initialize;
504 END IF;
505
506 -- Debug Message
507 IF g_debug THEN
508 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
509 END IF;
510
511
512 -- Initialize API return status to SUCCESS
513 x_return_status := FND_API.G_RET_STS_SUCCESS;
514
515 --
516 -- Api body
517 --
518 -- Debug Message
519 IF g_debug THEN
520 OZF_UTILITY_PVT.debug_message( 'Private API: Calling delete table handler');
521 END IF;
522
523 -- Invoke table handler(OZF_AE_HEADERS_PKG.Delete_Row)
524 OZF_AE_HEADERS_PKG.Delete_Row(
525 p_AE_HEADER_ID => p_AE_HEADER_ID);
526 --
527 -- End of API body
528 --
529
530 -- Standard check for p_commit
531 IF FND_API.to_Boolean( p_commit )
532 THEN
533 COMMIT WORK;
534 END IF;
535
536
537 -- Debug Message
538 IF g_debug THEN
539 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
540 END IF;
541
542 -- Standard call to get message count and if count is 1, get message info.
543 FND_MSG_PUB.Count_And_Get
544 (p_count => x_msg_count,
545 p_data => x_msg_data
546 );
547 EXCEPTION
548
549 WHEN OZF_Utility_PVT.resource_locked THEN
550 x_return_status := FND_API.g_ret_sts_error;
551 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
552
553 WHEN FND_API.G_EXC_ERROR THEN
554 ROLLBACK TO DELETE_Ae_Header_PVT;
555 x_return_status := FND_API.G_RET_STS_ERROR;
556 -- Standard call to get message count and if count=1, get the message
557 FND_MSG_PUB.Count_And_Get (
558 p_encoded => FND_API.G_FALSE,
559 p_count => x_msg_count,
560 p_data => x_msg_data
561 );
562
563 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
564 ROLLBACK TO DELETE_Ae_Header_PVT;
565 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
566 -- Standard call to get message count and if count=1, get the message
567 FND_MSG_PUB.Count_And_Get (
568 p_encoded => FND_API.G_FALSE,
569 p_count => x_msg_count,
570 p_data => x_msg_data
571 );
572
573 WHEN OTHERS THEN
574 ROLLBACK TO DELETE_Ae_Header_PVT;
575 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
576 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
577 THEN
578 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
579 END IF;
580 -- Standard call to get message count and if count=1, get the message
581 FND_MSG_PUB.Count_And_Get (
582 p_encoded => FND_API.G_FALSE,
583 p_count => x_msg_count,
584 p_data => x_msg_data
585 );
586 End Delete_Ae_Header;
587
588
589
590 -- Hint: Primary key needs to be returned.
591 PROCEDURE Lock_Ae_Header(
592 p_api_version_number IN NUMBER,
593 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
594
595 x_return_status OUT NOCOPY VARCHAR2,
596 x_msg_count OUT NOCOPY NUMBER,
597 x_msg_data OUT NOCOPY VARCHAR2,
598
599 p_ae_header_id IN NUMBER,
600 p_object_version IN NUMBER
601 )
602
603 IS
604 L_API_NAME CONSTANT VARCHAR2(30) := 'Lock_Ae_Header';
605 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
606 L_FULL_NAME CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
607 l_AE_HEADER_ID NUMBER;
608
609 CURSOR c_Ae_Header IS
610 SELECT AE_HEADER_ID
611 FROM OZF_AE_HEADERS_ALL
612 WHERE AE_HEADER_ID = p_AE_HEADER_ID
613 AND object_version_number = p_object_version
614 FOR UPDATE NOWAIT;
615
616 BEGIN
617
618 -- Debug Message
619 IF g_debug THEN
620 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
621 END IF;
622
623 -- Initialize message list if p_init_msg_list is set to TRUE.
624 IF FND_API.to_Boolean( p_init_msg_list )
625 THEN
626 FND_MSG_PUB.initialize;
627 END IF;
628
629 -- Standard call to check for call compatibility.
630 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
631 p_api_version_number,
632 l_api_name,
633 G_PKG_NAME)
634 THEN
635 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
636 END IF;
637
638
639 -- Initialize API return status to SUCCESS
640 x_return_status := FND_API.G_RET_STS_SUCCESS;
641
642
643 ------------------------ lock -------------------------
644
645 IF g_debug THEN
646 OZF_Utility_PVT.debug_message(l_full_name||': start');
647 END IF;
648 OPEN c_Ae_Header;
649
650 FETCH c_Ae_Header INTO l_AE_HEADER_ID;
651
652 IF (c_Ae_Header%NOTFOUND) THEN
653 CLOSE c_Ae_Header;
654 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
655 FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
656 FND_MSG_PUB.add;
657 END IF;
658 RAISE FND_API.g_exc_error;
659 END IF;
660
661 CLOSE c_Ae_Header;
662
663 -------------------- finish --------------------------
664 FND_MSG_PUB.count_and_get(
665 p_encoded => FND_API.g_false,
666 p_count => x_msg_count,
667 p_data => x_msg_data);
668 IF g_debug THEN
669 OZF_Utility_PVT.debug_message(l_full_name ||': end');
670 END IF;
671 EXCEPTION
672
673 WHEN OZF_Utility_PVT.resource_locked THEN
674 x_return_status := FND_API.g_ret_sts_error;
675 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
676
677 WHEN FND_API.G_EXC_ERROR THEN
678 ROLLBACK TO LOCK_Ae_Header_PVT;
679 x_return_status := FND_API.G_RET_STS_ERROR;
680 -- Standard call to get message count and if count=1, get the message
681 FND_MSG_PUB.Count_And_Get (
682 p_encoded => FND_API.G_FALSE,
683 p_count => x_msg_count,
684 p_data => x_msg_data
685 );
686
687 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
688 ROLLBACK TO LOCK_Ae_Header_PVT;
689 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
690 -- Standard call to get message count and if count=1, get the message
691 FND_MSG_PUB.Count_And_Get (
692 p_encoded => FND_API.G_FALSE,
693 p_count => x_msg_count,
694 p_data => x_msg_data
695 );
696
697 WHEN OTHERS THEN
698 ROLLBACK TO LOCK_Ae_Header_PVT;
699 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
700 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
701 THEN
702 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
703 END IF;
704 -- Standard call to get message count and if count=1, get the message
705 FND_MSG_PUB.Count_And_Get (
706 p_encoded => FND_API.G_FALSE,
707 p_count => x_msg_count,
708 p_data => x_msg_data
709 );
710 End Lock_Ae_Header;
711
712
713 PROCEDURE check_ae_header_uk_items(
714 p_ae_header_rec IN ae_header_rec_type,
715 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
716 x_return_status OUT NOCOPY VARCHAR2)
717 IS
718 l_valid_flag VARCHAR2(1);
719
720 BEGIN
721 x_return_status := FND_API.g_ret_sts_success;
722 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
723 l_valid_flag := OZF_Utility_PVT.check_uniqueness(
724 'OZF_AE_HEADERS_ALL',
725 'AE_HEADER_ID = ''' || p_ae_header_rec.AE_HEADER_ID ||''''
726 );
727 ELSE
728 l_valid_flag := OZF_Utility_PVT.check_uniqueness(
729 'OZF_AE_HEADERS_ALL',
730 'AE_HEADER_ID = ''' || p_ae_header_rec.AE_HEADER_ID ||
731 ''' AND AE_HEADER_ID <> ' || p_ae_header_rec.AE_HEADER_ID
732 );
733 END IF;
734
735 IF l_valid_flag = FND_API.g_false THEN
736 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_AE_HEADER_ID_DUPLICATE');
737 x_return_status := FND_API.g_ret_sts_error;
738 RETURN;
739 END IF;
740
741 END check_ae_header_uk_items;
742
743 PROCEDURE check_ae_header_req_items(
744 p_ae_header_rec IN ae_header_rec_type,
745 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
746 x_return_status OUT NOCOPY VARCHAR2
747 )
748 IS
749 BEGIN
750 x_return_status := FND_API.g_ret_sts_success;
751
752 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
753
754
755 IF p_ae_header_rec.ae_header_id = FND_API.g_miss_num OR p_ae_header_rec.ae_header_id IS NULL THEN
756 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'AE_HEADER_ID' );
757 x_return_status := FND_API.g_ret_sts_error;
758 RETURN;
759 END IF;
760
761
762 IF p_ae_header_rec.object_version_number = FND_API.g_miss_num OR p_ae_header_rec.object_version_number IS NULL THEN
763 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
764 x_return_status := FND_API.g_ret_sts_error;
765 RETURN;
766 END IF;
767
768
769 IF p_ae_header_rec.last_update_date = FND_API.g_miss_date OR p_ae_header_rec.last_update_date IS NULL THEN
770 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATE_DATE' );
771 x_return_status := FND_API.g_ret_sts_error;
772 RETURN;
773 END IF;
774
775
776 IF p_ae_header_rec.last_updated_by = FND_API.g_miss_num OR p_ae_header_rec.last_updated_by IS NULL THEN
777 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATED_BY' );
778 x_return_status := FND_API.g_ret_sts_error;
779 RETURN;
780 END IF;
781
782
783 IF p_ae_header_rec.creation_date = FND_API.g_miss_date OR p_ae_header_rec.creation_date IS NULL THEN
784 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATION_DATE' );
785 x_return_status := FND_API.g_ret_sts_error;
786 RETURN;
787 END IF;
788
789
790 IF p_ae_header_rec.created_by = FND_API.g_miss_num OR p_ae_header_rec.created_by IS NULL THEN
791 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATED_BY' );
792 x_return_status := FND_API.g_ret_sts_error;
793 RETURN;
794 END IF;
795
796
797 IF p_ae_header_rec.accounting_event_id = FND_API.g_miss_num OR p_ae_header_rec.accounting_event_id IS NULL THEN
798 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'ACCOUNTING_EVENT_ID' );
799 x_return_status := FND_API.g_ret_sts_error;
800 RETURN;
801 END IF;
802
803
804 IF p_ae_header_rec.accounting_date = FND_API.g_miss_date OR p_ae_header_rec.accounting_date IS NULL THEN
805 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'ACCOUNTING_DATE' );
806 x_return_status := FND_API.g_ret_sts_error;
807 RETURN;
808 END IF;
809
810
811 IF p_ae_header_rec.ae_category = FND_API.g_miss_char OR p_ae_header_rec.ae_category IS NULL THEN
812 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'AE_CATEGORY' );
813 x_return_status := FND_API.g_ret_sts_error;
814 RETURN;
815 END IF;
816
817
818 IF p_ae_header_rec.cross_currency_flag = FND_API.g_miss_char OR p_ae_header_rec.cross_currency_flag IS NULL THEN
819 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CROSS_CURRENCY_FLAG' );
820 x_return_status := FND_API.g_ret_sts_error;
821 RETURN;
822 END IF;
823
824
825 IF p_ae_header_rec.gl_transfer_flag = FND_API.g_miss_char OR p_ae_header_rec.gl_transfer_flag IS NULL THEN
826 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'GL_TRANSFER_FLAG' );
827 x_return_status := FND_API.g_ret_sts_error;
828 RETURN;
829 END IF;
830
831
832 IF p_ae_header_rec.gl_transfer_run_id = FND_API.g_miss_num OR p_ae_header_rec.gl_transfer_run_id IS NULL THEN
833 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'GL_TRANSFER_RUN_ID' );
834 x_return_status := FND_API.g_ret_sts_error;
835 RETURN;
836 END IF;
837
838
839 IF p_ae_header_rec.period_name = FND_API.g_miss_char OR p_ae_header_rec.period_name IS NULL THEN
840 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'PERIOD_NAME' );
841 x_return_status := FND_API.g_ret_sts_error;
842 RETURN;
843 END IF;
844
845
846 IF p_ae_header_rec.set_of_books_id = FND_API.g_miss_num OR p_ae_header_rec.set_of_books_id IS NULL THEN
847 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'SET_OF_BOOKS_ID' );
848 x_return_status := FND_API.g_ret_sts_error;
849 RETURN;
850 END IF;
851 ELSE
852
853
854 IF p_ae_header_rec.ae_header_id IS NULL THEN
855 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'AE_HEADER_ID' );
856 x_return_status := FND_API.g_ret_sts_error;
857 RETURN;
858 END IF;
859
860
861 IF p_ae_header_rec.object_version_number IS NULL THEN
862 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
863 x_return_status := FND_API.g_ret_sts_error;
864 RETURN;
865 END IF;
866
867
868 IF p_ae_header_rec.last_update_date IS NULL THEN
869 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATE_DATE' );
870 x_return_status := FND_API.g_ret_sts_error;
871 RETURN;
872 END IF;
873
874
875 IF p_ae_header_rec.last_updated_by IS NULL THEN
876 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATED_BY' );
877 x_return_status := FND_API.g_ret_sts_error;
878 RETURN;
879 END IF;
880
881
882 IF p_ae_header_rec.creation_date IS NULL THEN
883 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATION_DATE' );
884 x_return_status := FND_API.g_ret_sts_error;
885 RETURN;
886 END IF;
887
888
889 IF p_ae_header_rec.created_by IS NULL THEN
890 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATED_BY' );
891 x_return_status := FND_API.g_ret_sts_error;
892 RETURN;
893 END IF;
894
895
896 IF p_ae_header_rec.accounting_event_id IS NULL THEN
897 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'ACCOUNTING_EVENT_ID' );
898 x_return_status := FND_API.g_ret_sts_error;
899 RETURN;
900 END IF;
901
902
903 IF p_ae_header_rec.accounting_date IS NULL THEN
904 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'ACCOUNTING_DATE' );
905 x_return_status := FND_API.g_ret_sts_error;
906 RETURN;
907 END IF;
908
909
910 IF p_ae_header_rec.ae_category IS NULL THEN
911 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'AE_CATEGORY' );
912 x_return_status := FND_API.g_ret_sts_error;
913 RETURN;
914 END IF;
915
916
917 IF p_ae_header_rec.cross_currency_flag IS NULL THEN
918 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CROSS_CURRENCY_FLAG' );
919 x_return_status := FND_API.g_ret_sts_error;
920 RETURN;
921 END IF;
922
923
924 IF p_ae_header_rec.gl_transfer_flag IS NULL THEN
925 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'GL_TRANSFER_FLAG' );
926 x_return_status := FND_API.g_ret_sts_error;
927 RETURN;
928 END IF;
929
930
931 IF p_ae_header_rec.gl_transfer_run_id IS NULL THEN
932 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'GL_TRANSFER_RUN_ID' );
933 x_return_status := FND_API.g_ret_sts_error;
934 RETURN;
935 END IF;
936
937
938 IF p_ae_header_rec.period_name IS NULL THEN
939 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'PERIOD_NAME' );
940 x_return_status := FND_API.g_ret_sts_error;
941 RETURN;
942 END IF;
943
944
945 IF p_ae_header_rec.set_of_books_id IS NULL THEN
946 OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'SET_OF_BOOKS_ID' );
947 x_return_status := FND_API.g_ret_sts_error;
948 RETURN;
949 END IF;
950 END IF;
951
952 END check_ae_header_req_items;
953
954 PROCEDURE check_ae_header_FK_items(
955 p_ae_header_rec IN ae_header_rec_type,
956 x_return_status OUT NOCOPY VARCHAR2
957 )
958 IS
959 BEGIN
960 x_return_status := FND_API.g_ret_sts_success;
961
962 -- Enter custom code here
963
964 END check_ae_header_FK_items;
965
966 PROCEDURE check_ae_header_Lk_items(
967 p_ae_header_rec IN ae_header_rec_type,
968 x_return_status OUT NOCOPY VARCHAR2
969 )
970 IS
971 BEGIN
972 x_return_status := FND_API.g_ret_sts_success;
973
974 -- Enter custom code here
975
976 END check_ae_header_Lk_items;
977
978 PROCEDURE Check_ae_header_Items (
979 P_ae_header_rec IN ae_header_rec_type,
980 p_validation_mode IN VARCHAR2,
981 x_return_status OUT NOCOPY VARCHAR2
982 )
983 IS
984 BEGIN
985
986 -- Check Items Uniqueness API calls
987
988 check_ae_header_uk_items(
989 p_ae_header_rec => p_ae_header_rec,
990 p_validation_mode => p_validation_mode,
991 x_return_status => x_return_status);
992 IF x_return_status <> FND_API.g_ret_sts_success THEN
993 RETURN;
994 END IF;
995
996 -- Check Items Required/NOT NULL API calls
997
998 check_ae_header_req_items(
999 p_ae_header_rec => p_ae_header_rec,
1000 p_validation_mode => p_validation_mode,
1001 x_return_status => x_return_status);
1002 IF x_return_status <> FND_API.g_ret_sts_success THEN
1003 RETURN;
1004 END IF;
1005 -- Check Items Foreign Keys API calls
1006
1007 check_ae_header_FK_items(
1008 p_ae_header_rec => p_ae_header_rec,
1009 x_return_status => x_return_status);
1010 IF x_return_status <> FND_API.g_ret_sts_success THEN
1011 RETURN;
1012 END IF;
1013 -- Check Items Lookups
1014
1015 check_ae_header_Lk_items(
1016 p_ae_header_rec => p_ae_header_rec,
1017 x_return_status => x_return_status);
1018 IF x_return_status <> FND_API.g_ret_sts_success THEN
1019 RETURN;
1020 END IF;
1021
1022 END Check_ae_header_Items;
1023
1024 PROCEDURE Complete_ae_header_Rec (
1025 p_ae_header_rec IN ae_header_rec_type,
1026 x_complete_rec OUT NOCOPY ae_header_rec_type)
1027 IS
1028 l_return_status VARCHAR2(1);
1029
1030 CURSOR c_complete IS
1031 SELECT *
1032 FROM ozf_ae_headers_all
1033 WHERE ae_header_id = p_ae_header_rec.ae_header_id;
1034 l_ae_header_rec c_complete%ROWTYPE;
1035 BEGIN
1036 x_complete_rec := p_ae_header_rec;
1037
1038
1039 OPEN c_complete;
1040 FETCH c_complete INTO l_ae_header_rec;
1041 CLOSE c_complete;
1042
1043 -- ae_header_id
1044 IF p_ae_header_rec.ae_header_id = FND_API.g_miss_num THEN
1045 x_complete_rec.ae_header_id := NULL;
1046 END IF;
1047 IF p_ae_header_rec.ae_header_id IS NULL THEN
1048 x_complete_rec.ae_header_id := l_ae_header_rec.ae_header_id;
1049 END IF;
1050
1051 -- object_version_number
1052 IF p_ae_header_rec.object_version_number = FND_API.g_miss_num THEN
1053 x_complete_rec.object_version_number := NULL;
1054 END IF;
1055 IF p_ae_header_rec.object_version_number IS NULL THEN
1056 x_complete_rec.object_version_number := l_ae_header_rec.object_version_number;
1057 END IF;
1058
1059 -- last_update_date
1060 IF p_ae_header_rec.last_update_date = FND_API.g_miss_date THEN
1061 x_complete_rec.last_update_date := NULL;
1062 END IF;
1063 IF p_ae_header_rec.last_update_date IS NULL THEN
1064 x_complete_rec.last_update_date := l_ae_header_rec.last_update_date;
1065 END IF;
1066
1067 -- last_updated_by
1068 IF p_ae_header_rec.last_updated_by = FND_API.g_miss_num THEN
1069 x_complete_rec.last_updated_by := NULL;
1070 END IF;
1071 IF p_ae_header_rec.last_updated_by IS NULL THEN
1072 x_complete_rec.last_updated_by := l_ae_header_rec.last_updated_by;
1073 END IF;
1074
1075 -- creation_date
1076 IF p_ae_header_rec.creation_date = FND_API.g_miss_date THEN
1077 x_complete_rec.creation_date := NULL;
1078 END IF;
1079 IF p_ae_header_rec.creation_date IS NULL THEN
1080 x_complete_rec.creation_date := l_ae_header_rec.creation_date;
1081 END IF;
1082
1083 -- created_by
1084 IF p_ae_header_rec.created_by = FND_API.g_miss_num THEN
1085 x_complete_rec.created_by := NULL;
1086 END IF;
1087 IF p_ae_header_rec.created_by IS NULL THEN
1088 x_complete_rec.created_by := l_ae_header_rec.created_by;
1089 END IF;
1090
1091 -- last_update_login
1092 IF p_ae_header_rec.last_update_login = FND_API.g_miss_num THEN
1093 x_complete_rec.last_update_login := NULL;
1094 END IF;
1095 IF p_ae_header_rec.last_update_login IS NULL THEN
1096 x_complete_rec.last_update_login := l_ae_header_rec.last_update_login;
1097 END IF;
1098
1099 -- request_id
1100 IF p_ae_header_rec.request_id = FND_API.g_miss_num THEN
1101 x_complete_rec.request_id := NULL;
1102 END IF;
1103 IF p_ae_header_rec.request_id IS NULL THEN
1104 x_complete_rec.request_id := l_ae_header_rec.request_id;
1105 END IF;
1106
1107 -- program_application_id
1108 IF p_ae_header_rec.program_application_id = FND_API.g_miss_num THEN
1109 x_complete_rec.program_application_id := NULL;
1110 END IF;
1111 IF p_ae_header_rec.program_application_id IS NULL THEN
1112 x_complete_rec.program_application_id := l_ae_header_rec.program_application_id;
1113 END IF;
1114
1115 -- program_update_date
1116 IF p_ae_header_rec.program_update_date = FND_API.g_miss_date THEN
1117 x_complete_rec.program_update_date := NULL;
1118 END IF;
1119 IF p_ae_header_rec.program_update_date IS NULL THEN
1120 x_complete_rec.program_update_date := l_ae_header_rec.program_update_date;
1121 END IF;
1122
1123 -- program_id
1124 IF p_ae_header_rec.program_id = FND_API.g_miss_num THEN
1125 x_complete_rec.program_id := NULL;
1126 END IF;
1127 IF p_ae_header_rec.program_id IS NULL THEN
1128 x_complete_rec.program_id := l_ae_header_rec.program_id;
1129 END IF;
1130
1131 -- accounting_event_id
1132 IF p_ae_header_rec.accounting_event_id = FND_API.g_miss_num THEN
1133 x_complete_rec.accounting_event_id := NULL;
1134 END IF;
1135 IF p_ae_header_rec.accounting_event_id IS NULL THEN
1136 x_complete_rec.accounting_event_id := l_ae_header_rec.accounting_event_id;
1137 END IF;
1138
1139 -- accounting_date
1140 IF p_ae_header_rec.accounting_date = FND_API.g_miss_date THEN
1141 x_complete_rec.accounting_date := NULL;
1142 END IF;
1143 IF p_ae_header_rec.accounting_date IS NULL THEN
1144 x_complete_rec.accounting_date := l_ae_header_rec.accounting_date;
1145 END IF;
1146
1147 -- accounting_error_code
1148 IF p_ae_header_rec.accounting_error_code = FND_API.g_miss_char THEN
1149 x_complete_rec.accounting_error_code := NULL;
1150 END IF;
1151 IF p_ae_header_rec.accounting_error_code IS NULL THEN
1152 x_complete_rec.accounting_error_code := l_ae_header_rec.accounting_error_code;
1153 END IF;
1154
1155 -- ae_category
1156 IF p_ae_header_rec.ae_category = FND_API.g_miss_char THEN
1157 x_complete_rec.ae_category := NULL;
1158 END IF;
1159 IF p_ae_header_rec.ae_category IS NULL THEN
1160 x_complete_rec.ae_category := l_ae_header_rec.ae_category;
1161 END IF;
1162
1163 -- ae_sequence_id
1164 IF p_ae_header_rec.ae_sequence_id = FND_API.g_miss_num THEN
1165 x_complete_rec.ae_sequence_id := NULL;
1166 END IF;
1167 IF p_ae_header_rec.ae_sequence_id IS NULL THEN
1168 x_complete_rec.ae_sequence_id := l_ae_header_rec.ae_sequence_id;
1169 END IF;
1170
1171 -- ae_sequence_value
1172 IF p_ae_header_rec.ae_sequence_value = FND_API.g_miss_num THEN
1173 x_complete_rec.ae_sequence_value := NULL;
1174 END IF;
1175 IF p_ae_header_rec.ae_sequence_value IS NULL THEN
1176 x_complete_rec.ae_sequence_value := l_ae_header_rec.ae_sequence_value;
1177 END IF;
1178
1179 -- cross_currency_flag
1180 IF p_ae_header_rec.cross_currency_flag = FND_API.g_miss_char THEN
1181 x_complete_rec.cross_currency_flag := NULL;
1182 END IF;
1183 IF p_ae_header_rec.cross_currency_flag IS NULL THEN
1184 x_complete_rec.cross_currency_flag := l_ae_header_rec.cross_currency_flag;
1185 END IF;
1186
1187 -- description
1188 IF p_ae_header_rec.description = FND_API.g_miss_char THEN
1189 x_complete_rec.description := NULL;
1190 END IF;
1191 IF p_ae_header_rec.description IS NULL THEN
1192 x_complete_rec.description := l_ae_header_rec.description;
1193 END IF;
1194
1195 -- gl_reversal_flag
1196 IF p_ae_header_rec.gl_reversal_flag = FND_API.g_miss_char THEN
1197 x_complete_rec.gl_reversal_flag := NULL;
1198 END IF;
1199 IF p_ae_header_rec.gl_reversal_flag IS NULL THEN
1200 x_complete_rec.gl_reversal_flag := l_ae_header_rec.gl_reversal_flag;
1201 END IF;
1202
1203 -- gl_transfer_error_code
1204 IF p_ae_header_rec.gl_transfer_error_code = FND_API.g_miss_char THEN
1205 x_complete_rec.gl_transfer_error_code := NULL;
1206 END IF;
1207 IF p_ae_header_rec.gl_transfer_error_code IS NULL THEN
1208 x_complete_rec.gl_transfer_error_code := l_ae_header_rec.gl_transfer_error_code;
1209 END IF;
1210
1211 -- gl_transfer_flag
1212 IF p_ae_header_rec.gl_transfer_flag = FND_API.g_miss_char THEN
1213 x_complete_rec.gl_transfer_flag := NULL;
1214 END IF;
1215 IF p_ae_header_rec.gl_transfer_flag IS NULL THEN
1216 x_complete_rec.gl_transfer_flag := l_ae_header_rec.gl_transfer_flag;
1217 END IF;
1218
1219 -- gl_transfer_run_id
1220 IF p_ae_header_rec.gl_transfer_run_id = FND_API.g_miss_num THEN
1221 x_complete_rec.gl_transfer_run_id := NULL;
1222 END IF;
1223 IF p_ae_header_rec.gl_transfer_run_id IS NULL THEN
1224 x_complete_rec.gl_transfer_run_id := l_ae_header_rec.gl_transfer_run_id;
1225 END IF;
1226
1227 -- org_id
1228 IF p_ae_header_rec.org_id = FND_API.g_miss_num THEN
1229 x_complete_rec.org_id := NULL;
1230 END IF;
1231 IF p_ae_header_rec.org_id IS NULL THEN
1232 x_complete_rec.org_id := l_ae_header_rec.org_id;
1233 END IF;
1234
1235 -- period_name
1236 IF p_ae_header_rec.period_name = FND_API.g_miss_char THEN
1237 x_complete_rec.period_name := NULL;
1238 END IF;
1239 IF p_ae_header_rec.period_name IS NULL THEN
1240 x_complete_rec.period_name := l_ae_header_rec.period_name;
1241 END IF;
1242
1243 -- set_of_books_id
1244 IF p_ae_header_rec.set_of_books_id = FND_API.g_miss_num THEN
1245 x_complete_rec.set_of_books_id := NULL;
1246 END IF;
1247 IF p_ae_header_rec.set_of_books_id IS NULL THEN
1248 x_complete_rec.set_of_books_id := l_ae_header_rec.set_of_books_id;
1249 END IF;
1250
1251 -- attribute_category
1252 IF p_ae_header_rec.attribute_category = FND_API.g_miss_char THEN
1253 x_complete_rec.attribute_category := NULL;
1254 END IF;
1255 IF p_ae_header_rec.attribute_category IS NULL THEN
1256 x_complete_rec.attribute_category := l_ae_header_rec.attribute_category;
1257 END IF;
1258
1259 -- attribute1
1260 IF p_ae_header_rec.attribute1 = FND_API.g_miss_char THEN
1261 x_complete_rec.attribute1 := NULL;
1262 END IF;
1263 IF p_ae_header_rec.attribute1 IS NULL THEN
1264 x_complete_rec.attribute1 := l_ae_header_rec.attribute1;
1265 END IF;
1266
1267 -- attribute2
1268 IF p_ae_header_rec.attribute2 = FND_API.g_miss_char THEN
1269 x_complete_rec.attribute2 := NULL;
1270 END IF;
1271 IF p_ae_header_rec.attribute2 IS NULL THEN
1272 x_complete_rec.attribute2 := l_ae_header_rec.attribute2;
1273 END IF;
1274
1275 -- attribute3
1276 IF p_ae_header_rec.attribute3 = FND_API.g_miss_char THEN
1277 x_complete_rec.attribute3 := NULL;
1278 END IF;
1279 IF p_ae_header_rec.attribute3 IS NULL THEN
1280 x_complete_rec.attribute3 := l_ae_header_rec.attribute3;
1281 END IF;
1282
1283 -- attribute4
1284 IF p_ae_header_rec.attribute4 = FND_API.g_miss_char THEN
1285 x_complete_rec.attribute4 := NULL;
1286 END IF;
1287 IF p_ae_header_rec.attribute4 IS NULL THEN
1288 x_complete_rec.attribute4 := l_ae_header_rec.attribute4;
1289 END IF;
1290
1291 -- attribute5
1292 IF p_ae_header_rec.attribute5 = FND_API.g_miss_char THEN
1293 x_complete_rec.attribute5 := NULL;
1294 END IF;
1295 IF p_ae_header_rec.attribute5 IS NULL THEN
1296 x_complete_rec.attribute5 := l_ae_header_rec.attribute5;
1297 END IF;
1298
1299 -- attribute6
1300 IF p_ae_header_rec.attribute6 = FND_API.g_miss_char THEN
1301 x_complete_rec.attribute6 := NULL;
1302 END IF;
1303 IF p_ae_header_rec.attribute6 IS NULL THEN
1304 x_complete_rec.attribute6 := l_ae_header_rec.attribute6;
1305 END IF;
1306
1307 -- attribute7
1308 IF p_ae_header_rec.attribute7 = FND_API.g_miss_char THEN
1309 x_complete_rec.attribute7 := NULL;
1310 END IF;
1311 IF p_ae_header_rec.attribute7 IS NULL THEN
1312 x_complete_rec.attribute7 := l_ae_header_rec.attribute7;
1313 END IF;
1314
1315 -- attribute8
1316 IF p_ae_header_rec.attribute8 = FND_API.g_miss_char THEN
1317 x_complete_rec.attribute8 := NULL;
1318 END IF;
1319 IF p_ae_header_rec.attribute8 IS NULL THEN
1320 x_complete_rec.attribute8 := l_ae_header_rec.attribute8;
1321 END IF;
1322
1323 -- attribute9
1324 IF p_ae_header_rec.attribute9 = FND_API.g_miss_char THEN
1325 x_complete_rec.attribute9 := NULL;
1326 END IF;
1327 IF p_ae_header_rec.attribute9 IS NULL THEN
1328 x_complete_rec.attribute9 := l_ae_header_rec.attribute9;
1329 END IF;
1330
1331 -- attribute10
1332 IF p_ae_header_rec.attribute10 = FND_API.g_miss_char THEN
1333 x_complete_rec.attribute10 := NULL;
1334 END IF;
1335 IF p_ae_header_rec.attribute10 IS NULL THEN
1336 x_complete_rec.attribute10 := l_ae_header_rec.attribute10;
1337 END IF;
1338
1339 -- attribute11
1340 IF p_ae_header_rec.attribute11 = FND_API.g_miss_char THEN
1341 x_complete_rec.attribute11 := NULL;
1342 END IF;
1343 IF p_ae_header_rec.attribute11 IS NULL THEN
1344 x_complete_rec.attribute11 := l_ae_header_rec.attribute11;
1345 END IF;
1346
1347 -- attribute12
1348 IF p_ae_header_rec.attribute12 = FND_API.g_miss_char THEN
1349 x_complete_rec.attribute12 := NULL;
1350 END IF;
1351 IF p_ae_header_rec.attribute12 IS NULL THEN
1352 x_complete_rec.attribute12 := l_ae_header_rec.attribute12;
1353 END IF;
1354
1355 -- attribute13
1356 IF p_ae_header_rec.attribute13 = FND_API.g_miss_char THEN
1357 x_complete_rec.attribute13 := NULL;
1358 END IF;
1359 IF p_ae_header_rec.attribute13 IS NULL THEN
1360 x_complete_rec.attribute13 := l_ae_header_rec.attribute13;
1361 END IF;
1362
1363 -- attribute14
1364 IF p_ae_header_rec.attribute14 = FND_API.g_miss_char THEN
1365 x_complete_rec.attribute14 := NULL;
1366 END IF;
1367 IF p_ae_header_rec.attribute14 IS NULL THEN
1368 x_complete_rec.attribute14 := l_ae_header_rec.attribute14;
1369 END IF;
1370
1371 -- attribute15
1372 IF p_ae_header_rec.attribute15 = FND_API.g_miss_char THEN
1373 x_complete_rec.attribute15 := NULL;
1374 END IF;
1375 IF p_ae_header_rec.attribute15 IS NULL THEN
1376 x_complete_rec.attribute15 := l_ae_header_rec.attribute15;
1377 END IF;
1378
1379 -- Note: Developers need to modify the procedure
1380 -- to handle any business specific requirements.
1381 END Complete_ae_header_Rec;
1382 PROCEDURE Validate_ae_header(
1383 p_api_version_number IN NUMBER,
1384 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1385 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1386 p_ae_header_rec IN ae_header_rec_type,
1387 x_return_status OUT NOCOPY VARCHAR2,
1388 x_msg_count OUT NOCOPY NUMBER,
1389 x_msg_data OUT NOCOPY VARCHAR2
1390 )
1391 IS
1392 L_API_NAME CONSTANT VARCHAR2(30) := 'Validate_Ae_Header';
1393 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
1394 l_object_version_number NUMBER;
1395 l_ae_header_rec OZF_Ae_Header_PVT.ae_header_rec_type;
1396
1397 BEGIN
1398 -- Standard Start of API savepoint
1399 SAVEPOINT VALIDATE_Ae_Header_;
1400
1401 -- Standard call to check for call compatibility.
1402 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1403 p_api_version_number,
1404 l_api_name,
1405 G_PKG_NAME)
1406 THEN
1407 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1408 END IF;
1409
1410 -- Initialize message list if p_init_msg_list is set to TRUE.
1411 IF FND_API.to_Boolean( p_init_msg_list )
1412 THEN
1413 FND_MSG_PUB.initialize;
1414 END IF;
1415 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1416 Check_ae_header_Items(
1417 p_ae_header_rec => p_ae_header_rec,
1418 p_validation_mode => JTF_PLSQL_API.g_update,
1419 x_return_status => x_return_status
1420 );
1421
1422 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1423 RAISE FND_API.G_EXC_ERROR;
1424 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1425 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1426 END IF;
1427 END IF;
1428
1429 Complete_ae_header_Rec(
1430 p_ae_header_rec => p_ae_header_rec,
1431 x_complete_rec => l_ae_header_rec
1432 );
1433
1434 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1435 Validate_ae_header_Rec(
1436 p_api_version_number => 1.0,
1437 p_init_msg_list => FND_API.G_FALSE,
1438 x_return_status => x_return_status,
1439 x_msg_count => x_msg_count,
1440 x_msg_data => x_msg_data,
1441 p_ae_header_rec => l_ae_header_rec);
1442
1443 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1444 RAISE FND_API.G_EXC_ERROR;
1445 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1446 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1447 END IF;
1448 END IF;
1449
1450
1451 -- Debug Message
1452 IF g_debug THEN
1453 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
1454 END IF;
1455
1456
1457 -- Initialize API return status to SUCCESS
1458 x_return_status := FND_API.G_RET_STS_SUCCESS;
1459
1460
1461 -- Debug Message
1462 IF g_debug THEN
1463 OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
1464 END IF;
1465
1466 -- Standard call to get message count and if count is 1, get message info.
1467 FND_MSG_PUB.Count_And_Get
1468 (p_count => x_msg_count,
1469 p_data => x_msg_data
1470 );
1471 EXCEPTION
1472
1473 WHEN OZF_Utility_PVT.resource_locked THEN
1474 x_return_status := FND_API.g_ret_sts_error;
1475 OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
1476
1477 WHEN FND_API.G_EXC_ERROR THEN
1478 ROLLBACK TO VALIDATE_Ae_Header_;
1479 x_return_status := FND_API.G_RET_STS_ERROR;
1480 -- Standard call to get message count and if count=1, get the message
1481 FND_MSG_PUB.Count_And_Get (
1482 p_encoded => FND_API.G_FALSE,
1483 p_count => x_msg_count,
1484 p_data => x_msg_data
1485 );
1486
1487 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1488 ROLLBACK TO VALIDATE_Ae_Header_;
1489 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1490 -- Standard call to get message count and if count=1, get the message
1491 FND_MSG_PUB.Count_And_Get (
1492 p_encoded => FND_API.G_FALSE,
1493 p_count => x_msg_count,
1494 p_data => x_msg_data
1495 );
1496
1497 WHEN OTHERS THEN
1498 ROLLBACK TO VALIDATE_Ae_Header_;
1499 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1500 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1501 THEN
1502 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1503 END IF;
1504 -- Standard call to get message count and if count=1, get the message
1505 FND_MSG_PUB.Count_And_Get (
1506 p_encoded => FND_API.G_FALSE,
1507 p_count => x_msg_count,
1508 p_data => x_msg_data
1509 );
1510 End Validate_Ae_Header;
1511
1512
1513 PROCEDURE Validate_ae_header_rec(
1514 p_api_version_number IN NUMBER,
1515 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1516 x_return_status OUT NOCOPY VARCHAR2,
1517 x_msg_count OUT NOCOPY NUMBER,
1518 x_msg_data OUT NOCOPY VARCHAR2,
1519 p_ae_header_rec IN ae_header_rec_type
1520 )
1521 IS
1522 BEGIN
1523 -- Initialize message list if p_init_msg_list is set to TRUE.
1524 IF FND_API.to_Boolean( p_init_msg_list )
1525 THEN
1526 FND_MSG_PUB.initialize;
1527 END IF;
1528
1529 -- Initialize API return status to SUCCESS
1530 x_return_status := FND_API.G_RET_STS_SUCCESS;
1531
1532 -- Hint: Validate data
1533 -- If data not valid
1534 -- THEN
1535 -- x_return_status := FND_API.G_RET_STS_ERROR;
1536
1537 -- Debug Message
1538 IF g_debug THEN
1539 OZF_UTILITY_PVT.debug_message('Private API: Validate_dm_model_rec');
1540 END IF;
1541 -- Standard call to get message count and if count is 1, get message info.
1542 FND_MSG_PUB.Count_And_Get
1543 (p_count => x_msg_count,
1544 p_data => x_msg_data
1545 );
1546 END Validate_ae_header_Rec;
1547
1548 END OZF_Ae_Header_PVT;