[Home] [Help]
PACKAGE BODY: APPS.FA_XLA_EVENTS_PVT
Source
1 package body FA_XLA_EVENTS_PVT as
2 /* $Header: faeventb.pls 120.15.12010000.2 2008/07/31 07:13:32 sbhaskar ship $ */
3
4 g_print_debug boolean := fa_cache_pkg.fa_print_debug;
5
6 FUNCTION create_transaction_event
7 (p_asset_hdr_rec IN FA_API_TYPES.asset_hdr_rec_type,
8 p_asset_type_rec IN FA_API_TYPES.asset_type_rec_type,
9 px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
10 p_event_status IN VARCHAR2 DEFAULT NULL,
11 p_calling_fn IN VARCHAR2,
12 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return boolean IS
13
14 l_trx_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
15 l_security_context XLA_EVENTS_PUB_PKG.t_security;
16
17 l_event_type_code varchar2(30) ;
18 l_event_date date := px_trans_rec.transaction_date_entered;
19 l_event_status varchar2(30) ;
20 l_valuation_method varchar2(30) := p_asset_hdr_rec.book_type_code;
21
22 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.create_trx_event';
23
24 invalid_calling_fn exception;
25 invalid_event_status exception;
26
27 BEGIN
28
29 if (p_asset_type_rec.asset_type = 'EXPENSED') then
30 return true;
31 end if;
32
33 l_trx_source_info.application_id := 140;
34 l_trx_source_info.legal_entity_id := NULL;
35 l_trx_source_info.ledger_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
36 l_trx_source_info.transaction_number := to_char(px_trans_rec.transaction_header_id);
37 l_trx_source_info.source_id_int_1 := px_trans_rec.transaction_header_id;
38
39 -- conditionally set the entity and type codes
40 -- based on calling interface and other factors
41
42 l_trx_source_info.entity_type_code := 'TRANSACTIONS';
43
44 if (p_calling_fn = 'fa_addition_pvt.insert_asset') then
45 l_event_type_code := 'ADDITIONS';
46 elsif (p_calling_fn = 'fa_cip_pvt.do_cap_rev') then
47 if (p_asset_type_rec.asset_type = 'CIP') then
48 l_event_type_code := 'REVERSE_CAPITALIZATION';
49 else
50 l_event_type_code := 'CAPITALIZATION';
51 end if;
52 elsif (p_calling_fn = 'fa_adjustment_pvt.do_adjustment') then
53 l_event_type_code := 'ADJUSTMENTS';
54 elsif (p_calling_fn = 'fa_unplanned_pvt.do_unplanned') then
55 l_event_type_code := 'UNPLANNED_DEPRECIATION';
56 elsif (p_calling_fn = 'FA_RETIREMENT_PUB.do_all_books_retirement') then
57 l_event_type_code := 'RETIREMENTS';
58 elsif (p_calling_fn = 'FA_RETIREMENT_PUB.do_sub_regular_reinstatement') then
59 l_event_type_code := 'REINSTATEMENTS';
60 elsif (p_calling_fn = 'FA_DISTRIBUTION_PVT.do_distribution') then
61 if (px_trans_rec.transaction_type_code = 'RECLASS') then
62 l_event_type_code := 'CATEGORY_RECLASS';
63 elsif (px_trans_rec.transaction_type_code = 'UNIT ADJUSTMENT') then
64 l_event_type_code := 'UNIT_ADJUSTMENTS';
65 else -- all tax book transactions and TRANSFER and TRANSFER OUT
66 l_event_type_code := 'TRANSFERS';
67 end if;
68 elsif (p_calling_fn = 'fa_reval_pvt.do_reval') then
69 l_event_type_code := 'REVALUATION';
70 elsif (p_calling_fn = 'FA_TAX_RSV_ADJ_PVT.do_tax_rsv_adj') then
71 l_event_type_code := 'DEPRECIATION_ADJUSTMENTS';
72 elsif (p_calling_fn = 'fa_ret_adj_pub.do_all_books') then
73 l_event_type_code := 'RETIREMENT_ADJUSTMENTS';
74 elsif (p_calling_fn = 'FA_GAINLOSS_UND_PKG.fagtax') then
75 l_event_type_code := 'TRANSFERS';
76 elsif (p_calling_fn = 'FA_TERMINAL_GAIN_LOSS_PVT.fadtgl') then
77 l_event_type_code := 'TERMINAL_GAIN_LOSS';
78 else
79 raise invalid_calling_fn;
80 end if;
81
82
83 -- we are breaking by asset type so append CIP if needed
84 if (p_asset_type_rec.asset_type = 'CIP' and
85 p_calling_fn <> 'fa_cip_pvt.do_cap_rev') then
86 l_event_type_code := 'CIP_' || l_event_type_code;
87 end if;
88
89 -- set the status correctly
90 -- only retirements / reinstatements should use incomplete
91 if (p_event_status is null or
92 p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED) then
93 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED;
94 elsif (p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_INCOMPLETE) then
95 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_INCOMPLETE;
96 elsif (p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_NOACTION) then
97 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_NOACTION;
98 else
99 -- invalid type
100 raise invalid_event_status;
101 end if;
102
103 l_event_date := greatest(l_event_date,
104 fa_cache_pkg.fazcdp_record.calendar_period_open_date);
105
106
107 if (g_print_debug) then
108 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.application_id ', l_trx_source_info.application_id
109 ,p_log_level_rec => p_log_level_rec);
110 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.legal_entity_id ', l_trx_source_info.legal_entity_id
111 ,p_log_level_rec => p_log_level_rec);
112 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.ledger_id ', l_trx_source_info.ledger_id
113 ,p_log_level_rec => p_log_level_rec);
114 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.transaction_number', l_trx_source_info.transaction_number
115 ,p_log_level_rec => p_log_level_rec);
116 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.source_id_int_1', l_trx_source_info.source_id_int_1
117 ,p_log_level_rec => p_log_level_rec);
118 fa_debug_pkg.add(l_calling_fn, 'l_trx_source_info.entity_type_code', l_trx_source_info.entity_type_code
119 ,p_log_level_rec => p_log_level_rec);
120 fa_debug_pkg.add(l_calling_fn, 'l_event_type_code', l_event_type_code
121 ,p_log_level_rec => p_log_level_rec);
122 fa_debug_pkg.add(l_calling_fn, 'l_event_date', l_event_date
123 ,p_log_level_rec => p_log_level_rec);
124 fa_debug_pkg.add(l_calling_fn, 'l_valuation_method', l_valuation_method
125 ,p_log_level_rec => p_log_level_rec);
126
127 end if;
128
129 -- Call XLA API
130 px_trans_rec.event_id :=
131 XLA_EVENTS_PUB_PKG.create_event
132 (p_event_source_info => l_trx_source_info,
133 p_event_type_code => l_event_type_code,
134 p_event_date => l_event_date,
135 p_event_status_code => l_event_status,
136 p_event_number => NULL,
137 p_reference_info => NULL,
138 p_valuation_method => l_valuation_method,
139 p_security_context => l_security_context);
140
141 return true;
142
143 EXCEPTION
144 WHEN INVALID_CALLING_FN THEN
145 fa_srvr_msg.add_message
146 (name => '***FA_INVALID_CALLING_FN***',
147 calling_fn => l_calling_fn
148 ,p_log_level_rec => p_log_level_rec);
149 return FALSE;
150
151 WHEN INVALID_EVENT_STATUS THEN
152 fa_srvr_msg.add_message
153 (name => '***FA_EVENT_STATUS***',
154 calling_fn => l_calling_fn
155 ,p_log_level_rec => p_log_level_rec);
156 return FALSE;
157
158 WHEN OTHERS THEN
159 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
160 ,p_log_level_rec => p_log_level_rec);
161 return FALSE;
162
163 END create_transaction_event;
164
165
166 -- this routine is used for events crossing multiple transactions
167 -- specifically invoice transfer, group reserve transfers
168
169 FUNCTION create_dual_transaction_event
170 (p_asset_hdr_rec_src IN FA_API_TYPES.asset_hdr_rec_type,
171 p_asset_hdr_rec_dest IN FA_API_TYPES.asset_hdr_rec_type,
172 p_asset_type_rec_src IN FA_API_TYPES.asset_type_rec_type,
173 p_asset_type_rec_dest IN FA_API_TYPES.asset_type_rec_type,
174 px_trans_rec_src IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
175 px_trans_rec_dest IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
176 p_event_status IN VARCHAR2 DEFAULT NULL,
177 p_calling_fn IN VARCHAR2,
178 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return boolean is
179
180 l_trx_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
181 l_security_context XLA_EVENTS_PUB_PKG.t_security;
182
183 l_event_type_code varchar2(30) ;
184 l_event_date date := px_trans_rec_src.transaction_date_entered;
185 l_event_status varchar2(30) ;
186 l_valuation_method varchar2(30) := p_asset_hdr_rec_src.book_type_code;
187
188 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.create_dual_trx_event';
189
190 invalid_calling_fn exception;
191 invalid_event_status exception;
192
193 BEGIN
194
195 if (p_asset_type_rec_src.asset_type = 'EXPENSED') then
196 return true;
197 end if;
198
199 l_trx_source_info.application_id := 140;
200 l_trx_source_info.legal_entity_id := NULL;
201 l_trx_source_info.ledger_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
202 l_trx_source_info.transaction_number := NULL; --to_char(px_trans_rec_src.transaction_header_id);
203 l_trx_source_info.source_id_int_1 := px_trans_rec_src.trx_reference_id;
204
205
206 -- conditionally set the entity and type codes
207 -- based on calling interface and other factors
208
209 l_trx_source_info.entity_type_code := 'INTER_ASSET_TRANSACTIONS';
210
211 if (p_calling_fn = 'fa_inv_xfr_pub.do_transfer') then
212 if (p_asset_type_rec_src.asset_type = 'CAPITALIZED' or
213 p_asset_type_rec_dest.asset_type = 'CAPITALIZED') then
214 l_event_type_code := 'SOURCE_LINE_TRANSFERS';
215 else
216 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS';
217 end if;
218 elsif (p_calling_fn = 'fa_rsv_transfer_pub.do_all_books') then
219 l_event_type_code := 'RESERVE_TRANSFERS';
220 else
221 raise invalid_calling_fn;
222 end if;
223
224
225 -- set the status correctly
226 -- only retirements / reinstatements should use incomplete
227 if (p_event_status is null or
228 p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED) then
229 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED;
230 elsif (p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_INCOMPLETE) then
231 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_INCOMPLETE;
232 elsif (p_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_NOACTION) then
233 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_NOACTION;
234 else
235 -- invalid type
236 raise invalid_event_status;
237 end if;
238
239 l_event_date := greatest(l_event_date,
240 fa_cache_pkg.fazcdp_record.calendar_period_open_date);
241
242 -- Call XLA API
243 px_trans_rec_src.event_id :=
244 XLA_EVENTS_PUB_PKG.create_event
245 (p_event_source_info => l_trx_source_info,
246 p_event_type_code => l_event_type_code,
247 p_event_date => l_event_date,
248 p_event_status_code => l_event_status,
249 p_event_number => NULL,
250 p_reference_info => NULL,
251 p_valuation_method => l_valuation_method,
252 p_security_context => l_security_context);
253
254 px_trans_rec_dest.event_id := px_trans_rec_src.event_id;
255
256 return true;
257
258 EXCEPTION
259 WHEN INVALID_CALLING_FN THEN
260 fa_srvr_msg.add_message
261 (name => '***FA_INVALID_CALLING_FN***',
262 calling_fn => l_calling_fn
263 ,p_log_level_rec => p_log_level_rec);
264 return FALSE;
265
266 WHEN INVALID_EVENT_STATUS THEN
267 fa_srvr_msg.add_message
268 (name => '***FA_EVENT_STATUS***',
269 calling_fn => l_calling_fn
270 ,p_log_level_rec => p_log_level_rec);
271 return FALSE;
272
273 WHEN OTHERS THEN
274 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
275 ,p_log_level_rec => p_log_level_rec);
276 return FALSE;
277
278
279
280 END create_dual_transaction_event;
281
282 PROCEDURE create_deprn_event
283 (p_asset_id IN number,
284 p_book_type_code IN varchar2,
285 p_period_counter IN number,
286 p_period_close_date IN date,
287 p_deprn_run_id IN number,
288 p_ledger_id IN number,
289 x_event_id OUT NOCOPY number,
290 p_calling_fn IN VARCHAR2,
291 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
292
293 l_deprn_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
294 l_security_context XLA_EVENTS_PUB_PKG.t_security;
295
296 l_event_type_code varchar2(30) ;
297 l_event_date date := p_period_close_date;
298 l_event_status varchar2(30) ;
299 l_valuation_method varchar2(30) := p_book_type_code;
300
301 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.create_deprn_event';
302
303 BEGIN
304
305 l_deprn_source_info.application_id := 140;
306 l_deprn_source_info.ledger_id := p_ledger_id;
307 l_deprn_source_info.source_id_int_1 := p_asset_id;
308 l_deprn_source_info.source_id_char_1 := p_book_type_code;
309 l_deprn_source_info.source_id_int_2 := p_period_counter;
310 l_deprn_source_info.source_id_int_3 := p_deprn_run_id;
311
312 -- conditionally set the entity and type codes
313 -- based on calling interface and other factors
314
315 l_deprn_source_info.entity_type_code := 'DEPRECIATION';
316
317 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED;
318
319 -- Call XLA API
320 x_event_id :=
321 XLA_EVENTS_PUB_PKG.create_event
322 (p_event_source_info => l_deprn_source_info,
323 p_event_type_code => 'ROLLBACK_DEPRECIATION',
324 p_event_date => l_event_date,
325 p_event_status_code => l_event_status,
326 p_event_number => NULL,
327 p_reference_info => NULL,
328 p_valuation_method => l_valuation_method,
329 p_security_context => l_security_context);
330
331 EXCEPTION
332 WHEN OTHERS THEN
333 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
334 ,p_log_level_rec => p_log_level_rec);
335 raise;
336
337 END create_deprn_event;
338
339 --
340 -- This routine is internally called from both the depreciation and
341 -- deferred stubs for event handling. the calling program will insure
342 -- that all arrays passed in pertain to the same set of assets, book
343 -- and period and also that all assets belong to the same legal entity
344 -- since the bulk event creation api requires this to be passed
345 -- as a single parameter and not in the event array.
346 --
347
348 PROCEDURE create_bulk_deprn_event
349 (p_asset_id_tbl IN number_tbl_type,
350 p_book_type_code IN varchar2, -- tax for deferred
351 p_period_counter IN number,
352 p_period_close_date IN date,
353 p_deprn_run_id IN number,
354 p_entity_type_code IN varchar2,
355 x_event_id_tbl OUT NOCOPY number_tbl_type,
356 p_calling_fn IN VARCHAR2,
357 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
358
359 l_legal_entity_id number;
360
361 l_entity_event_info_tbl_in xla_events_pub_pkg.t_array_entity_event_info_s;
362 l_entity_event_info_tbl_out xla_events_pub_pkg.t_array_entity_event_info_s;
363
364 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.create_bulk_deprn_event';
365
366 l_dummy_number number_tbl_type;
367
368 BEGIN
369
370 for i in 1..p_asset_id_tbl.count loop
371 l_dummy_number (i) := i;
372 end loop;
373
374 -- load the array as required by SLA:
375 -- verify event number and transaction number relevance here
376 -- since neither table uses a transaction sequence
377 forall i in 1..p_asset_id_tbl.count
378 insert into xla_events_int_gt
379 (APPLICATION_ID ,
380 LEDGER_ID ,
381 LEGAL_ENTITY_ID ,
382 ENTITY_CODE ,
383 event_type_code ,
384 event_date ,
385 event_number ,
386 event_status_code ,
387 transaction_number ,
388 source_id_int_1 ,
389 source_id_char_1 ,
390 source_id_int_2 ,
391 source_id_int_3 ,
392 valuation_method
393 )
394 values
395 (140 ,
396 fa_cache_pkg.fazcbc_record.set_of_books_id,
397 l_legal_entity_id ,
398 p_entity_type_code ,
399 'DEPRECIATION' ,
400 p_period_close_date ,
401 l_dummy_number(i) ,
402 XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED,
403 l_dummy_number(i) ,
404 p_asset_id_tbl(i) ,
405 p_book_type_code ,
406 p_period_counter ,
407 p_deprn_run_id ,
408 p_book_type_code
409 );
410
411 XLA_EVENTS_PUB_PKG.create_bulk_events
412 (p_source_application_id => 140,
413 p_application_id => 140,
414 p_legal_entity_id => l_legal_entity_id,
415 p_ledger_id => fa_cache_pkg.fazcbc_record.set_of_books_id,
416 p_entity_type_code => p_entity_type_code
417 );
418
419 select event_id bulk collect
420 into x_event_id_tbl
421 from xla_events_int_gt
422 order by event_number;
423
424 EXCEPTION
425 WHEN OTHERS THEN
426 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
427 ,p_log_level_rec => p_log_level_rec);
428 raise;
429
430 END create_bulk_deprn_event;
431
432 --
433 -- This routine is internally called from the deferred stub
434 -- for event handling. the calling program will insure
435 -- that all arrays passed in pertain to the same set of assets, book
436 -- and period and also that all assets belong to the same legal entity
437 -- since the bulk event creation api requires this to be passed
438 -- as a single parameter and not in the event array.
439 --
440
441 PROCEDURE create_bulk_deferred_event
442 (p_asset_id_tbl IN number_tbl_type,
443 p_corp_book IN varchar2,
444 p_tax_book IN varchar2,
445 p_corp_period_counter IN number,
446 p_tax_period_counter IN number,
447 p_period_close_date IN date,
448 p_entity_type_code IN varchar2,
449 x_event_id_tbl OUT NOCOPY number_tbl_type,
450 p_calling_fn IN VARCHAR2,
451 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
452
453 l_dummy_number number_tbl_type;
454 l_legal_entity_id number;
455
456 l_entity_event_info_tbl_in xla_events_pub_pkg.t_array_entity_event_info_s;
457 l_entity_event_info_tbl_out xla_events_pub_pkg.t_array_entity_event_info_s;
458
459 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.create_bulk_deferred_event';
460
461 BEGIN
462
463 for i in 1..p_asset_id_tbl.count loop
464 l_dummy_number (i) := i;
465 end loop;
466
467 -- load the array as required by SLA:
468 -- verify event number and transaction number relevance here
469 -- since neither table uses a transaction sequence
470 forall i in 1..p_asset_id_tbl.count
471 insert into xla_events_int_gt
472 (APPLICATION_ID ,
473 LEDGER_ID ,
474 LEGAL_ENTITY_ID ,
475 ENTITY_CODE ,
476 event_type_code ,
477 event_date ,
478 event_number ,
479 event_status_code ,
480 transaction_number ,
481 source_id_int_1 ,
482 source_id_char_1 ,
483 source_id_char_2 ,
484 source_id_int_2 ,
485 valuation_method
486 )
487 values
488 (140 ,
489 fa_cache_pkg.fazcbc_record.set_of_books_id,
490 l_legal_entity_id ,
491 p_entity_type_code ,
492 'DEFERRED_DEPRECIATION' ,
493 p_period_close_date ,
494 l_dummy_number(i) ,
495 XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED,
496 l_dummy_number(i) ,
497 p_asset_id_tbl(i) ,
498 p_corp_book ,
499 p_tax_book ,
500 p_corp_period_counter,
501 p_corp_book
502 );
503
504 XLA_EVENTS_PUB_PKG.create_bulk_events
505 (p_source_application_id => 140,
506 p_application_id => 140,
507 p_legal_entity_id => l_legal_entity_id,
508 p_ledger_id => fa_cache_pkg.fazcbc_record.set_of_books_id,
509 p_entity_type_code => p_entity_type_code
510 );
511
512 select event_id bulk collect
513 into x_event_id_tbl
514 from xla_events_int_gt
515 order by event_number;
516
517
518 EXCEPTION
519 WHEN OTHERS THEN
520 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
521 ,p_log_level_rec => p_log_level_rec);
522 raise;
523
524 END create_bulk_deferred_event;
525
526
527 -- update events
528 -- this is only called from gain/loss when processing the retirement
529 -- OPEN do we need to update the transaction date for unprocessed retirements?
530
531 /*
532
533 PROCEDURE update_event_status
534 (p_event_source_info IN xla_events_pub_pkg.t_event_source_info
535 ,p_event_class_code IN VARCHAR2 DEFAULT NULL
536 ,p_event_type_code IN VARCHAR2 DEFAULT NULL
537 ,p_event_date IN DATE DEFAULT NULL
538 ,p_event_status_code IN VARCHAR2
539 ,p_valuation_method IN VARCHAR2
540 ,p_security_context IN xla_events_pub_pkg.t_security
541
542 ,p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null);
543
544 */
545
546 FUNCTION update_transaction_event
547 (p_ledger_id IN NUMBER,
548 p_transaction_header_id IN NUMBER,
549 p_book_type_code IN VARCHAR2,
550 p_event_type_code IN VARCHAR2,
551 p_event_date IN DATE,
552 p_event_status_code IN VARCHAR2,
553 p_calling_fn IN VARCHAR2,
554 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return boolean IS
555
556 l_trx_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
557 l_security_context XLA_EVENTS_PUB_PKG.t_security;
558 l_event_type varchar2(30);
559 l_event_id number;
560
561 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.update_transaction_event';
562
563 begin
564
565 l_trx_source_info.application_id := 140;
566 l_trx_source_info.ledger_id := p_ledger_id;
567 l_trx_source_info.source_id_int_1 := p_transaction_header_id;
568 l_trx_source_info.entity_type_code := 'TRANSACTIONS';
569
570 select event_id
571 into l_event_id
572 from fa_transaction_headers
573 where transaction_header_id = p_transaction_header_id;
574
575 XLA_EVENTS_PUB_PKG.update_event
576 (p_event_source_info => l_trx_source_info,
577 p_event_id => l_event_id,
578 p_event_type_code => p_event_type_code,
579 p_event_date => p_event_date,
580 p_event_status_code => p_event_status_code,
581 p_valuation_method => p_book_type_code,
582 p_security_context => l_security_context);
583
584 return true;
585
586 EXCEPTION
587 WHEN OTHERS THEN
588 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
589 ,p_log_level_rec => p_log_level_rec);
590 return false;
591
592 end update_transaction_event;
593
594 FUNCTION update_inter_transaction_event
595 (p_ledger_id IN NUMBER,
596 p_trx_reference_id IN NUMBER,
597 p_book_type_code IN VARCHAR2,
598 p_event_type_code IN VARCHAR2,
599 p_event_date IN DATE,
600 p_event_status_code IN VARCHAR2,
601 p_calling_fn IN VARCHAR2,
602 p_log_level_rec in fa_api_types.log_level_rec_type default null
603 ) return boolean is
604
605 l_trx_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
606 l_security_context XLA_EVENTS_PUB_PKG.t_security;
607 l_event_type varchar2(30);
608 l_event_id number;
609
610 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.update_inter_transaction_event';
611
612 begin
613
614 l_trx_source_info.application_id := 140;
615 l_trx_source_info.ledger_id := p_ledger_id;
616 l_trx_source_info.source_id_int_1 := p_trx_reference_id;
617 l_trx_source_info.entity_type_code := 'INTER_ASSET_TRANSACTIONS';
618
619 select event_id
620 into l_event_id
621 from fa_trx_references
622 where trx_reference_id = p_trx_reference_id;
623
624 XLA_EVENTS_PUB_PKG.update_event
625 (p_event_source_info => l_trx_source_info,
626 p_event_id => l_event_id,
627 p_event_type_code => p_event_type_code,
628 p_event_date => p_event_date,
629 p_event_status_code => p_event_status_code,
630 p_valuation_method => p_book_type_code,
631 p_security_context => l_security_context);
632
633 return true;
634
635 EXCEPTION
636 WHEN OTHERS THEN
637 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
638 ,p_log_level_rec => p_log_level_rec);
639 return false;
640
641 end update_inter_transaction_event;
642
643 -- delete events (unrocessed additions/retirements/reinstatements/unprocessed deprn *only*)
644 -- this shoudl only be called from single transaction events
645 -- (specifically, when undoing retirement/reinstatements)
646
647 FUNCTION delete_transaction_event
648 (p_ledger_id IN NUMBER,
649 p_transaction_header_id IN NUMBER,
650 p_book_type_code IN VARCHAR2,
651 p_calling_fn IN VARCHAR2,
652 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return boolean IS
653
654 l_event_id NUMBER;
655 l_trx_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
656 l_security_context XLA_EVENTS_PUB_PKG.t_security;
657
658 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.delete_transaction_event';
659
660 BEGIN
661
662 l_trx_source_info.application_id := 140;
663 l_trx_source_info.ledger_id := p_ledger_id;
664 l_trx_source_info.source_id_int_1 := p_transaction_header_id;
665 l_trx_source_info.entity_type_code := 'TRANSACTIONS';
666
667 select event_id
668 into l_event_id
669 from fa_transaction_headers
670 where transaction_header_id = p_transaction_header_id;
671
672 XLA_EVENTS_PUB_PKG.delete_event
673 (p_event_source_info => l_trx_source_info,
674 p_event_id => l_event_id,
675 p_valuation_method => p_book_type_code,
676 p_security_context => l_security_context);
677
678 return true;
679
680 EXCEPTION
681 WHEN OTHERS THEN
682 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
683 ,p_log_level_rec => p_log_level_rec);
684 return false;
685
686 END delete_transaction_event;
687
688 FUNCTION delete_deprn_event
689 (p_event_id IN NUMBER,
690 p_ledger_id IN NUMBER,
691 p_asset_id IN NUMBER,
692 p_book_type_code IN VARCHAR2,
693 p_period_counter IN NUMBER,
694 p_deprn_run_id IN NUMBER,
695 p_calling_fn IN VARCHAR2,
696 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return boolean IS
697
698 l_event_id NUMBER;
699 l_deprn_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
700 l_security_context XLA_EVENTS_PUB_PKG.t_security;
701
702 l_calling_fn varchar2(80) := 'fa_xla_events_pvt.delete_deprn_event';
703
704 BEGIN
705
706 l_deprn_source_info.application_id := 140;
707 l_deprn_source_info.ledger_id := p_ledger_id;
708 l_deprn_source_info.source_id_int_1 := p_asset_id;
709 l_deprn_source_info.source_id_char_1 := p_book_type_code;
710 l_deprn_source_info.source_id_int_2 := p_period_counter;
711 l_deprn_source_info.source_id_int_3 := p_deprn_run_id;
712 l_deprn_source_info.entity_type_code := 'DEPRECIATION';
713
714 XLA_EVENTS_PUB_PKG.delete_event
715 (p_event_source_info => l_deprn_source_info,
716 p_event_id => p_event_id,
717 p_valuation_method => p_book_type_code,
718 p_security_context => l_security_context);
719
720 return true;
721
722 EXCEPTION
723 WHEN OTHERS THEN
724 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn
725 ,p_log_level_rec => p_log_level_rec);
726 return false;
727
728 END delete_deprn_event;
729
730 end FA_XLA_EVENTS_PVT;