[Home] [Help]
PACKAGE BODY: APPS.XLA_EVENTS_PUB_PKG
Source
1 PACKAGE BODY xla_events_pub_pkg AS
2 -- $Header: xlaevevp.pkb 120.31 2008/01/14 07:24:34 pshukla ship $
3 /*===========================================================================+
4 | Copyright (c) 2001-2002 Oracle Corporation |
5 | Redwood Shores, CA, USA |
6 | All rights reserved. |
7 +============================================================================+
8 | FILENAME |
9 | xlaevevp.pkb |
10 | |
11 | PACKAGE NAME |
12 | xla_events_pub_pkg |
13 | |
14 | DESCRIPTION |
15 | This is a public package for product teams, which contains all the |
16 | APIs required for processing accounting events. |
17 | |
18 | Note: the APIs do not excute COMMIT or ROLLBACK. |
19 | |
20 | These public APIs are wrapper over public routines of xla_event_pkg |
21 | |
22 | HISTORY |
23 | 08-Feb-01 G. Gu Created |
24 | 10-Mar-01 P. Labrevois Reviewed |
25 | 17-Jul-01 P. Labrevois Added array create_event |
26 | 13-Sep-01 P. Labrevois Added 2nd array create_event |
27 | 08-Feb-02 S. Singhania Reviewed and performed major changes |
28 | 10-Feb-02 S. Singhania Made changes in APIs to handle 'Transaction |
29 | Number' (new column added in xla_entities) |
30 | 13-Feb-02 S. Singhania Made changes in APIs to handle 'Event Number' |
31 | 17-Feb-02 S. Singhania Added 'Org_id' parameter to all the APIs as a |
32 | 'security context' |
33 | 04-Apr-02 S. Singhania Replaced 'Org_id' parameter with the generic |
34 | paramenter 'p_security_context'. Removed the|
35 | not required, redundant APIs |
36 | 17-Apr-02 S. Singhania Removed shadow procedures. Added seperate APIs|
37 | to update transaction number, Event Number |
38 | and Reference Information |
39 | 06-May-02 S. Singhania Added "valuation_method" and "ledger_id". |
40 | Bug # 2351677. |
41 | 31-May-02 S. Singhania Removed one of the 'create_entity_event' API |
42 | Renamed 'create_entity_event' API to |
43 | 'create_bulk_events' |
44 | 23-Jul-02 S. Singhania commented 'get_document_status' API. |
45 | Bug # 2464825 |
46 | 09-Sep-02 S. Singhania modified 'create_bulk_events' API. Bug 2530796|
47 | 21-Feb-03 S. Singhania Added 'Trace' procedure. |
48 | 04-Sep-03 S. Singhania Made changes to satisfy enhanced requirement |
49 | for 'Source Application'. |
50 | - Added parameter to CREATE_BULK_EVENTS |
51 | 12-Dec-03 S. Singhania Removed the API UPDATE_TRANSACTION_NUMBER. |
52 | Bug # 3268790 |
53 | 25-Jun-04 W. Shen add a new function delete_entity(bug 3316535) |
54 | 23-OCT-04 W. Shen New API to delete/update/create event in bulk |
55 | 1- APR-05 W. Shen Add transaction_date to create_event api |
56 | add transaction_date to update_event API |
57 | 20-Apr-05 S. Singhania Bug 4312353. Modified the calls to routines in|
58 | xla_events_pkg to reflect the change in the |
59 | way we handle valuation method different |
60 | from other security columns |
61 | 02-May-05 V. Kumar Removed function create_bulk_events, |
62 | Bug # 4323140 |
63 +===========================================================================*/
64
65 --=============================================================================
66 -- *********** Local Trace Routine **********
67 --=============================================================================
68 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
69 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
70 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
71 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
72 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
73 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
74
75 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
76
77 C_DEFAULT_MODULE CONSTANT VARCHAR2(240) := 'xla.plsql.xla_events_pub_pkg';
78
79 g_debug_flag VARCHAR2(1) := NVL(fnd_profile.value('XLA_DEBUG_TRACE'),'N');
80
81 --l_log_module VARCHAR2(240);
82 g_log_level NUMBER;
83 g_log_enabled BOOLEAN;
84
85
86
87 PROCEDURE trace
88 (p_msg IN VARCHAR2
89 ,p_level IN NUMBER
90 ,p_module IN VARCHAR2 DEFAULT C_DEFAULT_MODULE) IS
91 BEGIN
92 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
93 fnd_log.message(p_level, p_module);
94 ELSIF p_level >= g_log_level THEN
95 fnd_log.string(p_level, p_module, p_msg);
96 END IF;
97 EXCEPTION
98 WHEN xla_exceptions_pkg.application_exception THEN
99 RAISE;
100 WHEN OTHERS THEN
101 xla_exceptions_pkg.raise_message
102 (p_location => 'xla_acct_setup_pub_pkg.trace');
103 END trace;
104
105
106 --=============================================================================
107 -- *********** Event creation routines **********
108 --=============================================================================
109 --=============================================================================
110 --
111 --
112 --
113 --
114 --
115 --
116 --
117 --
118 --
119 --
120 -- 1. create_event
121 --
122 --
123 --
124 --
125 --
126 --
127 --
128 --
129 --
130 --
131 --
132 --
133 --
134 --
135 --=============================================================================
136
137 --============================================================================
138 --
139 -- This procedure is used to create an event and returns event id.
140 -- It will also
141 -- - validate input parameters(except reference columns)
142 -- - create a new event
143 --
144 --============================================================================
145
146 FUNCTION create_event
147 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
148 ,p_event_type_code IN VARCHAR2
149 ,p_event_date IN DATE
150 ,p_event_status_code IN VARCHAR2
151 ,p_event_number IN INTEGER DEFAULT NULL
152 ,p_transaction_date IN DATE DEFAULT NULL
153 ,p_reference_info IN xla_events_pub_pkg.t_event_reference_info DEFAULT NULL
154 ,p_valuation_method IN VARCHAR2
155 ,p_security_context IN xla_events_pub_pkg.t_security)
156 RETURN INTEGER IS
157 BEGIN
158 trace('@ xla_events_pub_pkg.create_event (fn)' , 20);
159
160 xla_events_pub_pkg.g_security := p_security_context;
161 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
162
163 RETURN xla_events_pkg.create_event
164 (p_event_source_info => p_event_source_info
165 ,p_valuation_method => p_valuation_method
166 ,p_event_type_code => p_event_type_code
167 ,p_event_date => p_event_date
168 ,p_event_status_code => p_event_status_code
169 ,p_event_number => p_event_number
170 ,p_transaction_date => p_transaction_date
171 ,p_reference_info => p_reference_info
172 ,p_budgetary_control_flag => 'N');
173 EXCEPTION
174 WHEN xla_exceptions_pkg.application_exception THEN
175 RAISE;
176 WHEN OTHERS THEN
177 xla_exceptions_pkg.raise_message
178 (p_location => 'xla_events_pub_pkg.create_event (fn)');
179 END create_event;
180
181 --============================================================================
182 --
183 -- This procedure is used to create an event and returns event id.
184 -- It will also
185 -- - validate input parameters(except reference columns)
186 -- - create a new event
187 --
188 --============================================================================
189 FUNCTION create_event
190 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
191 ,p_event_type_code IN VARCHAR2
192 ,p_event_date IN DATE
193 ,p_event_status_code IN VARCHAR2
194 ,p_event_number IN INTEGER DEFAULT NULL
195 ,p_transaction_date IN DATE DEFAULT NULL
196 ,p_reference_info IN xla_events_pub_pkg.t_event_reference_info DEFAULT NULL
197 ,p_valuation_method IN VARCHAR2
198 ,p_security_context IN xla_events_pub_pkg.t_security
199 ,p_budgetary_control_flag IN VARCHAR2)
200 RETURN INTEGER IS
201 BEGIN
202 trace('@ xla_events_pub_pkg.create_event (fn)' , 20);
203
204 xla_events_pub_pkg.g_security := p_security_context;
205
206 RETURN xla_events_pkg.create_event
207 (p_event_source_info => p_event_source_info
208 ,p_valuation_method => p_valuation_method
209 ,p_event_type_code => p_event_type_code
210 ,p_event_date => p_event_date
211 ,p_event_status_code => p_event_status_code
212 ,p_event_number => p_event_number
213 ,p_transaction_date => p_transaction_date
214 ,p_reference_info => p_reference_info
215 ,p_budgetary_control_flag => p_budgetary_control_flag);
216 EXCEPTION
217 WHEN xla_exceptions_pkg.application_exception THEN
218 RAISE;
219 WHEN OTHERS THEN
220 xla_exceptions_pkg.raise_message
221 (p_location => 'xla_events_pub_pkg.create_event (fn)');
222 END create_event;
223
224
225 -------------------------------------------------------------------------------
226 -- Event updation routines
227 -------------------------------------------------------------------------------
228
229 --============================================================================
230 --
231 -- This procedure is used to manipulate the status of an event. It will
232 -- - validate input parameters
233 -- - lock the document
234 -- - ensure all selected events status are not 'Processed'
235 -- - update event
236 --
237 --============================================================================
238
239 PROCEDURE update_event_status
240 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
241 ,p_event_class_code IN VARCHAR2 DEFAULT NULL
242 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
243 ,p_event_date IN DATE DEFAULT NULL
244 ,p_event_status_code IN VARCHAR2
245 ,p_valuation_method IN VARCHAR2
246 ,p_security_context IN xla_events_pub_pkg.t_security) IS
247 BEGIN
248 trace('> xla_events_pub_pkg.update_event_status' , 20);
249
250 xla_events_pub_pkg.g_security := p_security_context;
251 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
252
253 xla_events_pkg.update_event_status
254 (p_event_source_info => p_event_source_info
255 ,p_valuation_method => p_valuation_method
256 ,p_event_class_code => p_event_class_code
257 ,p_event_type_code => p_event_type_code
258 ,p_event_date => p_event_date
259 ,p_event_status_code => p_event_status_code);
260
261 trace('< xla_events_pub_pkg.update_event_status' , 20);
262 EXCEPTION
263 WHEN xla_exceptions_pkg.application_exception THEN
264 RAISE;
265 WHEN OTHERS THEN
266 xla_exceptions_pkg.raise_message
267 (p_location => 'xla_events_pub_pkg.update_event_status');
268 END update_event_status;
269
270
271 --============================================================================
272 --
273 -- This procedure is used to manipulate the type, status, and/or date for a
274 -- specific event.
275 -- - validate input parameters
276 -- - lock the document
277 -- - ensure all selected events status are not 'Processed'
278 -- - update event
279 --
280 --============================================================================
281
282 PROCEDURE update_event
283 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
284 ,p_event_id IN INTEGER
285 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
286 ,p_event_date IN DATE DEFAULT NULL
287 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
288 ,p_valuation_method IN VARCHAR2
289 ,p_security_context IN xla_events_pub_pkg.t_security
290 ,p_transaction_date IN DATE DEFAULT NULL) IS
291 BEGIN
292 trace('> xla_events_pub_pkg.update_event' , 20);
293
294 xla_events_pub_pkg.g_security := p_security_context;
295 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
296
297 xla_events_pkg.update_event
298 (p_event_source_info => p_event_source_info
299 ,p_valuation_method => p_valuation_method
300 ,p_event_id => p_event_id
301 ,p_event_type_code => p_event_type_code
302 ,p_event_date => p_event_date
303 ,p_event_status_code => p_event_status_code
304 ,p_transaction_date => p_transaction_date);
305
306 trace('< xla_events_pub_pkg.update_event' , 20);
307 EXCEPTION
308 WHEN xla_exceptions_pkg.application_exception THEN
309 RAISE;
310 WHEN OTHERS THEN
311 xla_exceptions_pkg.raise_message
312 (p_location => 'xla_events_pub_pkg.update_event');
313 END update_event;
314
315
316 --============================================================================
317 --
318 -- This procedure is used to manipulate the type, status, date and/or
319 -- event numberany for a specific event.
320 -- - validate input parameters
321 -- - lock the document
322 -- - ensure all selected events status are not 'Processed'
323 -- - update event
324 --
325 --============================================================================
326
327 PROCEDURE update_event
328 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
329 ,p_event_id IN INTEGER
330 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
331 ,p_event_date IN DATE DEFAULT NULL
332 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
333 ,p_event_number IN INTEGER
334 ,p_valuation_method IN VARCHAR2
335 ,p_security_context IN xla_events_pub_pkg.t_security
336 ,p_transaction_date IN DATE DEFAULT NULL) IS
337 BEGIN
338 trace('> xla_events_pub_pkg.update_event' , 20);
339
340 xla_events_pub_pkg.g_security := p_security_context;
341 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
342
343 xla_events_pkg.update_event
344 (p_event_source_info => p_event_source_info
345 ,p_valuation_method => p_valuation_method
346 ,p_event_id => p_event_id
347 ,p_event_type_code => p_event_type_code
348 ,p_event_date => p_event_date
349 ,p_event_status_code => p_event_status_code
350 ,p_transaction_date => p_transaction_date
351 ,p_event_number => p_event_number
352 ,p_overwrite_event_num => 'Y');
353
354 trace('< xla_events_pub_pkg.update_event' , 20);
355 EXCEPTION
356 WHEN xla_exceptions_pkg.application_exception THEN
357 RAISE;
358 WHEN OTHERS THEN
359 xla_exceptions_pkg.raise_message
360 (p_location => 'xla_events_pub_pkg.update_event');
361 END update_event;
362
363
364 --============================================================================
365 --
366 -- This procedure is used to manipulate the type, status, date or any
367 -- reference information for a specific event.
368 -- - validate input parameters
369 -- - lock the document
370 -- - ensure all selected events status are not 'Processed'
371 -- - update event
372 --
373 --============================================================================
374
375 PROCEDURE update_event
376 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
377 ,p_event_id IN INTEGER
378 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
379 ,p_event_date IN DATE DEFAULT NULL
380 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
381 ,p_reference_info IN xla_events_pub_pkg.t_event_reference_info
382 ,p_valuation_method IN VARCHAR2
383 ,p_security_context IN xla_events_pub_pkg.t_security
384 ,p_transaction_date IN DATE DEFAULT NULL) IS
385 BEGIN
386 trace('> xla_events_pub_pkg.update_event' , 20);
387
388 xla_events_pub_pkg.g_security := p_security_context;
389 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
390
391 xla_events_pkg.update_event
392 (p_event_source_info => p_event_source_info
393 ,p_valuation_method => p_valuation_method
394 ,p_event_id => p_event_id
395 ,p_event_type_code => p_event_type_code
396 ,p_event_date => p_event_date
397 ,p_event_status_code => p_event_status_code
398 ,p_transaction_date => p_transaction_date
399 ,p_reference_info => p_reference_info
400 ,p_overwrite_ref_info => 'Y' );
401
402 trace('< xla_events_pub_pkg.update_event' , 20);
403 EXCEPTION
404 WHEN xla_exceptions_pkg.application_exception THEN
405 RAISE;
406 WHEN OTHERS THEN
407 xla_exceptions_pkg.raise_message
408 (p_location => 'xla_events_pub_pkg.update_event');
409 END update_event;
410
411
412 --============================================================================
413 --
414 -- This procedure is used to manipulate the type, status, date, event number
415 -- and/or any reference information for a specific event.
416 -- - validate input parameters
417 -- - lock the document
418 -- - ensure all selected events status are not 'Processed'
419 -- - update event
420 --
421 --============================================================================
422
423 PROCEDURE update_event
424 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
425 ,p_event_id IN INTEGER
426 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
427 ,p_event_date IN DATE DEFAULT NULL
428 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
429 ,p_event_number IN INTEGER
430 ,p_reference_info IN xla_events_pub_pkg.t_event_reference_info
431 ,p_valuation_method IN VARCHAR2
432 ,p_security_context IN xla_events_pub_pkg.t_security
433 ,p_transaction_date IN DATE DEFAULT NULL) IS
434 BEGIN
435 trace('> xla_events_pub_pkg.update_event' , 20);
436
437 xla_events_pub_pkg.g_security := p_security_context;
438 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
439
440 xla_events_pkg.update_event
441 (p_event_source_info => p_event_source_info
442 ,p_valuation_method => p_valuation_method
443 ,p_event_id => p_event_id
444 ,p_event_type_code => p_event_type_code
445 ,p_event_date => p_event_date
446 ,p_event_status_code => p_event_status_code
447 ,p_transaction_date => p_transaction_date
448 ,p_event_number => p_event_number
449 ,p_reference_info => p_reference_info
450 ,p_overwrite_event_num => 'Y'
451 ,p_overwrite_ref_info => 'Y');
452
453 trace('< xla_events_pub_pkg.update_event' , 20);
454 EXCEPTION
455 WHEN xla_exceptions_pkg.application_exception THEN
456 RAISE;
457 WHEN OTHERS THEN
458 xla_exceptions_pkg.raise_message
459 (p_location => 'xla_events_pub_pkg.update_event');
460 END update_event;
461
462
463 -------------------------------------------------------------------------------
464 -- Event deletion routines
465 -------------------------------------------------------------------------------
466
467 --============================================================================
468 --
469 -- This procedure is used to delete one event. It will:
470 -- - validate input parameters
471 -- - lock the document
472 -- - ensure all selected events status are not 'Processed'
473 -- - delete event
474 --
475 --============================================================================
476
477 PROCEDURE delete_event
478 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
479 ,p_event_id IN INTEGER
480 ,p_valuation_method IN VARCHAR2
481 ,p_security_context IN xla_events_pub_pkg.t_security) IS
482 BEGIN
483 trace('> xla_events_pub_pkg.delete_event' , 20);
484
485 xla_events_pub_pkg.g_security := p_security_context;
486 --xla_events_pub_pkg.g_valuation_method := p_valuation_method;
487
488 xla_events_pkg.delete_event
489 (p_event_source_info => p_event_source_info
490 ,p_valuation_method => p_valuation_method
491 ,p_event_id => p_event_id );
492
493 trace('< xla_events_pub_pkg.delete_event' , 20);
494 EXCEPTION
495 WHEN xla_exceptions_pkg.application_exception THEN
496 RAISE;
497 WHEN OTHERS THEN
498 xla_exceptions_pkg.raise_message
499 (p_location => 'xla_events_pub_pkg.delete_event');
500 END delete_event;
501
502
503 --============================================================================
504 --
505 -- This procedure is used to delete one to many event for a document and
506 -- return the number or record deleted. It will:
507 -- - validate input parameters
508 -- - lock the document
509 -- - ensure all selected events status are not 'Processed'
510 -- - delete unprocessed event(s)
511 --
512 --============================================================================
513
514 FUNCTION delete_events
515 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
516 ,p_event_class_code IN VARCHAR2 DEFAULT NULL
517 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
518 ,p_event_date IN DATE DEFAULT NULL
519 ,p_valuation_method IN VARCHAR2
520 ,p_security_context IN xla_events_pub_pkg.t_security)
521 RETURN INTEGER IS
522 BEGIN
523 trace('@ xla_events_pub_pkg.delete_events (fn)' , 20);
524
525 xla_events_pub_pkg.g_security := p_security_context;
526 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
527
528 RETURN xla_events_pkg.delete_events
529 (p_event_source_info => p_event_source_info
530 ,p_event_class_code => p_event_class_code
531 ,p_valuation_method => p_valuation_method
532 ,p_event_type_code => p_event_type_code
533 ,p_event_date => p_event_date);
534 EXCEPTION
535 WHEN xla_exceptions_pkg.application_exception THEN
536 RAISE;
537 WHEN OTHERS THEN
538 xla_exceptions_pkg.raise_message
539 (p_location => 'xla_events_pub_pkg.delete_events(fn)');
540 END delete_events;
541
542
543 --============================================================================
544 --
545 -- This function is used to delete one entity. It will:
546 -- - validate input parameters
547 -- - check if there is still event associated with the entity
548 -- - if yes, return 1 without deletion
549 -- - else delete entity, return 0
550 --
551 --============================================================================
552 FUNCTION delete_entity
553 (p_source_info IN xla_events_pub_pkg.t_event_source_info
554 ,p_valuation_method IN VARCHAR2
555 ,p_security_context IN xla_events_pub_pkg.t_security)
556 RETURN INTEGER IS
557 l_result INTEGER;
558 BEGIN
559 trace('> xla_events_pub_pkg.delete_entty' , 20);
560
561 xla_events_pub_pkg.g_security := p_security_context;
562 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
563
564 l_result := xla_events_pkg.delete_entity
565 (p_source_info => p_source_info
566 ,p_valuation_method => p_valuation_method);
567
568 trace('< xla_events_pub_pkg.delete_entity' , 20);
569 return l_result;
570 EXCEPTION
571 WHEN xla_exceptions_pkg.application_exception THEN
572 RAISE;
573 WHEN OTHERS THEN
574 xla_exceptions_pkg.raise_message
575 (p_location => 'xla_events_pub_pkg.delete_entity');
576 END delete_entity;
577
578 -------------------------------------------------------------------------------
579 -- Event information routines
580 -------------------------------------------------------------------------------
581
582 --============================================================================
583 --
584 -- This procedure is used to get information for a specific event. It
585 -- will:
586 -- - lock the document
587 -- - get the information
588 --
589 --============================================================================
590
591 FUNCTION get_event_info
592 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
593 ,p_event_id IN INTEGER
594 ,p_valuation_method IN VARCHAR2
595 ,p_security_context IN xla_events_pub_pkg.t_security)
596 RETURN xla_events_pub_pkg.t_event_info IS
597 BEGIN
598 trace('@ xla_events_pub_pkg.get_event_info' , 20);
599
600 xla_events_pub_pkg.g_security := p_security_context;
601 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
602
603 RETURN xla_events_pkg.get_event_info
604 (p_event_source_info => p_event_source_info
605 ,p_valuation_method => p_valuation_method
606 ,p_event_id => p_event_id);
607 EXCEPTION
608 WHEN xla_exceptions_pkg.application_exception THEN
609 RAISE;
610 WHEN OTHERS THEN
611 xla_exceptions_pkg.raise_message
612 (p_location => 'xla_events_pub_pkg.get_event_info');
613 END get_event_info;
614
615
616 --============================================================================
617 --
618 -- This procedure is used to get status for a specific event. It will:
619 -- - lock the document
620 -- - get the information
621 --
622 --============================================================================
623
624 FUNCTION get_event_status
625 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
626 ,p_event_id IN INTEGER
627 ,p_valuation_method IN VARCHAR2
628 ,p_security_context IN xla_events_pub_pkg.t_security)
629 RETURN VARCHAR2 IS
630 BEGIN
631 trace('@ xla_events_pub_pkg.get_event_status' , 20);
632
633 xla_events_pub_pkg.g_security := p_security_context;
634 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
635
636 RETURN xla_events_pkg.get_event_status
637 (p_event_source_info => p_event_source_info
638 ,p_valuation_method => p_valuation_method
639 ,p_event_id => p_event_id);
640 EXCEPTION
641 WHEN xla_exceptions_pkg.application_exception THEN
642 RAISE;
643 WHEN OTHERS THEN
644 xla_exceptions_pkg.raise_message
645 (p_location => 'xla_events_pub_pkg.get_event_status');
646 END get_event_status;
647
648
649 --============================================================================
650 --
651 -- This procedure is used to detect the existency of a particular event.
652 --
653 --============================================================================
654
655 FUNCTION event_exists
656 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
657 ,p_event_class_code IN VARCHAR2 DEFAULT NULL
658 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
659 ,p_event_date IN DATE DEFAULT NULL
660 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
661 ,p_event_number IN INTEGER DEFAULT NULL
662 ,p_valuation_method IN VARCHAR2
663 ,p_security_context IN xla_events_pub_pkg.t_security)
664 RETURN BOOLEAN IS
665 BEGIN
666 trace('@ xla_events_pub_pkg.event_exists' , 20);
667
668 xla_events_pub_pkg.g_security := p_security_context;
669 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
670
671 RETURN xla_events_pkg.event_exists
672 (p_event_source_info => p_event_source_info
673 ,p_valuation_method => p_valuation_method
674 ,p_event_class_code => p_event_class_code
675 ,p_event_type_code => p_event_type_code
676 ,p_event_date => p_event_date
677 ,p_event_status_code => p_event_status_code
678 ,p_event_number => p_event_number);
679 EXCEPTION
680 WHEN xla_exceptions_pkg.application_exception THEN
681 RAISE;
682 WHEN OTHERS THEN
683 xla_exceptions_pkg.raise_message
684 (p_location => 'xla_events_pub_pkg.event_exists');
685 END event_exists;
686
687
688 --============================================================================
689 --
690 -- This procedure is used to get information for all events associated
691 -- to a document. It will
692 -- - lock the document
693 -- - get the information
694 -- - return the information
695 --
696 --============================================================================
697
698 FUNCTION get_array_event_info
699 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
700 ,p_event_class_code IN VARCHAR2 DEFAULT NULL
701 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
702 ,p_event_date IN DATE DEFAULT NULL
703 ,p_event_status_code IN VARCHAR2 DEFAULT NULL
704 ,p_valuation_method IN VARCHAR2
705 ,p_security_context IN xla_events_pub_pkg.t_security)
706 RETURN xla_events_pub_pkg.t_array_event_info IS
707 BEGIN
708 trace('@ xla_events_pub_pkg.get_array_event_info' , 20);
709
710 xla_events_pub_pkg.g_security := p_security_context;
711 -- xla_events_pub_pkg.g_valuation_method := p_valuation_method;
712
713 RETURN xla_events_pkg.get_array_event_info
714 (p_event_source_info => p_event_source_info
715 ,p_valuation_method => p_valuation_method
716 ,p_event_class_code => p_event_class_code
717 ,p_event_type_code => p_event_type_code
718 ,p_event_date => p_event_date
719 ,p_event_status_code => p_event_status_code);
720 EXCEPTION
721 WHEN xla_exceptions_pkg.application_exception THEN
722 RAISE;
723 WHEN OTHERS THEN
724 xla_exceptions_pkg.raise_message
725 (p_location => 'xla_events_pub_pkg.get_array_event_info');
726 END get_array_event_info;
727
728 PROCEDURE create_bulk_events
729 (p_source_application_id IN INTEGER DEFAULT NULL
730 ,p_application_id IN INTEGER
731 ,p_legal_entity_id IN INTEGER DEFAULT NULL
732 ,p_ledger_id IN INTEGER
733 ,p_entity_type_code IN VARCHAR2) IS
734 BEGIN
735 xla_events_pkg.create_bulk_events(
736 p_source_application_id => p_source_application_id
737 , p_application_id => p_application_id
738 , p_legal_entity_id => p_legal_entity_id
739 , p_ledger_id => p_ledger_id
740 , p_entity_type_code => p_entity_type_code);
741
742 EXCEPTION
743 WHEN xla_exceptions_pkg.application_exception THEN
744 RAISE;
745 WHEN OTHERS THEN
746 xla_exceptions_pkg.raise_message
747 (p_location => 'xla_events_pub_pkg.create_bulk_events');
748 END create_bulk_events;
749
750 PROCEDURE update_bulk_event_statuses(p_application_id INTEGER) IS
751 BEGIN
752 xla_events_pkg.update_bulk_event_statuses(
753 p_application_id => p_application_id);
754
755 EXCEPTION
756 WHEN xla_exceptions_pkg.application_exception THEN
757 RAISE;
758 WHEN OTHERS THEN
759 xla_exceptions_pkg.raise_message
760 (p_location => 'xla_events_pub_pkg.update_bulk_event_statuses');
761 END update_bulk_event_statuses;
762
763 PROCEDURE delete_bulk_events(p_application_id INTEGER) IS
764 BEGIN
765 xla_events_pkg.delete_bulk_events(
766 p_application_id => p_application_id);
767
768 EXCEPTION
769 WHEN xla_exceptions_pkg.application_exception THEN
770 RAISE;
771 WHEN OTHERS THEN
772 xla_exceptions_pkg.raise_message
773 (p_location => 'xla_events_pub_pkg.delete_bulk_events');
774 END delete_bulk_events;
775
776 -- For subledger teams uptake of Period Close validation.
777 PROCEDURE period_close (p_api_version IN NUMBER
778 ,x_return_status IN OUT NOCOPY VARCHAR2
779 ,p_application_id IN NUMBER
780 ,p_ledger_id IN NUMBER
781 ,p_period_name IN VARCHAR2) IS
782
783 l_log_module VARCHAR2(240);
784 l_return_status VARCHAR2(16);
785 l_api_name CONSTANT VARCHAR2(30) := 'period_close';
786 l_api_version CONSTANT NUMBER := 1.0;
787 BEGIN
788
789 IF g_log_enabled THEN
790 l_log_module := C_DEFAULT_MODULE||'.period_close';
791 END IF;
792
793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
794 trace
795 ( p_msg => 'BEGIN of Period Close Function for Subledger check'
796 ,p_level => C_LEVEL_PROCEDURE
797 ,p_module => l_log_module);
798 END IF;
799
800 IF (NOT fnd_api.compatible_api_call
801 (p_current_version_number => p_api_version
802 ,p_caller_version_number => l_api_version
803 ,p_api_name => l_api_name
804 ,p_pkg_name => C_DEFAULT_MODULE)) THEN
805 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
806 ELSE
807
808 l_return_status := xla_events_pkg.period_close
809 (p_application_id => p_application_id
810 ,p_ledger_id => p_ledger_id
811 ,p_period_name => p_period_name);
812
813 IF l_return_status = 'TRUE' THEN
814 x_return_status := FND_API.G_RET_STS_SUCCESS;
815 ELSIF l_return_status = 'FALSE' THEN
816 x_return_status := FND_API.G_RET_STS_ERROR;
817 ELSIF l_return_status = 'ERROR' THEN
818 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
819 END IF;
820
821 END IF;
822
823 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
824 trace
825 ( p_msg => 'End of Period Close Function for Subledger check'
826 ,p_level => C_LEVEL_PROCEDURE
827 ,p_module => l_log_module);
828 END IF;
829
830 EXCEPTION
831 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
832 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
833 WHEN OTHERS THEN
834 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
835 trace
836 ( p_msg => 'End of Period Close function for Subledger
837 check with error'
838 ,p_level => C_LEVEL_PROCEDURE
839 ,p_module => l_log_module);
840 END IF;
841 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
842 END period_close;
843
844 FUNCTION period_close(p_subscription_guid IN raw
845 ,p_event IN OUT NOCOPY WF_EVENT_T)
846 RETURN VARCHAR2 is
847
848 l_parameter_list WF_PARAMETER_LIST_T;
849 l_ledger_id NUMBER;
850 l_period_name VARCHAR2(100);
851 l_log_module VARCHAR2(240);
852 return_status VARCHAR2(10);
853 BEGIN
854
855 -- get the parameter of the event
856 l_parameter_list := p_event.getParameterList;
857 l_period_name := wf_event.getValueForParameter('PERIOD_NAME',
858 l_parameter_list);
859 l_ledger_id := to_number(wf_event.getValueForParameter('LEDGER_ID',
860 l_parameter_list));
861
862 return_status := xla_events_pkg.period_close
863 (p_period_name => l_period_name
864 ,p_ledger_id => l_ledger_id
865 ,p_mode => 'W');
866 RETURN return_status;
867
868 EXCEPTION
869
870 WHEN xla_exceptions_pkg.application_exception THEN
871
872 WF_CORE.CONTEXT( 'xla_events_pub_pkg', 'period_close',
873 p_event.getEventName( ), p_subscription_guid);
874 WF_EVENT.setErrorInfo(p_event, 'ERROR');
875 RETURN 'ERROR';
876
877 END period_close;
878
879 --added bug6737299 update transaction number procedure
880
881 -------------------------------------------------------------------------------
882 -- Entity update routines
883 -------------------------------------------------------------------------------
884
885 --============================================================================
886 --
887 -- This procedure updates transaction number on the document.
888 --
889 --============================================================================
890
891 PROCEDURE update_transaction_number
892 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
893 ,p_transaction_number IN VARCHAR2
894 ,p_valuation_method IN VARCHAR2
895 ,p_security_context IN xla_events_pub_pkg.t_security
896 ,p_event_id IN PLS_INTEGER DEFAULT NULL) IS
897 BEGIN
898 trace('> xla_events_pub_pkg.update_transaction_number' , 20);
899
900 xla_events_pub_pkg.g_security := p_security_context;
901 xla_events_pub_pkg.g_valuation_method := p_valuation_method;
902
903 xla_events_pkg.update_transaction_number
904 (p_event_source_info => p_event_source_info
905 ,p_transaction_number => p_transaction_number
906 ,p_valuation_method => p_valuation_method
907 ,p_event_id => p_event_id
908 );
909
910 trace('< xla_events_pub_pkg.update_transaction_number' , 20);
911 EXCEPTION
912 WHEN xla_exceptions_pkg.application_exception THEN
913 RAISE;
914 WHEN OTHERS THEN
915 xla_exceptions_pkg.raise_message
916 (p_location => 'xla_events_pub_pkg.update_transaction_number');
917 END update_transaction_number;
918
919
920
921 BEGIN
922 g_log_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
923 g_log_enabled := fnd_log.test
924 (log_level => g_log_level
925 ,MODULE => C_DEFAULT_MODULE);
926
927 IF NOT g_log_enabled THEN
928 g_log_level := C_LEVEL_LOG_DISABLED;
929 END IF;
930
931 END xla_events_pub_pkg;