[Home] [Help]
PACKAGE BODY: APPS.XLA_CMP_EVENT_TYPE_PKG
Source
1 PACKAGE BODY xla_cmp_event_type_pkg AS
2 /* $Header: xlacpevt.pkb 120.83 2011/03/22 07:33:55 karamakr ship $ */
3 /*===========================================================================+
4 | Copyright (c) 2001-2002 Oracle Corporation |
5 | Redwood Shores, CA, USA |
6 | All rights reserved. |
7 +============================================================================+
8 | PACKAGE NAME |
9 | xla_cmp_event_type_pkg |
10 | |
11 | DESCRIPTION |
12 | This is a XLA private package, which contains all the logic required |
13 | to generate Event Class or Event Type Function |
14 | from AMB specifcations |
15 | |
16 | |
17 | HISTORY |
18 | 25-JUN-2002 K.Boussema Created |
19 | 25-FEB-2003 K.Boussema Added 'dbdrv' command |
20 | 19-MAR-2003 K.Boussema Added amb_context_code |
21 | 02-APR-2003 K.boussema Added generation of analytical criteria |
22 | 14-APR-2003 K.Bouusema Added the error messages |
23 | 22-APR-2003 K.Boussema Included error messages |
24 | 22-APR-2003 K.Boussema Added SEQ_DOC_CATEGORY_CODE source |
25 | 13-MAI-2003 K.Boussema Modified the Extract according to bug 2857548|
26 | 02-JUN-2003 K.Boussema Modified to fix bug 2975670 and bug 2729143 |
27 | 27-JUN-2003 K.Boussema Renamed XLA_DESCRIPTION_PRIO table |
28 | 17-JUL-2003 K.Boussema Reviewd the code |
29 | 24-JUL-2003 K.Boussema Updated the error messages |
30 | 26-AUG-2003 K.Boussema Reviewd the generation of the extract to |
31 | handle the use of line_number as source |
32 | 10-SEP-2003 K.Boussema Changed to fix bug3095206:Accounting Reversal|
33 | 17-SEP-2003 K.Boussema Updated to Get je_category from cache:3109690|
34 | 09-OCT-2003 K.Boussema Changed to accept AADs differents Extract |
35 | specifcations |
36 | 27-OCT-2003 K.Boussema Changed to raise Error when no data retrieved|
37 | by the extract, bug 3203657 |
38 | 04-NOV-2003 K.Boussema Added new accounting reversal indicator value|
39 | 01-DEC-2003 K.Boussema Added the cache of Extract errors in code |
40 | generated by the compiler |
41 | 12-DEC-2003 K.Boussema Reviewed for bug 3042840 |
42 | 18-DEC-2003 K.Boussema Changed to fix bug 3042840,3307761,3268940 |
43 | 3310291 and 3320689 |
44 | 22-DEC-2003 K.Boussema Replaced Extract Validations by a call to |
45 | Extract Integrity Checker routine |
46 | 02-FRB-2004 K.Boussema Changed code generated, refer to bug 3274707 |
47 | 12-FEB-2004 K.Boussema Changed to only display the extraxt error msg|
48 | of the alway_populated objects |
49 | 19-FEB-2004 K.Boussema Made changes for the FND_LOG. |
50 | 12-MAR-2004 K.Boussema Changed to incorporate the select of lookups |
51 | from the extract objects |
52 | 22-MAR-2004 K.Boussema Added a parameter p_module to the TRACE calls|
53 | and the procedure. |
54 | 11-MAY-2004 K.Boussema Removed the call to XLA trace routine from |
55 | trace() procedure |
56 | 17-MAY-2004 W.Shen Accounting Attribute Enhancement project |
57 | check the dld for changed made to the package|
58 | 26-MAY-2004 W.Shen change code for the error message |
59 | 26-Jul-2004 W.Shen bug 3786968. transaction reversal do not have|
60 | extract line. When call function |
61 | xla_accounting_engine_pkg.CacheExtractErrors |
62 | The transaction reversal flag is passed. |
63 | 23-Sep-2004 S.Singhania Made changes for the bulk peroformance. It has |
64 | changed the code at number of places. |
65 | 05-Oct-2004 S.Singhania Bug 3931752: Modified constants C_EVENT_BODY |
66 | C_BODY_LINES to set correct target_ledger_id.|
67 | 08-Oct-2004 S.Singhania Bug 3939231: Added code to C_EVENT_BODY to |
68 | initialize xla_ae_lines_pkg.g_temp_line_num. |
69 | 12-Oct-2004 K.Boussema Made changes for the Accounting Event Extract|
70 | Diagnostics feature. |
71 | 08-Dec-2004 K.Boussema Updated to add diagnostic framework datamodel |
72 | changes |
73 | 27-DEC-2004 K.Boussema Changed the VARCHAR2 type by CLOB to handle the |
74 | large main procedure |
75 | 15-Feb-2005 W.Shen change code ledger currency project |
76 | remove alc object. |
77 | add the two calculate accounted amts, gain/loss |
78 | flags |
79 | 07-Mar-2005 K.Boussema Changed for ADR-enhancements. |
80 | 29-Mar-2005 M.Asada Changed for Reference Objects. |
81 | 18-Jul-2005 W.Chan 4495733 - In GetEntityName, update length |
82 | of l_name from 30 to 90 |
83 | 21-JUL-2005 K.Boussema Reviewed to handle the two cases: |
84 | - no header Transaction objects and |
85 | - no line Transaction objects |
86 | 22-Sep-2005 S.Singhania Bug 4544725. Implemented Business Flows and |
87 | Reversals for Non-Upgraded JEs. |
88 | 18-Oct-2005 V. Kumar Removed code for Analytical Criteria |
89 | 20-Jan-2006 A. Wan 4884853 - |
90 | Modified GenerateAccRevBody to adjust Accrual |
91 | Reversal Date before PostAccountingEngine. |
92 | 10-Feb-2006 A. Wan 5019460 - redundant logic in C_EVENT_BODY |
93 | 08-Mar-2006 V. Kumar Modified C_MAIN_PROCEDURE |
94 | 09-May-2006 V. Kumar 5217187 Populating GL_DATE for Reversal |
95 | 09-May-2006 A.WAn 5202219 - prevent trx rev error out. |
96 | 19-May-2006 V. Kumar 5229264 Populating gl_date for Trx rev. case |
97 | 09-Nov-2006 A.Wan 5648433 - init l_event_id for line_cursor. |
98 +===========================================================================*/
99
100 --
101 --+==========================================================================+
102 --| |
103 --| |
104 --| |
105 --| |
106 --| |
107 --| |
108 --| |
109 --| |
110 --| |
111 --| |
112 --| AAD templates/Global constants |
113 --| |
114 --| |
115 --| |
116 --| |
117 --| |
118 --| |
119 --| |
120 --| |
121 --| |
122 --+==========================================================================+
123 --
124 --
125 --+========================================================
126 --| Template of the main function CreateHeadersAndLines
127 --+========================================================
128 --
129 C_MAIN_PROCEDURE CONSTANT VARCHAR2(10000) := '
130 --
131 --+============================================+
132 --| |
133 --| PRIVATE FUNCTION |
134 --| |
135 --+============================================+
136 --
137 FUNCTION CreateHeadersAndLines
138 (p_application_id IN NUMBER
139 ,p_base_ledger_id IN NUMBER
140 ,p_target_ledger_id IN NUMBER
141 ,p_pad_start_date IN DATE
142 ,p_pad_end_date IN DATE
143 ,p_primary_ledger_id IN NUMBER)
144 RETURN BOOLEAN IS
145 l_created BOOLEAN:=FALSE;
146 l_event_id NUMBER;
147 l_event_date DATE;
148 l_language VARCHAR2(30);
149 l_currency_code VARCHAR2(30);
150 l_sla_ledger_id NUMBER;
151 l_log_module VARCHAR2(240);
152
153 BEGIN
154 --
155 IF g_log_enabled THEN
156 l_log_module := C_DEFAULT_MODULE||''.CreateHeadersAndLines'';
157 END IF;
158 --
159 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
160 trace
161 (p_msg => ''BEGIN of CreateHeadersAndLines''
162 ,p_level => C_LEVEL_PROCEDURE
163 ,p_module => l_log_module);
164 END IF;
165
166 l_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
167 l_currency_code := xla_ae_journal_entry_pkg.g_cache_ledgers_info.currency_code;
168 l_sla_ledger_id := xla_ae_journal_entry_pkg.g_cache_ledgers_info.sla_ledger_id;
169
170 --
171 -- initialize array of lines with NULL
172 --
173 xla_ae_lines_pkg.SetNullLine;
174
175 --
176 -- initialize header extract count -- Bug 4865292
177 --
178 g_hdr_extract_count:= 0;
179
180 $BODY_MAIN_PROCEDURE$
181
182 --
183 -- Bug 4865292
184 -- When the number of events and that of header extract do not match,
185 -- set the no header extract flag to indicate there are some issues
186 -- in header extract.
187 --
188 -- Event count context is set in xla_accounting_pkg.unit_processor.
189 -- Build_Message for this error is called in xla_accounting_pkg.post_accounting
190 -- to report it as a general error.
191 --
192 IF xla_context_pkg.get_event_count_context <> g_hdr_extract_count
193 AND xla_context_pkg.get_event_nohdr_context <> ''Y'' THEN
194
195 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
196 trace
197 (p_msg => ''# of extracted headers and events does not match''
198 ,p_level => C_LEVEL_STATEMENT
199 ,p_module => l_log_module);
200
201 trace
202 (p_msg => ''# of extracted headers: ''
203 ||g_hdr_extract_count
204 ,p_level => C_LEVEL_STATEMENT
205 ,p_module => l_log_module);
206
207 trace
208 (p_msg => ''# of events in xla_events_gt: ''
209 ||xla_context_pkg.get_event_count_context
210 ,p_level => C_LEVEL_STATEMENT
211 ,p_module => l_log_module);
212
213 trace
214 (p_msg => ''Event No Header Extract Context: ''
215 ||xla_context_pkg.get_event_nohdr_context
216 ,p_level => C_LEVEL_STATEMENT
217 ,p_module => l_log_module);
218
219 END IF;
220
221
222 xla_context_pkg.set_event_nohdr_context
223 (p_nohdr_extract_flag => ''Y''
224 ,p_client_id => sys_context(''USERENV'',''CLIENT_IDENTIFIER''));
225
226 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
227 trace
228 (p_msg => ''No Header Extract Flag is set to Y''
229 ,p_level => C_LEVEL_STATEMENT
230 ,p_module => l_log_module);
231 END IF;
232
233 END IF;
234
235 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
236 trace
237 (p_msg => ''END of CreateHeadersAndLines''
238 ,p_level => C_LEVEL_PROCEDURE
239 ,p_module => l_log_module);
240 END IF;
241
242 RETURN l_created;
243 EXCEPTION
244 WHEN xla_exceptions_pkg.application_exception THEN
245 RAISE;
246 WHEN OTHERS THEN
247 xla_exceptions_pkg.raise_message
248 (p_location => ''$PACKAGE_NAME$.CreateHeadersAndLines'');
249 END CreateHeadersAndLines;
250 --
251 --
252 ';
253 --
254 --+=============================================================
255 --| Template of ELSE ... END IF; in CreateHeadersAndLines
256 --+=============================================================
257 --
258 C_END_IF CONSTANT VARCHAR2(10000) := '
259 ELSE
260 --
261 -- Product error No PAD defined for this event type
262 --
263 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
264
265 xla_accounting_err_pkg.build_message
266 (p_appli_s_name => ''XLA''
267 ,p_msg_name => ''XLA_AP_INV_SYST_EVENT_TYPE''
268 ,p_token_1 => ''EVENT_TYPE_NAME''
269 ,p_value_1 => xla_ae_journal_entry_pkg.g_cache_event_tl.session_event_type
270 ,p_token_2 => ''PAD_NAME''
271 ,p_value_2 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
272 ,p_token_3 => ''PAD_OWNER''
273 ,p_value_3 => xla_lookups_pkg.get_meaning(
274 ''XLA_OWNER_TYPE''
275 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
276 )
277 ,p_token_4 => ''PRODUCT_NAME''
278 ,p_value_4 => xla_ae_journal_entry_pkg.g_cache_event.application_name
279 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
280 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
281 ,p_ledger_id => p_base_ledger_id
282 );
283 --
284 l_created := FALSE;
285 --
286 END IF;
287 --'
288 ;
289 --
290 --+=======================================
291 --| Template of Event Type Function
292 --+=======================================
293 --
294 C_EVENT_TYPE_PROC CONSTANT VARCHAR2(10000):= '
295 ---------------------------------------
296 --
297 -- PRIVATE FUNCTION
298 -- Event$EVENT_ID$
299 --
300 ----------------------------------------
301 --
302 FUNCTION Event$EVENT_ID$
303 (p_application_id IN NUMBER
304 ,p_base_ledger_id IN NUMBER
305 ,p_target_ledger_id IN NUMBER
306 ,p_language IN VARCHAR2
307 ,p_currency_code IN VARCHAR2
308 ,p_sla_ledger_id IN NUMBER
309 ,p_pad_start_date IN DATE
310 ,p_pad_end_date IN DATE
311 ,p_primary_ledger_id IN NUMBER)
312 RETURN BOOLEAN IS
313 --
314 C_EVENT_TYPE_CODE CONSTANT VARCHAR2(30) := ''$event_type_code$'';
315 C_EVENT_CLASS_CODE CONSTANT VARCHAR2(30) := ''$event_class_code$'';
316
317 l_calculate_acctd_flag VARCHAR2(1) :=''$calculate_acctd_flag$'';
318 l_calculate_g_l_flag VARCHAR2(1) :=''$calculate_g_l_flag$'';
319 --
320 l_array_legal_entity_id XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
321 l_array_entity_id XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
322 l_array_entity_code XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L;
323 l_array_transaction_num XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L;
324 l_array_event_id XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
325 l_array_class_code XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L;
326 l_array_event_type XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L;
327 l_array_event_number XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
328 l_array_event_date XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
329 l_array_transaction_date XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
330 l_array_reference_num_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
331 l_array_reference_num_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
332 l_array_reference_num_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
333 l_array_reference_num_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num;
334 l_array_reference_char_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L;
335 l_array_reference_char_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L;
336 l_array_reference_char_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L;
337 l_array_reference_char_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L;
338 l_array_reference_date_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
339 l_array_reference_date_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
340 l_array_reference_date_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
341 l_array_reference_date_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date;
342 l_array_event_created_by XLA_AE_JOURNAL_ENTRY_PKG.t_array_V100L;
343 l_array_budgetary_control_flag XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L;
344 l_array_header_events XLA_AE_JOURNAL_ENTRY_PKG.t_array_value_num; --added 8761772
345 l_array_duplicate_checker XLA_AE_JOURNAL_ENTRY_PKG.t_array_value_num; --added 8761772
346
347 l_event_id NUMBER;
348 l_previous_event_id NUMBER;
349 l_first_event_id NUMBER;
350 l_last_event_id NUMBER;
351
352 l_rec_acct_attrs XLA_AE_HEADER_PKG.t_rec_acct_attrs;
353 l_rec_rev_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
354 --
355 --
356 l_result BOOLEAN := TRUE;
357 l_rows NUMBER := 500;
358 l_event_type_name VARCHAR2(80) := ''$event_type_name$'';
359 l_event_class_name VARCHAR2(80) := ''$event_class_name$'';
360 l_description VARCHAR2(4000);
361 l_transaction_reversal NUMBER;
362 l_ae_header_id NUMBER;
363 l_array_extract_line_num xla_ae_journal_entry_pkg.t_array_Num;
364 l_log_module VARCHAR2(240);
365 --
366 l_acct_reversal_source VARCHAR2(30);
367 l_trx_reversal_source VARCHAR2(30);
368
369 l_continue_with_lines BOOLEAN := TRUE;
370 --
371 l_acc_rev_gl_date_source DATE; -- 4262811
372 --
373 type t_array_event_id is table of number index by binary_integer;
374
375 l_rec_array_event t_rec_array_event;
376 l_null_rec_array_event t_rec_array_event;
377 l_array_ae_header_id xla_number_array_type;
378 l_actual_flag VARCHAR2(1) := NULL;
379 l_actual_gain_loss_ref VARCHAR2(30) := ''#####'';
380 l_balance_type_code VARCHAR2(1) :=NULL;
381 l_gain_or_loss_ref VARCHAR2(30) :=NULL;
382
383 --
384 TYPE t_array_lookup_meaning IS TABLE OF fnd_lookup_values.meaning%TYPE INDEX BY BINARY_INTEGER;
385 --
386 $header_types$
387 $line_types$
388 $header_variables$
389 $line_variables$
390 $header_cursor$
391 $line_cursor$
392 --
393 BEGIN
394 IF g_log_enabled THEN
395 l_log_module := C_DEFAULT_MODULE||''.Event$EVENT_ID$'';
396 END IF;
397 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
398 trace
399 (p_msg => ''BEGIN of Event$EVENT_ID$''
400 ,p_level => C_LEVEL_PROCEDURE
401 ,p_module => l_log_module);
402 END IF;
403
404 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
405 trace
406 (p_msg => ''p_application_id = ''||p_application_id||
407 '' - p_base_ledger_id = ''||p_base_ledger_id||
408 '' - p_target_ledger_id = ''||p_target_ledger_id||
409 '' - p_language = ''||p_language||
410 '' - p_currency_code = ''||p_currency_code||
411 '' - p_sla_ledger_id = ''||p_sla_ledger_id
412 ,p_level => C_LEVEL_STATEMENT
413 ,p_module => l_log_module);
414 END IF;
415 --
416 -- initialze arrays
417 --
418 g_array_event.DELETE;
419 l_rec_array_event := l_null_rec_array_event;
420 --
421 --------------------------------------
422 -- 4262811 Initialze MPA Line Number
423 --------------------------------------
424 XLA_AE_HEADER_PKG.g_mpa_line_num := 0;
425
426 --
427 $event_body$
428 --
429 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
430 trace
431 (p_msg => ''END of Event$EVENT_ID$''
432 ,p_level => C_LEVEL_PROCEDURE
433 ,p_module => l_log_module);
434 END IF;
435 --
436 RETURN l_result;
437 EXCEPTION
438 WHEN xla_exceptions_pkg.application_exception THEN
439 $close_header_cursor$
440 $close_line_cursor$
441 RAISE;
442
443 WHEN NO_DATA_FOUND THEN
444
445 $no_data_exception$
446
447 xla_exceptions_pkg.raise_message
448 (p_location => ''$package_name$.Event$EVENT_ID$'');
449
450
451 WHEN OTHERS THEN
452 xla_exceptions_pkg.raise_message
453 (p_location => ''$package_name$.Event$EVENT_ID$'');
454 END Event$EVENT_ID$;
455 --
456 ';
457 --
458 --+==========================================================================+
459 --| |
460 --| Template to close header and line Cursors, if program fails |
461 --| |
462 --+==========================================================================+
463 --
464 -- Close header cursour
465 --
466 C_CLOSE_HEADER_CURSOR CONSTANT VARCHAR2(1000):= '
467 IF header_cur%ISOPEN THEN CLOSE header_cur; END IF;
468 ';
469 --
470 -- Close line cursor
471 --
472 C_CLOSE_LINE_CURSOR CONSTANT VARCHAR2(1000):= '
473 IF line_cur%ISOPEN THEN CLOSE line_cur; END IF;
474 ';
475
476
477 C_NO_DATA_EXCEPTION CONSTANT VARCHAR2(10000) := '
478
479 IF header_cur%ISOPEN THEN CLOSE header_cur; END IF;
480 IF line_cur%ISOPEN THEN CLOSE line_cur; END IF;
481
482 l_first_event_id := NULL; -- 8761772
483
484 FOR header_record IN header_cur
485 LOOP
486 IF l_first_event_id IS NULL THEN
487 l_first_event_id := header_record.event_id; -- 8761772
488 END IF;
489
490 l_array_header_events(header_record.event_id) := header_record.event_id;
491 l_last_event_id := header_record.event_id; -- 8761772
492
493 END LOOP;
494
495 fnd_file.put_line(fnd_file.LOG, '' '');
496 fnd_file.put_line(fnd_file.LOG, ''***************************************************************************'');
497 fnd_file.put_line(fnd_file.LOG, ''EVENT CLASS CODE = '' || C_EVENT_CLASS_CODE );
498 fnd_file.put_line(fnd_file.LOG, ''The following events are present in the line extract but MISSING in the header extract: '');
499
500 FOR line_record IN line_cur(l_first_event_id, l_last_event_id)
501 LOOP
502 IF (NOT l_array_header_events.EXISTS(line_record.event_id)) AND (NOT l_array_duplicate_checker.EXISTS(line_record.event_id)) THEN
503 fnd_file.put_line(fnd_file.log, ''Event_id = '' || line_record.event_id);
504 l_array_duplicate_checker(line_record.event_id) := line_record.event_id;
505 END IF;
506 END LOOP;
507
508 fnd_file.put_line(fnd_file.LOG, ''***************************************************************************'');
509 fnd_file.put_line(fnd_file.LOG, '' '');
510 ';
511
512
513 --
514 --+==========================================================================+
515 --| |
516 --| HEADER BODY TEMPLATE, WHEN THIRD PARTY CHANGE OPTION IS NOT USED |
517 --| |
518 --+==========================================================================+
519 --
520 -- when header extract objects exist
521 --
522 C_EVENT_BODY CONSTANT VARCHAR2(10000):= '
523 --
524 OPEN header_cur;
525 --
526 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
527 trace
528 (p_msg => ''SQL - FETCH header_cur''
529 ,p_level => C_LEVEL_STATEMENT
530 ,p_module => l_log_module);
531 END IF;
532 --
533 LOOP
534 FETCH header_cur BULK COLLECT INTO
535 l_array_entity_id
536 , l_array_legal_entity_id
537 , l_array_entity_code
538 , l_array_transaction_num
539 , l_array_event_id
540 , l_array_class_code
541 , l_array_event_type
542 , l_array_event_number
543 , l_array_event_date
544 , l_array_transaction_date
545 , l_array_reference_num_1
546 , l_array_reference_num_2
547 , l_array_reference_num_3
548 , l_array_reference_num_4
549 , l_array_reference_char_1
550 , l_array_reference_char_2
551 , l_array_reference_char_3
552 , l_array_reference_char_4
553 , l_array_reference_date_1
554 , l_array_reference_date_2
555 , l_array_reference_date_3
556 , l_array_reference_date_4
557 , l_array_event_created_by
558 , l_array_budgetary_control_flag $header_var$
559 LIMIT l_rows;
560 --
561 IF (C_LEVEL_EVENT >= g_log_level) THEN
562 trace
563 (p_msg => ''# rows extracted from header extract objects = ''||TO_CHAR(header_cur%ROWCOUNT)
564 ,p_level => C_LEVEL_EVENT
565 ,p_module => l_log_module);
566 END IF;
567 --
568 EXIT WHEN l_array_entity_id.COUNT = 0;
569
570 -- initialize arrays
571 XLA_AE_HEADER_PKG.g_rec_header_new := NULL;
572 XLA_AE_LINES_PKG.g_rec_lines := NULL;
573
574 --
575 -- Bug 4458708
576 --
577 XLA_AE_LINES_PKG.g_LineNumber := 0;
578
579
580 -- 4262811 - when creating Accrual Reversal or MPA, use g_last_hdr_idx to increment for next header id
581 g_last_hdr_idx := l_array_event_id.LAST;
582 --
583 -- loop for the headers. Each iteration is for each header extract row
584 -- fetched in header cursor
585 --
586 FOR hdr_idx IN l_array_event_id.FIRST .. l_array_event_id.LAST LOOP
587
588 --
589 -- set event info as cache for other routines to refer event attributes
590 --
591 XLA_AE_JOURNAL_ENTRY_PKG.set_event_info
592 (p_application_id => p_application_id
593 ,p_primary_ledger_id => p_primary_ledger_id
594 ,p_base_ledger_id => p_base_ledger_id
595 ,p_target_ledger_id => p_target_ledger_id
596 ,p_entity_id => l_array_entity_id(hdr_idx)
597 ,p_legal_entity_id => l_array_legal_entity_id(hdr_idx)
598 ,p_entity_code => l_array_entity_code(hdr_idx)
599 ,p_transaction_num => l_array_transaction_num(hdr_idx)
600 ,p_event_id => l_array_event_id(hdr_idx)
601 ,p_event_class_code => l_array_class_code(hdr_idx)
602 ,p_event_type_code => l_array_event_type(hdr_idx)
603 ,p_event_number => l_array_event_number(hdr_idx)
604 ,p_event_date => l_array_event_date(hdr_idx)
605 ,p_transaction_date => l_array_transaction_date(hdr_idx)
606 ,p_reference_num_1 => l_array_reference_num_1(hdr_idx)
607 ,p_reference_num_2 => l_array_reference_num_2(hdr_idx)
608 ,p_reference_num_3 => l_array_reference_num_3(hdr_idx)
609 ,p_reference_num_4 => l_array_reference_num_4(hdr_idx)
610 ,p_reference_char_1 => l_array_reference_char_1(hdr_idx)
611 ,p_reference_char_2 => l_array_reference_char_2(hdr_idx)
612 ,p_reference_char_3 => l_array_reference_char_3(hdr_idx)
613 ,p_reference_char_4 => l_array_reference_char_4(hdr_idx)
614 ,p_reference_date_1 => l_array_reference_date_1(hdr_idx)
615 ,p_reference_date_2 => l_array_reference_date_2(hdr_idx)
616 ,p_reference_date_3 => l_array_reference_date_3(hdr_idx)
617 ,p_reference_date_4 => l_array_reference_date_4(hdr_idx)
618 ,p_event_created_by => l_array_event_created_by(hdr_idx)
619 ,p_budgetary_control_flag => l_array_budgetary_control_flag(hdr_idx));
620
621 --
622 -- set the status of entry to C_VALID (0)
623 --
624 XLA_AE_JOURNAL_ENTRY_PKG.g_global_status := XLA_AE_JOURNAL_ENTRY_PKG.C_VALID;
625
626 --
627 -- initialize a row for ae header
628 --
629 XLA_AE_HEADER_PKG.InitHeader(hdr_idx);
630
631 l_event_id := l_array_event_id(hdr_idx);
632
633 --
634 -- storing the hdr_idx for event. May be used by line cursor.
635 --
636 g_array_event(l_event_id).array_value_num(''header_index'') := hdr_idx;
637
638 --
639 -- store sources from header extract. This can be improved to
640 -- store only those sources from header extract that may be used in lines
641 --
642 $cache_header_sources$
643
644 --
645 -- initilaize the status of ae headers for diffrent balance types
646 -- the status is initialised to C_NOT_CREATED (2)
647 --
648 --g_array_event(l_event_id).array_value_num(''actual_je_status'') := XLA_AE_JOURNAL_ENTRY_PKG.C_NOT_CREATED;
649 --g_array_event(l_event_id).array_value_num(''budget_je_status'') := XLA_AE_JOURNAL_ENTRY_PKG.C_NOT_CREATED;
650 --g_array_event(l_event_id).array_value_num(''encumbrance_je_status'') := XLA_AE_JOURNAL_ENTRY_PKG.C_NOT_CREATED;
651
652 --
653 -- call api to validate and store accounting attributes for header
654 --
655 $hdr_accounting_attributes$
656
657 XLA_AE_HEADER_PKG.SetHdrAcctAttrs(l_rec_acct_attrs);
658
659 XLA_AE_HEADER_PKG.SetJeCategoryName;
660
661 XLA_AE_HEADER_PKG.g_rec_header_new.array_event_type_code(hdr_idx) := l_array_event_type(hdr_idx);
662 XLA_AE_HEADER_PKG.g_rec_header_new.array_event_id(hdr_idx) := l_array_event_id(hdr_idx);
663 XLA_AE_HEADER_PKG.g_rec_header_new.array_entity_id(hdr_idx) := l_array_entity_id(hdr_idx);
664 XLA_AE_HEADER_PKG.g_rec_header_new.array_event_number(hdr_idx) := l_array_event_number(hdr_idx);
665 XLA_AE_HEADER_PKG.g_rec_header_new.array_target_ledger_id(hdr_idx) := p_target_ledger_id;
666
667 $call_header_description$
668 $call_hdr_analytic_criteria$
669
670 --
671 --accounting attribute enhancement, bug 3612931
672 --
673 l_trx_reversal_source := SUBSTR($trx_reversal_source$, 1,30);
674
675 IF NVL(l_trx_reversal_source, ''N'') NOT IN (''N'',''Y'') THEN
676 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
677
678 xla_accounting_err_pkg.build_message
679 (p_appli_s_name => ''XLA''
680 ,p_msg_name => ''XLA_AP_INVALID_HDR_ATTR''
681 ,p_token_1 => ''ACCT_ATTR_NAME''
682 ,p_value_1 => xla_ae_sources_pkg.GetAccountingSourceName(''TRX_ACCT_REVERSAL_OPTION'')
683 ,p_token_2 => ''PRODUCT_NAME''
684 ,p_value_2 => xla_ae_journal_entry_pkg.g_cache_event.application_name
685 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
686 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
687 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id);
688
689 ELSIF NVL(l_trx_reversal_source, ''N'') = ''Y'' THEN
690 --
691 -- following sets the accounting attributes needed to reverse
692 -- accounting for a distributeion
693 --
694 xla_ae_lines_pkg.SetTrxReversalAttrs
695 (p_event_id => l_event_id
696 ,p_gl_date => XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx)
697 ,p_trx_reversal_source => l_trx_reversal_source);
698
699 END IF;
700
701
702 ----------------------------------------------------------------
703 -- 4262811 - update the header statuses to invalid in need be
704 ----------------------------------------------------------------
705 --
706 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus (p_hdr_idx => hdr_idx);
707
708 $accrual_reversal_body$
709 ----------------------------------------------------------------
710
711 --
712 -- this ends the header loop iteration for one bulk fetch
713 --
714 END LOOP;
715
716 l_first_event_id := l_array_event_id(l_array_event_id.FIRST);
717 l_last_event_id := l_array_event_id(l_array_event_id.LAST);
718
719 --
720 -- insert dummy rows into lines gt table that were created due to
721 -- transaction reversals
722 --
723 IF XLA_AE_LINES_PKG.g_rec_lines.array_ae_header_id.COUNT > 0 THEN
724 l_result := XLA_AE_LINES_PKG.InsertLines;
725 END IF;
726
727 --
728 -- reset the temp_line_num for each set of events fetched from header
729 -- cursor rather than doing it for each new event in line cursor
730 -- Bug 3939231
731 --
732 xla_ae_lines_pkg.g_temp_line_num := 0;
733
734
735 $lines_body$
736
737 --
738 -- insert headers into xla_ae_headers_gt table
739 --
740 l_result := XLA_AE_HEADER_PKG.InsertHeaders ;
741
742 -- insert into errors table here.
743
744 END LOOP;
745
746 --
747 -- 4865292
748 --
749 -- Compare g_hdr_extract_count with event count in
750 -- CreateHeadersAndLines.
751 --
752 g_hdr_extract_count := g_hdr_extract_count + header_cur%ROWCOUNT;
753
754 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
755 trace (p_msg => ''# rows extracted from header extract objects ''
756 || '' (running total): ''
757 || g_hdr_extract_count
758 ,p_level => C_LEVEL_STATEMENT
759 ,p_module => l_log_module);
760 END IF;
761
762 CLOSE header_cur;
763 --
764 '; -- C_EVENT_BODY
765
766 --
767 --
768
769 --
770 --+==========================================================================+
771 --| |
772 --| HEADER BODY TEMPLATE, WHEN THIRD PARTY CHANGE OPTION IS USED |
773 --| |
774 --+==========================================================================+
775 --
776 --
777 C_THIRD_PARTY_CHANGE_BODY CONSTANT VARCHAR2(10000):= '
778 --
779 --
780 IF $third_party_change$ = ''Y'' THEN
781 --
782 xla_ae_header_pkg.change_third_party;
783 --
784 ELSIF NVL($third_party_change$,''N'') <> ''N'' THEN
785 --
786 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
787 --
788 xla_accounting_err_pkg.build_message
789 (p_appli_s_name => ''XLA''
790 ,p_msg_name => ''XLA_AP_THIRD_PARTY_OPTION''
791 ,p_token_1 => ''PRODUCT_NAME''
792 ,p_value_1 => xla_ae_journal_entry_pkg.g_cache_event.application_name
793 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
794 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
795 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
796 );
797 END IF;
798 --
799 ';
800 --
801 --+==========================================================================+
802 --| |
803 --| LINES BODY TEMPLATE, WHEN ACCOUNTING REVERSAL OPTION IS NOT USED |
804 --| |
805 --+==========================================================================+
806 --
807 -- Extract line Objects defined
808 --
809 C_BODY_LINES CONSTANT VARCHAR2(10000):= '
810 --
811 OPEN line_cur(x_first_event_id => l_first_event_id, x_last_event_id => l_last_event_id);
812 --
813 --
814 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
815
816 trace
817 (p_msg => ''SQL - FETCH line_cur''
818 ,p_level => C_LEVEL_STATEMENT
819 ,p_module => l_log_module);
820
821 END IF;
822 --
823 --
824 LOOP
825 --
826 FETCH line_cur BULK COLLECT INTO
827 l_array_entity_id
828 , l_array_legal_entity_id
829 , l_array_entity_code
830 , l_array_transaction_num
831 , l_array_event_id
832 , l_array_class_code
833 , l_array_event_type
834 , l_array_event_number
835 , l_array_event_date
836 , l_array_transaction_date
837 , l_array_reference_num_1
838 , l_array_reference_num_2
839 , l_array_reference_num_3
840 , l_array_reference_num_4
841 , l_array_reference_char_1
842 , l_array_reference_char_2
843 , l_array_reference_char_3
844 , l_array_reference_char_4
845 , l_array_reference_date_1
846 , l_array_reference_date_2
847 , l_array_reference_date_3
848 , l_array_reference_date_4
849 , l_array_event_created_by
850 , l_array_budgetary_control_flag
851 $line_var$
852 LIMIT l_rows;
853
854 --
855 IF (C_LEVEL_EVENT >= g_log_level) THEN
856 trace
857 (p_msg => ''# rows extracted from line extract objects = ''||TO_CHAR(line_cur%ROWCOUNT)
858 ,p_level => C_LEVEL_EVENT
859 ,p_module => l_log_module);
860 END IF;
861 --
862 EXIT WHEN l_array_entity_id.count = 0;
863
864 XLA_AE_LINES_PKG.g_rec_lines := null;
865
866 --
867 -- Bug 4458708
868 --
869 XLA_AE_LINES_PKG.g_LineNumber := 0;
870 --
871 --
872
873 FOR Idx IN 1..l_array_event_id.count LOOP
874 --
875 -- 5648433 (move l_event_id out of IF statement) set l_event_id to be used inside IF condition
876 --
877 l_event_id := l_array_event_id(idx); -- 5648433
878
879 --
880 -- Bug 4872078 - Do nothing if the event is meant for transaction reversal
881 --
882
883 IF NVL(xla_ae_header_pkg.g_rec_header_new.array_trx_acct_reversal_option
884 (g_array_event(l_event_id).array_value_num(''header_index''))
885 ,''N''
886 ) <> ''Y''
887 THEN
888 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
889 trace
890 (p_msg => ''Trancaction revesal option is not Y ''
891 ,p_level => C_LEVEL_STATEMENT
892 ,p_module => l_log_module);
893 END IF;
894
895 --
896 -- set the XLA_AE_JOURNAL_ENTRY_PKG.g_global_status to C_VALID (0)
897 --
898 XLA_AE_JOURNAL_ENTRY_PKG.g_global_status := XLA_AE_JOURNAL_ENTRY_PKG.C_VALID;
899 --
900 -- set event info as cache for other routines to refer event attributes
901 --
902
903 IF l_event_id <> NVL(l_previous_event_id, -1) THEN
904 l_previous_event_id := l_event_id;
905
906 XLA_AE_JOURNAL_ENTRY_PKG.set_event_info
907 (p_application_id => p_application_id
908 ,p_primary_ledger_id => p_primary_ledger_id
909 ,p_base_ledger_id => p_base_ledger_id
910 ,p_target_ledger_id => p_target_ledger_id
911 ,p_entity_id => l_array_entity_id(Idx)
912 ,p_legal_entity_id => l_array_legal_entity_id(Idx)
913 ,p_entity_code => l_array_entity_code(Idx)
914 ,p_transaction_num => l_array_transaction_num(Idx)
915 ,p_event_id => l_array_event_id(Idx)
916 ,p_event_class_code => l_array_class_code(Idx)
917 ,p_event_type_code => l_array_event_type(Idx)
918 ,p_event_number => l_array_event_number(Idx)
919 ,p_event_date => l_array_event_date(Idx)
920 ,p_transaction_date => l_array_transaction_date(Idx)
921 ,p_reference_num_1 => l_array_reference_num_1(Idx)
922 ,p_reference_num_2 => l_array_reference_num_2(Idx)
923 ,p_reference_num_3 => l_array_reference_num_3(Idx)
924 ,p_reference_num_4 => l_array_reference_num_4(Idx)
925 ,p_reference_char_1 => l_array_reference_char_1(Idx)
926 ,p_reference_char_2 => l_array_reference_char_2(Idx)
927 ,p_reference_char_3 => l_array_reference_char_3(Idx)
928 ,p_reference_char_4 => l_array_reference_char_4(Idx)
929 ,p_reference_date_1 => l_array_reference_date_1(Idx)
930 ,p_reference_date_2 => l_array_reference_date_2(Idx)
931 ,p_reference_date_3 => l_array_reference_date_3(Idx)
932 ,p_reference_date_4 => l_array_reference_date_4(Idx)
933 ,p_event_created_by => l_array_event_created_by(Idx)
934 ,p_budgetary_control_flag => l_array_budgetary_control_flag(Idx));
935 --
936 END IF;
937
938
939
940 --
941 xla_ae_lines_pkg.SetExtractLine(p_extract_line => l_array_extract_line_num(Idx));
942
943 l_acct_reversal_source := SUBSTR($acct_reversal_source$, 1,30);
944
945 IF l_continue_with_lines THEN
946 IF NVL(l_acct_reversal_source, ''N'') NOT IN (''N'',''Y'',''B'') THEN
947 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
948
949 xla_accounting_err_pkg.build_message
950 (p_appli_s_name => ''XLA''
951 ,p_msg_name => ''XLA_AP_INVALID_REVERSAL_OPTION''
952 ,p_token_1 => ''LINE_NUMBER''
953 ,p_value_1 => l_array_extract_line_num(Idx)
954 ,p_token_2 => ''PRODUCT_NAME''
955 ,p_value_2 => xla_ae_journal_entry_pkg.g_cache_event.application_name
956 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
957 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
958 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id);
959
960 ELSIF NVL(l_acct_reversal_source, ''N'') IN (''Y'',''B'') THEN
961 --
962 -- following sets the accounting attributes needed to reverse
963 -- accounting for a distributeion
964 --
965
966 --
967 -- 5217187
968 --
969 l_rec_rev_acct_attrs.array_acct_attr_code(1):= ''GL_DATE'';
970 l_rec_rev_acct_attrs.array_date_value(1) := XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(
971 g_array_event(l_event_id).array_value_num(''header_index''));
972 --
973 --
974
975 $acct_reversal_code$
976
977 xla_ae_lines_pkg.SetAcctReversalAttrs
978 (p_event_id => l_event_id
979 ,p_rec_acct_attrs => l_rec_rev_acct_attrs
980 ,p_calculate_acctd_flag => l_calculate_acctd_flag
981 ,p_calculate_g_l_flag => l_calculate_g_l_flag);
982 END IF;
983
984 IF NVL(l_acct_reversal_source, ''N'') IN (''N'',''B'') THEN
985 $call_alts$
986 -- only execute it if calculate g/l flag is yes, and primary or secondary ledger
987 -- or secondary ledger that has different currency with primary
988 -- or alc that is calculated by sla
989 IF (((l_calculate_g_l_flag = ''Y'' AND XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_category_code <> ''ALC'') or
990 (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_category_code in (''ALC'', ''SECONDARY'') AND XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.calculate_amts_flag=''Y''))
991
992 -- IF((l_calculate_g_l_flag=''Y'' or XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id <>
993 -- XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id)
994 AND (l_actual_flag = ''A'')) THEN
995 XLA_AE_LINES_PKG.CreateGainOrLossLines(
996 p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
997 ,p_application_id => p_application_id
998 ,p_amb_context_code => ''$amb_context_code$''
999 ,p_entity_code => xla_ae_journal_entry_pkg.g_cache_event.entity_code
1000 ,p_event_class_code => C_EVENT_CLASS_CODE
1001 ,p_event_type_code => C_EVENT_TYPE_CODE
1002 $gain_loss_account_params$
1003 ,p_actual_flag => l_actual_flag
1004 ,p_enc_flag => null
1005 ,p_actual_g_l_ref => l_actual_gain_loss_ref
1006 ,p_enc_g_l_ref => null
1007 );
1008 END IF;
1009 END IF;
1010 END IF;
1011
1012 ELSE
1013 --
1014 -- Bug 4872078 - Do nothing if the event is meant for transaction reversal
1015 --
1016 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1017 trace
1018 (p_msg => ''Trancaction revesal option is Y''
1019 ,p_level => C_LEVEL_STATEMENT
1020 ,p_module => l_log_module);
1021 END IF;
1022 END IF;
1023
1024 END LOOP;
1025 l_result := XLA_AE_LINES_PKG.InsertLines ;
1026 end loop;
1027 close line_cur;
1028 ';
1029
1030
1031 --+=============================================================================+
1032 --| |
1033 --| 4262811 |
1034 --| Template for the accrual reversal code in the EventType/EventClass_xxx API. |
1035 --| |
1036 --+=============================================================================+
1037 --
1038 C_ACC_REV_BODY CONSTANT VARCHAR2(10000) := '
1039 --
1040 -- Generate the accrual reversal headers
1041 --
1042 IF NVL(l_trx_reversal_source, ''N'') = ''N'' THEN
1043
1044 $if_cond$
1045
1046 -- indicate that the accrual entry has a reversal entry
1047 XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag(hdr_idx) := ''Y'';
1048
1049 --
1050 -- initialize a row for ae header
1051 --
1052 g_last_hdr_idx := g_last_hdr_idx + 1;
1053 XLA_AE_HEADER_PKG.CopyHeaderInfo (p_parent_hdr_idx => hdr_idx,
1054 p_hdr_idx => g_last_hdr_idx) ;
1055 XLA_AE_HEADER_PKG.g_rec_header_new.array_header_num (g_last_hdr_idx) := 1;
1056 XLA_AE_HEADER_PKG.g_rec_header_new.array_parent_header_id(g_last_hdr_idx) :=
1057 XLA_AE_HEADER_PKG.g_rec_header_new.array_event_id(hdr_idx);
1058
1059 --
1060 -- record the index for the reversal entry, it will be used by the journal
1061 -- line creation
1062 --
1063 g_array_event(l_event_id).array_value_num(''acc_rev_header_index'') := g_last_hdr_idx;
1064
1065 --
1066 -- Populate the GL Date and override the GL date defined in the
1067 -- SetHdrAcctAttrs if necessary
1068 --
1069 $accrual_reversal_body2$
1070
1071 --
1072 -- Update the header status
1073 --
1074 XLA_AE_JOURNAL_ENTRY_PKG.updateJournalEntryStatus (p_hdr_idx => g_last_hdr_idx);
1075
1076 $end_if$
1077
1078 END IF;
1079
1080 ';
1081
1082
1083
1084
1085 --+=============================================================================+
1086 --| |
1087 --| 4262811 |
1088 --| Template to populate accrual reversal GL date accounting attribut in the |
1089 --| EventType/EventClass_xxx API. |
1090 --| |
1091 --+=============================================================================+
1092 --
1093 C_HDR_ACCT_BODY CONSTANT VARCHAR2(10000) := '
1094 ------------------------------------------------------------
1095 -- Accrual Reversal : to get date for Standard Source (NONE)
1096 ------------------------------------------------------------
1097 l_acc_rev_gl_date_source := $acc_rev_gl_date_source$;
1098
1099 ';
1100
1101 --
1102 ------------------------------------------------------------------------------
1103 --
1104 --
1105 --
1106 --
1107 --
1108 -- Transaction Objects Diagnostics Constants/Templates
1109 --
1110 --
1111 --
1112 --
1113 --
1114 ------------------------------------------------------------------------------
1115 --
1116 --
1117 --
1118 C_INSERT_SOURCES_PROC CONSTANT CLOB:= '
1119 ---------------------------------------
1120 --
1121 -- PRIVATE PROCEDURE
1122 -- insert_sources_$EVENT_INDEX$
1123 --
1124 ----------------------------------------
1125 --
1126 PROCEDURE insert_sources_$EVENT_INDEX$(
1127 p_target_ledger_id IN NUMBER
1128 , p_language IN VARCHAR2
1129 , p_sla_ledger_id IN NUMBER
1130 , p_pad_start_date IN DATE
1131 , p_pad_end_date IN DATE
1132 )
1133 IS
1134
1135 C_EVENT_TYPE_CODE CONSTANT VARCHAR2(30) := ''$event_type_code$'';
1136 C_EVENT_CLASS_CODE CONSTANT VARCHAR2(30) := ''$event_class_code$'';
1137 p_apps_owner VARCHAR2(30);
1138 l_log_module VARCHAR2(240);
1139 BEGIN
1140 IF g_log_enabled THEN
1141 l_log_module := C_DEFAULT_MODULE||''.insert_sources_$EVENT_INDEX$'';
1142 END IF;
1143 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1144
1145 trace
1146 (p_msg => ''BEGIN of insert_sources_$EVENT_INDEX$''
1147 ,p_level => C_LEVEL_PROCEDURE
1148 ,p_module => l_log_module);
1149
1150 END IF;
1151
1152 -- select APPS owner
1153 SELECT oracle_username
1154 INTO p_apps_owner
1155 FROM fnd_oracle_userid
1156 WHERE read_only_flag = ''U''
1157 ;
1158
1159 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1160 trace
1161 (p_msg => ''p_target_ledger_id = ''||p_target_ledger_id||
1162 '' - p_language = ''||p_language||
1163 '' - p_sla_ledger_id = ''||p_sla_ledger_id ||
1164 '' - p_pad_start_date = ''||TO_CHAR(p_pad_start_date)||
1165 '' - p_pad_end_date = ''||TO_CHAR(p_pad_end_date)||
1166 '' - p_apps_owner = ''||TO_CHAR(p_apps_owner)
1167 ,p_level => C_LEVEL_STATEMENT
1168 ,p_module => l_log_module);
1169 END IF;
1170
1171 $insert_header_sources$
1172
1173 $insert_line_sources$
1174
1175 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1176 trace
1177 (p_msg => ''END of insert_sources_$EVENT_INDEX$''
1178 ,p_level => C_LEVEL_PROCEDURE
1179 ,p_module => l_log_module);
1180 END IF;
1181 EXCEPTION
1182 WHEN xla_exceptions_pkg.application_exception THEN
1183 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1184 trace
1185 (p_msg => ''ERROR: XLA_CMP_COMPILER_ERROR = ''||sqlerrm
1186 ,p_level => C_LEVEL_EXCEPTION
1187 ,p_module => l_log_module);
1188 END IF;
1189 RAISE;
1190 WHEN OTHERS THEN
1191 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1192 trace
1193 (p_msg => ''ERROR: XLA_CMP_COMPILER_ERROR = ''||sqlerrm
1194 ,p_level => C_LEVEL_EXCEPTION
1195 ,p_module => l_log_module);
1196 END IF;
1197 xla_exceptions_pkg.raise_message
1198 (p_location => ''$package_name$.insert_sources_$EVENT_INDEX$'');
1199 END insert_sources_$EVENT_INDEX$;
1200 --
1201 ';
1202 --
1203 --
1204 --+==========================================================================+
1205 --| |
1206 --| Private global constant or variable declarations |
1207 --| |
1208 --+==========================================================================+
1209 --
1210 g_package_name VARCHAR2(30);
1211 g_product_rule_code VARCHAR2(30);
1212 g_product_rule_type_code VARCHAR2(1);
1213 g_product_rule_version VARCHAR2(30);
1214 g_product_rule_name VARCHAR2(80);
1215
1216 g_chr_newline CONSTANT VARCHAR2(10):= xla_environment_pkg.g_chr_newline;
1217 --=============================================================================
1218 --
1219 --
1220 --
1221 --
1222 --
1223 --
1224 --
1225 --
1226 --
1227 -- FND_LOG trace
1228 --
1229 --
1230 --
1231 --
1232 --
1233 --
1234 --
1235 --
1236 --
1237 --
1238 --
1239 --=============================================================================
1240
1241 --
1242 --=============================================================================
1243 -- *********** Local Trace Routine **********
1244 --=============================================================================
1245
1246 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
1247 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
1248 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
1249 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
1250 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
1251 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
1252
1253 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
1254 C_DEFAULT_MODULE CONSTANT VARCHAR2(240) := 'xla.plsql.XLA_CMP_EVENT_TYPE_PKG';
1255
1256 g_log_level NUMBER;
1257 g_log_enabled BOOLEAN;
1258
1259 PROCEDURE trace
1260 (p_msg IN VARCHAR2
1261 ,p_level IN NUMBER
1262 ,p_module IN VARCHAR2)
1263 IS
1264 BEGIN
1265 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
1266 fnd_log.message(p_level, p_module);
1267 ELSIF p_level >= g_log_level THEN
1268 fnd_log.string(p_level, p_module, p_msg);
1269 END IF;
1270
1271 EXCEPTION
1272 WHEN xla_exceptions_pkg.application_exception THEN
1273 RAISE;
1274 WHEN OTHERS THEN
1275 xla_exceptions_pkg.raise_message
1276 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.trace');
1277 END trace;
1278
1279 --+==========================================================================+
1280 --| |
1281 --| |
1282 --| |
1283 --| |
1284 --| |
1285 --| |
1286 --| |
1287 --| |
1288 --| |
1289 --| |
1290 --| |
1291 --| |
1292 --| |
1293 --| |
1294 --| |
1295 --| |
1296 --| |
1297 --| |
1298 --| |
1299 --| |
1300 --+==========================================================================+
1301
1302
1303 /*------------------------------------------------------------+
1304 | |
1305 | Private procedure |
1306 | |
1307 | GetEventClassEventType |
1308 | |
1309 | Retrieves the event classes and event types defined in AAD |
1310 | |
1311 +------------------------------------------------------------*/
1312
1313 PROCEDURE GetEventClassEventType(
1314 p_application_id IN NUMBER
1315 , p_amb_context_code IN VARCHAR2
1316 , p_product_rule_code IN VARCHAR2
1317 , p_product_rule_type_code IN VARCHAR2
1318 , p_array_entity OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
1319 , p_array_event_class OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
1320 , p_array_event_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
1321 , p_array_event_class_acctd_flag OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
1322 , p_array_event_class_g_l_flag OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
1323 )
1324 IS
1325 --
1326 -- get event_type belong entered product rule
1327 --
1328 CURSOR event_type_cur
1329 IS
1330 SELECT DISTINCT
1331 xpah.event_type_code
1332 , xpah.event_class_code
1333 , xpah.entity_code
1334 , xeca.calculate_acctd_amts_flag
1335 , xeca.calculate_g_l_amts_flag
1336 FROM xla_prod_acct_headers xpah
1337 , xla_event_types_b xetb
1338 , xla_event_class_attrs xeca
1339 WHERE xpah.product_rule_code = p_product_rule_code
1340 AND xpah.product_rule_type_code = p_product_rule_type_code
1341 AND xpah.application_id = p_application_id
1342 AND xpah.amb_context_code = p_amb_context_code
1343 AND xpah.application_id = xetb.application_id
1344 AND xpah.entity_code = xetb.entity_code
1345 AND xpah.event_class_code = xetb.event_class_code
1346 AND (xetb.event_type_code = xpah.event_type_code
1347 OR
1348 xetb.event_type_code = xpah.event_class_code||'_ALL'
1349 )
1350 AND xetb.accounting_flag = xpah.accounting_required_flag
1351 AND xpah.accounting_required_flag = 'Y'
1352 AND xpah.validation_status_code = 'R' -- Running
1353 AND xetb.enabled_flag = 'Y'
1354 AND xeca.application_id = xetb.application_id
1355 AND xeca.event_class_code = xetb.event_class_code
1356 AND xeca.entity_code = xetb.entity_code
1357 ORDER BY xpah.event_type_code
1358 ;
1359 --
1360 CURSOR event_type_bc_cur
1361 IS
1362 SELECT DISTINCT
1363 xpah.event_type_code
1364 , xpah.event_class_code
1365 , xpah.entity_code
1366 , xeca.calculate_acctd_amts_flag
1367 , xeca.calculate_g_l_amts_flag
1368 FROM xla_prod_acct_headers xpah
1369 , xla_event_types_b xetb
1370 , xla_event_class_attrs xeca
1371 , xla_aad_line_defn_assgns xald
1372 , xla_line_definitions_b xld
1373 WHERE xpah.product_rule_code = p_product_rule_code
1374 AND xpah.product_rule_type_code = p_product_rule_type_code
1375 AND xpah.application_id = p_application_id
1376 AND xpah.amb_context_code = p_amb_context_code
1377 AND xpah.application_id = xetb.application_id
1378 AND xpah.entity_code = xetb.entity_code
1379 AND xpah.event_class_code = xetb.event_class_code
1380 AND (xetb.event_type_code = xpah.event_type_code
1381 OR
1382 xetb.event_type_code = xpah.event_class_code||'_ALL'
1383 )
1384 AND xetb.accounting_flag = xpah.accounting_required_flag
1385 AND xpah.accounting_required_flag = 'Y'
1386 AND xpah.validation_status_code = 'R' -- Running
1387 AND xetb.enabled_flag = 'Y'
1388 AND xeca.application_id = xetb.application_id
1389 AND xeca.event_class_code = xetb.event_class_code
1390 AND xeca.entity_code = xetb.entity_code
1391 AND xald.application_id = xpah.application_id
1392 AND xald.amb_context_code = xpah.amb_context_code
1393 AND xald.event_class_code = xpah.event_class_code
1394 AND xald.event_type_code = xpah.event_type_code
1395 AND xald.product_rule_type_code = xpah.product_rule_type_code
1396 AND xald.product_rule_code = xpah.product_rule_code
1397 AND xald.application_id = xld.application_id
1398 AND xald.amb_context_code = xld.amb_context_code
1399 AND xald.event_class_code = xld.event_class_code
1400 AND xald.event_type_code = xld.event_type_code
1401 AND xald.line_definition_owner_code = xld.line_definition_owner_code
1402 AND xald.line_definition_code = xld.line_definition_code
1403 AND xld.budgetary_control_flag = 'Y'
1404 ORDER BY xpah.event_type_code;
1405 --
1406 l_array_event_type xla_cmp_source_pkg.t_array_VL30;
1407 l_array_event_class xla_cmp_source_pkg.t_array_VL30;
1408 l_array_entity xla_cmp_source_pkg.t_array_VL30;
1409 l_array_event_class_acctd_flag xla_cmp_source_pkg.t_array_VL1;
1410 l_array_event_class_g_l_flag xla_cmp_source_pkg.t_array_VL1;
1411 l_log_module VARCHAR2(240);
1412 --
1413 BEGIN
1414
1415 IF g_log_enabled THEN
1416 l_log_module := C_DEFAULT_MODULE||'.GetEventClassEventType';
1417 END IF;
1418 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1419 trace
1420 (p_msg => 'BEGIN of GetEventClassEventType'
1421 ,p_level => C_LEVEL_PROCEDURE
1422 ,p_module => l_log_module);
1423 END IF;
1424
1425 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1426
1427 trace
1428 (p_msg => 'SQL - Select from xla_prod_acct_headers '
1429 ,p_level => C_LEVEL_STATEMENT
1430 ,p_module => l_log_module);
1431
1432 END IF;
1433 --
1434 IF (XLA_CMP_PAD_PKG.g_bc_pkg_flag = 'N') THEN
1435 OPEN event_type_cur;
1436 FETCH event_type_cur BULK COLLECT INTO l_array_event_type
1437 , l_array_event_class
1438 , l_array_entity
1439 , l_array_event_class_acctd_flag
1440 , l_array_event_class_g_l_flag
1441 ;
1442 CLOSE event_type_cur;
1443 ELSE
1444 OPEN event_type_bc_cur;
1445 FETCH event_type_bc_cur BULK COLLECT INTO l_array_event_type
1446 , l_array_event_class
1447 , l_array_entity
1448 , l_array_event_class_acctd_flag
1449 , l_array_event_class_g_l_flag
1450 ;
1451 CLOSE event_type_bc_cur;
1452 END IF;
1453 --
1454 p_array_event_type := l_array_event_type;
1455 p_array_event_class := l_array_event_class;
1456 p_array_entity := l_array_entity;
1457 p_array_event_class_acctd_flag := l_array_event_class_acctd_flag;
1458 p_array_event_class_g_l_flag := l_array_event_class_g_l_flag;
1459 --
1460 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1461
1462 trace
1463 (p_msg => 'END of GetEventClassEventType'
1464 ,p_level => C_LEVEL_PROCEDURE
1465 ,p_module => l_log_module);
1466
1467 END IF;
1468 --
1469 EXCEPTION
1470 WHEN xla_exceptions_pkg.application_exception THEN
1471 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1472 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1473 trace
1474 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
1475 ,p_level => C_LEVEL_EXCEPTION
1476 ,p_module => l_log_module);
1477 END IF;
1478 RAISE;
1479 WHEN OTHERS THEN
1480 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1481 xla_exceptions_pkg.raise_message
1482 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventClassEventType');
1483 END GetEventClassEventType;
1484
1485 /*------------------------------------------------------------+
1486 | |
1487 | Private procedure |
1488 | |
1489 | GetNoAccountEventTypes |
1490 | |
1491 | Retrieves the non accounting event types defined in AAD |
1492 | |
1493 +------------------------------------------------------------*/
1494
1495 PROCEDURE GetNoAccountEventTypes(
1496 p_application_id IN NUMBER
1497 , p_amb_context_code IN VARCHAR2
1498 , p_product_rule_code IN VARCHAR2
1499 , p_product_rule_type_code IN VARCHAR2
1500 , p_array_event_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
1501 )
1502 IS
1503 --
1504 -- get event_type belong entered product rule
1505 --
1506 CURSOR event_type_cur
1507 IS
1508 SELECT DISTINCT
1509 xetb.event_type_code
1510 FROM xla_prod_acct_headers xpah
1511 , xla_event_types_b xetb
1512 WHERE xpah.product_rule_code = p_product_rule_code
1513 AND xpah.product_rule_type_code = p_product_rule_type_code
1514 AND xpah.application_id = p_application_id
1515 AND xpah.amb_context_code = p_amb_context_code
1516 AND xpah.application_id = xetb.application_id
1517 AND xpah.entity_code = xetb.entity_code
1518 AND xpah.event_class_code = xetb.event_class_code
1519 AND xetb.event_type_code = DECODE( xpah.event_type_code
1520 , xpah.event_class_code ||'_ALL',xetb.event_type_code
1521 , xpah.event_type_code
1522 )
1523 AND xetb.event_type_code <> xetb.event_class_code || '_ALL'
1524 AND xetb.accounting_flag = 'Y'
1525 AND xetb.enabled_flag = 'Y'
1526 AND (xpah.accounting_required_flag = 'N'
1527 OR
1528 xpah.validation_status_code <> 'R') -- not Running
1529 ;
1530 --
1531 l_array_event_type xla_cmp_source_pkg.t_array_VL30;
1532 l_log_module VARCHAR2(240);
1533 --
1534 BEGIN
1535 IF g_log_enabled THEN
1536 l_log_module := C_DEFAULT_MODULE||'.GetNoAccountEventTypes';
1537 END IF;
1538 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1539 trace
1540 (p_msg => 'BEGIN of GetNoAccountEventTypes'
1541 ,p_level => C_LEVEL_PROCEDURE
1542 ,p_module => l_log_module);
1543 END IF;
1544 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1545 trace
1546 (p_msg => 'SQL - SELECT from xla_prod_acct_headers'
1547 ,p_level => C_LEVEL_STATEMENT
1548 ,p_module => l_log_module);
1549 END IF;
1550
1551 OPEN event_type_cur;
1552
1553 FETCH event_type_cur BULK COLLECT INTO l_array_event_type
1554 ;
1555 CLOSE event_type_cur;
1556
1557 p_array_event_type := l_array_event_type;
1558
1559 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1560 trace
1561 (p_msg => 'END of GetNoAccountEventTypes ='||p_array_event_type.COUNT
1562 ,p_level => C_LEVEL_PROCEDURE
1563 ,p_module => l_log_module);
1564 END IF;
1565 EXCEPTION
1566 WHEN xla_exceptions_pkg.application_exception THEN
1567 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1568 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1569 trace
1570 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
1571 ,p_level => C_LEVEL_EXCEPTION
1572 ,p_module => l_log_module);
1573 END IF;
1574 RAISE;
1575 WHEN OTHERS THEN
1576 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1577 xla_exceptions_pkg.raise_message
1578 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetNoAccountEventTypes');
1579 END GetNoAccountEventTypes;
1580
1581 /*------------------------------------------------------------+
1582 | |
1583 | Private procedure |
1584 | |
1585 | GetEventType |
1586 | |
1587 | Retrieves the event types belong entered event class |
1588 | |
1589 +------------------------------------------------------------*/
1590
1591 PROCEDURE GetEventType(
1592 p_application_id IN NUMBER
1593 , p_entity_code IN VARCHAR2
1594 , p_event_class_code IN VARCHAR2
1595 , p_array_event_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
1596 )
1597 IS
1598 l_array_event_type xla_cmp_source_pkg.t_array_VL30;
1599
1600 CURSOR event_type_cur
1601 IS
1602 SELECT DISTINCT
1603 xetb.event_type_code
1604 FROM xla_event_types_b xetb
1605 WHERE xetb.entity_code = p_entity_code
1606 AND xetb.event_class_code = p_event_class_code
1607 AND xetb.application_id = p_application_id
1608 AND xetb.accounting_flag = 'Y'
1609 AND xetb.enabled_flag = 'Y'
1610 AND xetb.event_type_code <> xetb.event_class_code || '_ALL'
1611 ORDER BY xetb.event_type_code
1612 ;
1613 l_log_module VARCHAR2(240);
1614 BEGIN
1615 IF g_log_enabled THEN
1616 l_log_module := C_DEFAULT_MODULE||'.GetEventType';
1617 END IF;
1618 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1619 trace
1620 (p_msg => 'BEGIN of GetEventType'
1621 ,p_level => C_LEVEL_PROCEDURE
1622 ,p_module => l_log_module);
1623 END IF;
1624 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1625 trace
1626 (p_msg => 'SQL - SELECT from xla_event_types_b'
1627 ,p_level => C_LEVEL_STATEMENT
1628 ,p_module => l_log_module);
1629 END IF;
1630
1631 OPEN event_type_cur;
1632
1633 FETCH event_type_cur BULK COLLECT INTO l_array_event_type;
1634
1635 CLOSE event_type_cur;
1636
1637 p_array_event_type := l_array_event_type;
1638
1639
1640 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1641 trace
1642 (p_msg => 'END of GetEventType = '||p_array_event_type.COUNT
1643 ,p_level => C_LEVEL_PROCEDURE
1644 ,p_module => l_log_module);
1645
1646 END IF;
1647 EXCEPTION
1648 WHEN xla_exceptions_pkg.application_exception THEN
1649 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1650 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1651 trace
1652 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
1653 ,p_level => C_LEVEL_EXCEPTION
1654 ,p_module => l_log_module);
1655 END IF;
1656 RAISE;
1657 WHEN OTHERS THEN
1658 IF event_type_cur%ISOPEN THEN CLOSE event_type_cur; END IF;
1659 xla_exceptions_pkg.raise_message
1660 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventType');
1661 END GetEventType;
1662
1663 /*------------------------------------------------------------+
1664 | |
1665 | Private function |
1666 | |
1667 | GetEventTypeName |
1668 | |
1669 | Retrieves the event type name |
1670 | |
1671 +------------------------------------------------------------*/
1672
1673 FUNCTION GetEventTypeName(
1674 p_application_id IN NUMBER
1675 , p_entity_code IN VARCHAR2
1676 , p_event_class_code IN VARCHAR2
1677 , p_event_type_code IN VARCHAR2
1678 )
1679 RETURN VARCHAR2
1680 IS
1681 l_name VARCHAR2(160);
1682 l_log_module VARCHAR2(240);
1683 BEGIN
1684 IF g_log_enabled THEN
1685 l_log_module := C_DEFAULT_MODULE||'.GetEventTypeName';
1686 END IF;
1687 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1688 trace
1689 (p_msg => 'BEGIN of GetEventTypeName'
1690 ,p_level => C_LEVEL_PROCEDURE
1691 ,p_module => l_log_module);
1692
1693 END IF;
1694
1695 BEGIN
1696 SELECT REPLACE(xect.name , '''','''''')
1697 INTO l_name
1698 FROM xla_event_types_tl xect
1699 WHERE xect.application_id = p_application_id
1700 AND xect.entity_code = p_entity_code
1701 AND xect.event_class_code = p_event_class_code
1702 AND xect.event_type_code = p_event_type_code
1703 AND xect.language = USERENV('LANG')
1704 ;
1705 EXCEPTION
1706 WHEN NO_DATA_FOUND OR TOO_MANY_ROWS THEN
1707 l_name := NULL;
1708 END;
1709
1710 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1711 trace
1712 (p_msg => 'END of GetEventTypeName'
1713 ,p_level => C_LEVEL_PROCEDURE
1714 ,p_module => l_log_module);
1715 END IF;
1716 RETURN l_name;
1717 EXCEPTION
1718 WHEN xla_exceptions_pkg.application_exception THEN
1719 RETURN NULL;
1720 WHEN OTHERS THEN
1721 xla_exceptions_pkg.raise_message
1722 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventTypeName ');
1723 END GetEventTypeName;
1724
1725 /*------------------------------------------------------------+
1726 | |
1727 | Private function |
1728 | |
1729 | GetEntityName |
1730 | |
1731 | Retrieves the entity name |
1732 | |
1733 +------------------------------------------------------------*/
1734
1735 FUNCTION GetEntityName( p_entity IN VARCHAR2
1736 , p_application_id IN NUMBER
1737 )
1738 RETURN VARCHAR2
1739 IS
1740 l_name VARCHAR2(160);
1741 l_log_module VARCHAR2(240);
1742 BEGIN
1743 IF g_log_enabled THEN
1744 l_log_module := C_DEFAULT_MODULE||'.GetEntityName';
1745 END IF;
1746 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1747 trace
1748 (p_msg => 'BEGIN of GetEntityName'
1749 ,p_level => C_LEVEL_PROCEDURE
1750 ,p_module => l_log_module);
1751 END IF;
1752
1753 BEGIN
1754 SELECT REPLACE(xett.name , '''','''''')
1755 INTO l_name
1756 FROM xla_entity_types_tl xett
1757 WHERE xett.application_id = p_application_id
1758 AND xett.entity_code = p_entity
1759 AND xett.LANGUAGE = USERENV('LANG')
1760 ;
1761 EXCEPTION
1762 WHEN NO_DATA_FOUND OR TOO_MANY_ROWS THEN
1763 l_name := NULL;
1764 END;
1765
1766 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1767 trace
1768 (p_msg => 'END of GetEntityName'
1769 ,p_level => C_LEVEL_PROCEDURE
1770 ,p_module => l_log_module);
1771 END IF;
1772 RETURN l_name;
1773 EXCEPTION
1774 WHEN xla_exceptions_pkg.application_exception THEN
1775 RETURN NULL;
1776 WHEN OTHERS THEN
1777 xla_exceptions_pkg.raise_message
1778 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEntityName ');
1779 END GetEntityName;
1780
1781 /*------------------------------------------------------------+
1782 | |
1783 | Private function |
1784 | |
1785 | GetEventClassName |
1786 | |
1787 | Retrieves the event class name |
1788 | |
1789 +------------------------------------------------------------*/
1790
1791 FUNCTION GetEventClassName(
1792 p_application_id IN NUMBER
1793 , p_entity_code IN VARCHAR2
1794 , p_event_class_code IN VARCHAR2
1795 )
1796 RETURN VARCHAR2
1797 IS
1798 l_name VARCHAR2(160);
1799 l_log_module VARCHAR2(240);
1800 BEGIN
1801 IF g_log_enabled THEN
1802 l_log_module := C_DEFAULT_MODULE||'.GetEventClassName';
1803 END IF;
1804 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1805 trace
1806 (p_msg => 'BEGIN of GetEventClassName'
1807 ,p_level => C_LEVEL_PROCEDURE
1808 ,p_module => l_log_module);
1809 END IF;
1810
1811 BEGIN
1812 SELECT REPLACE(xect.name , '''','''''')
1813 INTO l_name
1814 FROM xla_event_classes_tl xect
1815 WHERE xect.application_id = p_application_id
1816 AND xect.entity_code = p_entity_code
1817 AND xect.event_class_code = p_event_class_code
1818 AND xect.language = USERENV('LANG')
1819 ;
1820 EXCEPTION
1821 WHEN NO_DATA_FOUND OR TOO_MANY_ROWS THEN
1822 l_name := NULL;
1823 END;
1824
1825 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1826 trace
1827 (p_msg => 'END of GetEventClassName'
1828 ,p_level => C_LEVEL_PROCEDURE
1829 ,p_module => l_log_module);
1830
1831 END IF;
1832 RETURN l_name;
1833 EXCEPTION
1834 WHEN xla_exceptions_pkg.application_exception THEN
1835 RETURN NULL;
1836 WHEN OTHERS THEN
1837 xla_exceptions_pkg.raise_message
1838 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventClassName ');
1839 END GetEventClassName;
1840 --
1841 --+==========================================================================+
1842 --| |
1843 --| COLLECT THE NEEDED SOURCES |
1844 --| |
1845 --| |
1846 --| |
1847 --| |
1848 --| |
1849 --| |
1850 --| |
1851 --| |
1852 --+==========================================================================+
1853 --
1854 --
1855 --+==========================================================================+
1856 --| |
1857 --| PRIVATE procedure |
1858 --| |
1859 --| Add third_party_chage_option and accounting_reversal_option to the list |
1860 --| of sources to extract from the Product tables/views |
1861 --| |
1862 --+==========================================================================+
1863 --
1864 --
1865 --+==========================================================================+
1866 --| |
1867 --| PRIVATE function |
1868 --| |
1869 --| Check if Option Flag party_change_option |
1870 --| or accounting_reversal_option is defined in |
1871 --| Transaction Objects |
1872 --| |
1873 --+==========================================================================+
1874 --
1875 FUNCTION IsOptionFlagInEventExtract (
1876 p_source_option IN VARCHAR2
1877 , p_array_source_code IN xla_cmp_source_pkg.t_array_VL30
1878 )
1879 RETURN NUMBER
1880 IS
1881
1882 l_IsSourceExists NUMBER;
1883 l_array_source_code xla_cmp_source_pkg.t_array_VL30;
1884 l_log_module VARCHAR2(240);
1885
1886 BEGIN
1887 IF g_log_enabled THEN
1888 l_log_module := C_DEFAULT_MODULE||'.IsOptionFlagInEventExtract';
1889 END IF;
1890 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1891 trace
1892 (p_msg => 'BEGIN of IsOptionFlagInEventExtract'
1893 ,p_level => C_LEVEL_PROCEDURE
1894 ,p_module => l_log_module);
1895 END IF;
1896
1897 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1898 trace
1899 (p_msg => 'p_source_option = '||p_source_option
1900 ,p_level => C_LEVEL_STATEMENT
1901 ,p_module => l_log_module);
1902 trace
1903 (p_msg => '# of sources = '||p_array_source_code.COUNT
1904 ,p_level => C_LEVEL_STATEMENT
1905 ,p_module => l_log_module);
1906 END IF;
1907
1908 l_array_source_code := p_array_source_code;
1909 l_IsSourceExists := NULL;
1910
1911 IF l_array_source_code.COUNT > 0 THEN
1912
1913 FOR Idx IN l_array_source_code.FIRST .. l_array_source_code.LAST LOOP
1914
1915 IF l_array_source_code.EXISTS(Idx) AND l_array_source_code(Idx) = p_source_option
1916 THEN
1917 l_IsSourceExists := Idx;
1918 END IF;
1919
1920 END LOOP;
1921
1922 END IF;
1923
1924 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1925 trace
1926 (p_msg => 'return value, Source Index = '||l_IsSourceExists
1927 ,p_level => C_LEVEL_STATEMENT
1928 ,p_module => l_log_module);
1929 END IF;
1930 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1931 trace
1932 (p_msg => 'END of IsOptionFlagInEventExtract'
1933 ,p_level => C_LEVEL_PROCEDURE
1934 ,p_module => l_log_module);
1935 END IF;
1936 RETURN l_IsSourceExists;
1937 EXCEPTION
1938 WHEN xla_exceptions_pkg.application_exception THEN
1939 RETURN NULL;
1940 WHEN OTHERS THEN
1941 xla_exceptions_pkg.raise_message
1942 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.IsOptionFlagInEventExtract');
1943 END IsOptionFlagInEventExtract;
1944 --
1945 --+==========================================================================+
1946 --| |
1947 --| PRIVATE Procedure |
1948 --| |
1949 --| Get Index and level (Header or line) of Option Flags |
1950 --| party_change_option and accounting_reversal_option |
1951 --| |
1952 --+==========================================================================+
1953 --
1954 PROCEDURE GetIndexOfOptionFlags (
1955 p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
1956 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
1957 , p_array_line_acctg_source IN xla_cmp_source_pkg.t_array_VL30
1958 , p_array_line_acct_attr_source IN xla_cmp_source_pkg.t_array_int
1959 , p_ThirdPartyIdx OUT NOCOPY NUMBER
1960 , p_AcctReversalIdx OUT NOCOPY NUMBER
1961 , p_TrxReversalIdx OUT NOCOPY NUMBER
1962 )
1963 IS
1964 --
1965 l_log_module VARCHAR2(240);
1966 BEGIN
1967 --
1968 IF g_log_enabled THEN
1969 l_log_module := C_DEFAULT_MODULE||'.GetIndexOfOptionFlags';
1970 END IF;
1971 --
1972 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1973 trace
1974 (p_msg => 'BEGIN of GetIndexOfOptionFlags'
1975 ,p_level => C_LEVEL_PROCEDURE
1976 ,p_module => l_log_module);
1977 END IF;
1978 --
1979 p_ThirdPartyIdx := NULL;
1980 p_AcctReversalIdx := NULL;
1981 p_TrxReversalIdx := NULL;
1982 --
1983 p_ThirdPartyIdx := IsOptionFlagInEventExtract(
1984 p_source_option =>'PARTY_CHANGE_OPTION'
1985 , p_array_source_code => p_array_hdr_acctg_source
1986 );
1987 --
1988 --
1989 p_AcctReversalIdx := IsOptionFlagInEventExtract(
1990 p_source_option =>'ACCOUNTING_REVERSAL_OPTION'
1991 , p_array_source_code => p_array_line_acctg_source
1992 );
1993 --
1994 --
1995 p_TrxReversalIdx := IsOptionFlagInEventExtract(
1996 p_source_option =>'TRX_ACCT_REVERSAL_OPTION'
1997 , p_array_source_code => p_array_hdr_acctg_source
1998 );
1999 --
2000 --
2001 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2002 trace
2003 (p_msg => 'END of GetIndexOfOptionFlags'
2004 ,p_level => C_LEVEL_PROCEDURE
2005 ,p_module => l_log_module);
2006 END IF;
2007 --
2008 EXCEPTION
2009 WHEN xla_exceptions_pkg.application_exception THEN
2010 p_ThirdPartyIdx := NULL;
2011 p_AcctReversalIdx := NULL;
2012 p_TrxReversalIdx := NULL;
2013 WHEN OTHERS THEN
2014 xla_exceptions_pkg.raise_message
2015 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetIndexOfOptionFlags');
2016 END GetIndexOfOptionFlags;
2017
2018 /*--------------------------------------------------------------------+
2019 | |
2020 | Private procedure |
2021 | |
2022 | GetHeaderAcctgSources |
2023 | |
2024 | Get sources assigned to header accounting attributes. |
2025 | |
2026 +--------------------------------------------------------------------*/
2027
2028 PROCEDURE GetHeaderAcctgSources (
2029 p_entity IN VARCHAR2
2030 , p_event_class IN VARCHAR2
2031 , p_event_type IN VARCHAR2
2032 , p_application_id IN NUMBER
2033 , p_amb_context_code IN VARCHAR2
2034 , p_product_rule_type_code IN VARCHAR2
2035 , p_product_rule_code IN VARCHAR2
2036 --
2037 , p_array_evt_source_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2038 , p_array_hdr_acctg_source OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
2039 , p_array_hdr_acctg_source_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
2040 , p_array_hdr_acct_attr_source OUT NOCOPY xla_cmp_source_pkg.t_array_int
2041 --
2042 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
2043 )
2044 IS
2045 --
2046 --
2047 CURSOR source_cur
2048 IS
2049 SELECT eca.accounting_attribute_code
2050 , eca.source_application_id
2051 , eca.source_type_code
2052 , eca.source_code
2053 , DECODE(nvl(xes.level_code, 'H'),'H','H','L')
2054 FROM xla_evt_class_acct_attrs eca
2055 , xla_event_sources xes
2056 , xla_acct_attributes_b xasb
2057 , xla_sources_b xsb
2058 WHERE eca.application_id = p_application_id
2059 AND eca.event_class_code = p_event_class
2060 AND xasb.accounting_attribute_code = eca.accounting_attribute_code
2061 AND xasb.assignment_level_code = 'EVT_CLASS_ONLY'
2062 AND xes.application_id(+) = p_application_id
2063 AND xes.entity_code(+) = p_entity
2064 AND xes.event_class_code(+) = p_event_class
2065 AND xes.source_application_id(+) = eca.source_application_id
2066 AND xes.source_type_code(+) = eca.source_type_code
2067 AND xes.source_code(+) = eca.source_code
2068 AND xasb.journal_entry_level_code = 'H'
2069 AND xes.active_flag(+) = 'Y'
2070 AND xsb.application_id = eca.source_application_id
2071 AND xsb.source_type_code = eca.source_type_code
2072 AND xsb.source_code = eca.source_code
2073 UNION
2074 SELECT aha.accounting_attribute_code
2075 , aha.source_application_id
2076 , aha.source_type_code
2077 , aha.source_code
2078 , DECODE(xes.level_code,'H','H','L')
2079 FROM xla_aad_hdr_acct_attrs aha
2080 , xla_event_sources xes
2081 , xla_acct_attributes_b xasb
2082 , xla_sources_b xsb
2083 WHERE aha.application_id = p_application_id
2084 AND aha.amb_context_code = p_amb_context_code
2085 AND aha.product_rule_type_code = p_product_rule_type_code
2086 AND aha.product_rule_code = p_product_rule_code
2087 AND aha.event_class_code = p_event_class
2088 AND aha.event_type_code = p_event_type
2089 AND xasb.accounting_attribute_code = aha.accounting_attribute_code
2090 AND xasb.assignment_level_code IN ('AAD_ONLY','EVT_CLASS_AAD')
2091 AND xes.application_id(+) = p_application_id
2092 AND xes.entity_code(+) = p_entity
2093 AND xes.event_class_code(+) = p_event_class
2094 AND xes.source_application_id(+) = aha.source_application_id
2095 AND xes.source_type_code(+) = aha.source_type_code
2096 AND xes.source_code(+) = aha.source_code
2097 AND xes.active_flag (+) = 'Y'
2098 AND xsb.application_id = aha.source_application_id
2099 AND xsb.source_type_code = aha.source_type_code
2100 AND xsb.source_code = aha.source_code
2101 ;
2102 --
2103 --
2104 l_SourceIdx BINARY_INTEGER;
2105 l_accounting_source xla_cmp_source_pkg.t_array_VL30;
2106 l_accounting_source_type xla_cmp_source_pkg.t_array_VL1;
2107 l_source_application_id xla_cmp_source_pkg.t_array_Num;
2108 l_source_type_code xla_cmp_source_pkg.t_array_VL1;
2109 l_source_code xla_cmp_source_pkg.t_array_VL30;
2110 l_log_module VARCHAR2(240);
2111 --
2112 BEGIN
2113 --
2114 IF g_log_enabled THEN
2115 l_log_module := C_DEFAULT_MODULE||'.GetHeaderAcctgSources';
2116 END IF;
2117 --
2118 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2119
2120 trace
2121 (p_msg => 'BEGIN of GetHeaderAcctgSources'
2122 ,p_level => C_LEVEL_PROCEDURE
2123 ,p_module => l_log_module);
2124
2125 END IF;
2126
2127 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
2128 trace
2129 (p_msg => 'entity:'||p_entity||
2130 ' - class:'||p_event_class||
2131 ' - type:'||p_event_type||
2132 ' - amb_context_code:'||p_amb_context_code||
2133 ' - rule_type_code:'||p_product_rule_type_code||
2134 ' - rule_code:'||p_product_rule_code
2135 ,p_level => C_LEVEL_STATEMENT
2136 ,p_module => l_log_module);
2137 END IF;
2138
2139 OPEN source_cur;
2140
2141 FETCH source_cur BULK COLLECT INTO l_accounting_source
2142 , l_source_application_id
2143 , l_source_type_code
2144 , l_source_code
2145 , l_accounting_source_type
2146 ;
2147
2148 CLOSE source_cur;
2149 --
2150 --
2151 IF l_accounting_source.EXISTS(NVL(l_accounting_source.FIRST,1)) THEN
2152
2153 FOR Idx IN l_accounting_source.FIRST .. l_accounting_source.LAST LOOP
2154
2155 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2156 trace
2157 (p_msg => 'Accouting sources = '||l_accounting_source(Idx)||
2158 ' - Source Code = '||l_source_code(Idx)
2159 ,p_level => C_LEVEL_STATEMENT
2160 ,p_module => l_log_module);
2161 END IF;
2162 IF l_source_code.EXISTS(Idx) AND l_source_code(Idx) IS NOT NULL THEN
2163
2164 l_SourceIdx := xla_cmp_source_pkg.StackSource(
2165 p_source_code => l_source_code(Idx)
2166 , p_source_type_code => l_source_type_code(Idx)
2167 , p_source_application_id => l_source_application_id(Idx)
2168 , p_array_source_index => p_array_evt_source_index
2169 , p_rec_sources => p_rec_sources
2170 );
2171
2172 p_array_hdr_acctg_source(Idx) := l_accounting_source(Idx);
2173 p_array_hdr_acctg_source_type(Idx) := l_accounting_source_type(Idx);
2174 p_array_hdr_acct_attr_source(Idx) := l_SourceIdx;
2175
2176 END IF;
2177 END LOOP;
2178 END IF;
2179
2180 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2181 trace
2182 (p_msg => 'END of GetHeaderAcctgSources ='||l_accounting_source.COUNT
2183 ,p_level => C_LEVEL_PROCEDURE
2184 ,p_module => l_log_module);
2185 END IF;
2186 EXCEPTION
2187 WHEN xla_exceptions_pkg.application_exception THEN
2188 IF source_cur%ISOPEN THEN CLOSE source_cur; END IF;
2189 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2190 trace
2191 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2192 ,p_level => C_LEVEL_EXCEPTION
2193 ,p_module => l_log_module);
2194 END IF;
2195 RAISE;
2196 WHEN OTHERS THEN
2197 IF source_cur%ISOPEN THEN CLOSE source_cur; END IF;
2198 xla_exceptions_pkg.raise_message
2199 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetHeaderAcctgSources ');
2200 END GetHeaderAcctgSources;
2201
2202 /*--------------------------------------------------------------------+
2203 | |
2204 | Private procedure |
2205 | |
2206 | GetLineAcctgSources |
2207 | |
2208 | Get sources assigned to Reversal line accounting attributes. |
2209 | |
2210 +--------------------------------------------------------------------*/
2211
2212 PROCEDURE GetLineAcctgSources (
2213 p_entity IN VARCHAR2
2214 , p_event_class IN VARCHAR2
2215 , p_application_id IN NUMBER
2216 --
2217 , p_array_evt_source_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2218 , p_array_line_acctg_source OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
2219 , p_array_line_acctg_source_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
2220 , p_array_line_acct_attr_source OUT NOCOPY xla_cmp_source_pkg.t_array_int
2221 --
2222 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
2223 )
2224 IS
2225 --
2226 CURSOR source_cur
2227 IS
2228 SELECT eca.accounting_attribute_code
2229 , eca.source_application_id
2230 , eca.source_type_code
2231 , eca.source_code
2232 , DECODE(nvl(xes.level_code, 'H'),'H','H','L')
2233 FROM xla_evt_class_acct_attrs eca
2234 , xla_event_sources xes
2235 , xla_acct_attributes_b xasb
2236 , xla_sources_b xsb
2237 WHERE eca.application_id = p_application_id
2238 AND eca.event_class_code = p_event_class
2239 AND xasb.accounting_attribute_code = eca.accounting_attribute_code
2240 AND xasb.assignment_level_code = 'EVT_CLASS_ONLY'
2241 AND xes.application_id (+) = p_application_id
2242 AND xes.entity_code (+) = p_entity
2243 AND xes.event_class_code(+) = p_event_class
2244 AND xes.source_application_id(+) = eca.source_application_id
2245 AND xes.source_type_code(+) = eca.source_type_code
2246 AND xes.source_code(+) = eca.source_code
2247 AND xasb.journal_entry_level_code in ('L', 'C')
2248 AND xes.active_flag(+) = 'Y'
2249 AND xsb.application_id = eca.source_application_id
2250 AND xsb.source_type_code = eca.source_type_code
2251 AND xsb.source_code = eca.source_code
2252 ;
2253 --
2254 l_SourceIdx BINARY_INTEGER;
2255 l_accounting_source xla_cmp_source_pkg.t_array_VL30;
2256 l_accounting_source_type xla_cmp_source_pkg.t_array_VL1;
2257 l_source_application_id xla_cmp_source_pkg.t_array_Num;
2258 l_source_type_code xla_cmp_source_pkg.t_array_VL1;
2259 l_source_code xla_cmp_source_pkg.t_array_VL30;
2260 l_number NUMBER;
2261 l_log_module VARCHAR2(240);
2262 --
2263 BEGIN
2264 IF g_log_enabled THEN
2265 l_log_module := C_DEFAULT_MODULE||'.GetLineAcctgSources';
2266 END IF;
2267 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2268 trace
2269 (p_msg => 'BEGIN of GetLineAcctgSources'
2270 ,p_level => C_LEVEL_PROCEDURE
2271 ,p_module => l_log_module);
2272 END IF;
2273
2274 l_number := 0;
2275 --
2276 -- check if the accounting reversal option exists
2277 --
2278 SELECT count(xes.accounting_attribute_code)
2279 INTO l_number
2280 FROM xla_evt_class_acct_attrs xes
2281 WHERE xes.application_id = p_application_id
2282 -- AND xes.entity_code = p_entity
2283 AND xes.event_class_code = p_event_class
2284 -- AND xes.active_flag = 'Y'
2285 AND xes.accounting_attribute_code = 'ACCOUNTING_REVERSAL_OPTION'
2286 ;
2287
2288 IF l_number > 0 THEN
2289 --
2290 OPEN source_cur;
2291 --
2292 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2293 trace
2294 (p_msg => 'SQL - SELECT from xla_event_sources and xla_acctg_sources_b'
2295 ,p_level => C_LEVEL_STATEMENT
2296 ,p_module => l_log_module);
2297 END IF;
2298
2299 FETCH source_cur BULK COLLECT INTO l_accounting_source
2300 , l_source_application_id
2301 , l_source_type_code
2302 , l_source_code
2303 , l_accounting_source_type
2304 ;
2305
2306 CLOSE source_cur;
2307
2308 IF l_accounting_source.COUNT > 0 THEN
2309
2310 FOR Idx IN l_accounting_source.FIRST .. l_accounting_source.LAST LOOP
2311
2312 IF l_source_code.EXISTS(Idx) AND l_source_code(Idx) IS NOT NULL THEN
2313
2314 l_SourceIdx := xla_cmp_source_pkg.StackSource (
2315 p_source_code => l_source_code(Idx)
2316 , p_source_type_code => l_source_type_code(Idx)
2317 , p_source_application_id => l_source_application_id(Idx)
2318 , p_array_source_index => p_array_evt_source_index
2319 , p_rec_sources => p_rec_sources
2320 );
2321
2322 p_array_line_acctg_source(Idx) := l_accounting_source(Idx);
2323 p_array_line_acctg_source_type(Idx) := l_accounting_source_type(Idx);
2324 p_array_line_acct_attr_source(Idx) := l_SourceIdx;
2325
2326 END IF;
2327
2328 END LOOP;
2329 END IF;
2330
2331 END IF;
2332
2333 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2334 trace
2335 (p_msg => 'END of GetLineAcctgSources = '||l_accounting_source.COUNT
2336 ,p_level => C_LEVEL_PROCEDURE
2337 ,p_module => l_log_module);
2338 END IF;
2339 EXCEPTION
2340 WHEN xla_exceptions_pkg.application_exception THEN
2341 IF source_cur%ISOPEN THEN CLOSE source_cur; END IF;
2342 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2343 trace
2344 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2345 ,p_level => C_LEVEL_EXCEPTION
2346 ,p_module => l_log_module);
2347 END IF;
2348 RAISE;
2349 WHEN OTHERS THEN
2350 IF source_cur%ISOPEN THEN CLOSE source_cur; END IF;
2351 xla_exceptions_pkg.raise_message
2352 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetLineAcctgSources ');
2353 END GetLineAcctgSources;
2354
2355
2356 /*--------------------------------------------------------------------+
2357 | |
2358 | Private procedure |
2359 | |
2360 | GetSourcesDefinedInHeader |
2361 | |
2362 | Get header sources defined in header description. |
2363 | |
2364 +--------------------------------------------------------------------*/
2365
2366 PROCEDURE GetSourcesDefinedInHeader(
2367 p_entity IN VARCHAR2
2368 , p_event_class IN VARCHAR2
2369 , p_event_type IN VARCHAR2
2370 , p_application_id IN NUMBER
2371 , p_product_rule_code IN VARCHAR2
2372 , p_product_rule_type_code IN VARCHAR2
2373 , p_amb_context_code IN VARCHAR2
2374 , p_array_evt_source_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2375 , p_hdr_description_index IN OUT NOCOPY BINARY_INTEGER
2376 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
2377 )
2378 IS
2379 --
2380 l_description_type_code VARCHAR2(1);
2381 l_description_code VARCHAR2(30);
2382 l_ObjectIndex BINARY_INTEGER;
2383 l_log_module VARCHAR2(240);
2384
2385 BEGIN
2386
2387 IF g_log_enabled THEN
2388 l_log_module := C_DEFAULT_MODULE||'.GetSourcesDefinedInHeader';
2389 END IF;
2390 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2391 trace
2392 (p_msg => 'BEGIN of GetSourcesDefinedInHeader'
2393 ,p_level => C_LEVEL_PROCEDURE
2394 ,p_module => l_log_module);
2395 END IF;
2396
2397 SELECT xpah.description_code
2398 , xpah.description_type_code
2399 INTO l_description_code
2400 , l_description_type_code
2401 FROM xla_prod_acct_headers xpah
2402 WHERE xpah.product_rule_type_code = p_product_rule_type_code
2403 AND xpah.product_rule_code = p_product_rule_code
2404 AND xpah.entity_code = p_entity
2405 AND xpah.event_class_code = p_event_class
2406 AND xpah.event_type_code = p_event_type
2407 AND xpah.application_id = p_application_id
2408 AND xpah.amb_context_code = p_amb_context_code
2409 AND xpah.accounting_required_flag = 'Y'
2410 ;
2411
2412 l_ObjectIndex :=xla_cmp_source_pkg.GetAADObjectPosition(
2413 p_object => xla_cmp_source_pkg.C_DESC
2414 , p_object_code => l_description_code
2415 , p_object_type_code => l_description_type_code
2416 , p_application_id => p_application_id
2417 , p_event_class_code => NULL
2418 , p_event_type_code => NULL
2419 , p_rec_aad_objects => p_rec_aad_objects
2420 );
2421
2422 IF l_ObjectIndex IS NOT NULL THEN
2423
2424 xla_cmp_source_pkg.GetSourcesInAADObject(
2425 p_object => xla_cmp_source_pkg.C_DESC
2426 , p_object_code => l_description_code
2427 , p_object_type_code => l_description_type_code
2428 , p_application_id => p_application_id
2429 , p_event_class_code => NULL
2430 , p_event_type_code => NULL
2431 , p_array_source_Index => p_array_evt_source_index
2432 , p_rec_aad_objects => p_rec_aad_objects
2433 );
2434
2435 END IF;
2436
2437 p_hdr_description_index := l_ObjectIndex;
2438
2439 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2440 trace
2441 (p_msg => 'END of GetSourcesDefinedInHeader = '||p_hdr_description_index
2442 ,p_level => C_LEVEL_PROCEDURE
2443 ,p_module => l_log_module);
2444 END IF;
2445 EXCEPTION
2446 WHEN NO_DATA_FOUND THEN
2447 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2448 trace
2449 (p_msg => 'END of GetSourcesDefinedInHeader (no header description)'
2450 ,p_level => C_LEVEL_PROCEDURE
2451 ,p_module => l_log_module);
2452 END IF;
2453 p_hdr_description_index := NULL;
2454 WHEN TOO_MANY_ROWS THEN
2455 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2456 trace
2457 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = two_many_rows '||sqlerrm
2458 ,p_level => C_LEVEL_EXCEPTION
2459 ,p_module => l_log_module);
2460 END IF;
2461 RAISE;
2462 WHEN xla_exceptions_pkg.application_exception THEN
2463 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2464 trace
2465 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2466 ,p_level => C_LEVEL_EXCEPTION
2467 ,p_module => l_log_module);
2468 END IF;
2469 RAISE;
2470 WHEN OTHERS THEN
2471 xla_exceptions_pkg.raise_message
2472 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetSourcesDefinedInHeader');
2473 END GetSourcesDefinedInHeader;
2474
2475 /*--------------------------------------------------------------------+
2476 | |
2477 | Private procedure |
2478 | |
2479 | GetSourcesDefinedInAcctgLine |
2480 | |
2481 | Get header sources defined in Jorunal Line Definitions. |
2482 | |
2483 +--------------------------------------------------------------------*/
2484
2485 PROCEDURE GetSourcesDefinedInAcctgLine (
2486 p_entity IN VARCHAR2
2487 , p_event_class IN VARCHAR2
2488 , p_event_type IN VARCHAR2
2489 , p_application_id IN NUMBER
2490 , p_product_rule_code IN VARCHAR2
2491 , p_product_rule_type_code IN VARCHAR2
2492 , p_amb_context_code IN VARCHAR2
2493 , p_array_evt_source_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2494 , p_array_alt_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2495 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
2496 )
2497 IS
2498 --
2499 CURSOR alt_cur
2500 IS
2501 SELECT DISTINCT
2502 xldj.accounting_line_code
2503 , xldj.accounting_line_type_code
2504 , xldj.line_definition_code
2505 , xldj.line_definition_owner_code
2506 FROM xla_aad_line_defn_assgns xald
2507 , xla_line_defn_jlt_assgns xldj
2508 , xla_prod_acct_headers xpah
2509 , xla_line_definitions_b xld
2510 WHERE xldj.line_definition_owner_code = xald.line_definition_owner_code
2511 AND xldj.line_definition_code = xald.line_definition_code
2512 AND xldj.event_class_code = xald.event_class_code
2513 AND xldj.event_type_code = xald.event_type_code
2514 AND xldj.application_id = xald.application_id
2515 AND xldj.amb_context_code = xald.amb_context_code
2516 AND xldj.active_flag = 'Y'
2517 --
2518 AND xld.line_definition_owner_code = xald.line_definition_owner_code
2519 AND xld.line_definition_code = xald.line_definition_code
2520 AND xld.event_class_code = xald.event_class_code
2521 AND xld.event_type_code = xald.event_type_code
2522 AND xld.application_id = xald.application_id
2523 AND xld.amb_context_code = xald.amb_context_code
2524 AND xld.budgetary_control_flag = XLA_CMP_PAD_PKG.g_bc_pkg_flag
2525 --
2526 AND xald.product_rule_type_code = xpah.product_rule_type_code
2527 AND xald.product_rule_code = xpah.product_rule_code
2528 AND xald.event_class_code = xpah.event_class_code
2529 AND xald.event_type_code = xpah.event_type_code
2530 AND xald.application_id = xpah.application_id
2531 AND xald.amb_context_code = xpah.amb_context_code
2532 --
2533 AND xpah.product_rule_type_code = p_product_rule_type_code
2534 AND xpah.product_rule_code = p_product_rule_code
2535 AND xpah.entity_code = p_entity
2536 AND xpah.event_class_code = p_event_class
2537 AND xpah.event_type_code = p_event_type
2538 AND xpah.application_id = p_application_id
2539 AND xpah.amb_context_code = p_amb_context_code
2540 AND xpah.accounting_required_flag = 'Y'
2541 ORDER BY xldj.accounting_line_type_code, xldj.accounting_line_code
2542 , xldj.line_definition_owner_code, xldj.line_definition_code
2543 ;
2544 --
2545 l_array_alt_code xla_cmp_source_pkg.t_array_VL30;
2546 l_array_alt_type_code xla_cmp_source_pkg.t_array_VL1;
2547 l_array_jld_code xla_cmp_source_pkg.t_array_VL30;
2548 l_array_jld_owner_code xla_cmp_source_pkg.t_array_VL1;
2549 l_ObjectIndex BINARY_INTEGER;
2550 l_log_module VARCHAR2(240);
2551 invalid_jlt EXCEPTION;
2552 --
2553 BEGIN
2554 --
2555 IF g_log_enabled THEN
2556 l_log_module := C_DEFAULT_MODULE||'.GetSourcesDefinedInAcctgLine';
2557 END IF;
2558 --
2559 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2560
2561 trace
2562 (p_msg => 'BEGIN of GetSourcesDefinedInAcctgLine'
2563 ,p_level => C_LEVEL_PROCEDURE
2564 ,p_module => l_log_module);
2565
2566 END IF;
2567 --
2568 OPEN alt_cur;
2569 --
2570 FETCH alt_cur BULK COLLECT INTO l_array_alt_code
2571 , l_array_alt_type_code
2572 , l_array_jld_code
2573 , l_array_jld_owner_code
2574 ;
2575
2576 CLOSE alt_cur;
2577
2578 IF l_array_alt_code.COUNT > 0 THEN
2579
2580 FOR Idx IN l_array_alt_code.FIRST .. l_array_alt_code.LAST LOOP
2581
2582 IF l_array_alt_code.EXISTS(Idx) THEN
2583
2584 l_ObjectIndex :=xla_cmp_source_pkg.GetAADObjectPosition(
2585 p_object => xla_cmp_source_pkg.C_ALT
2586 , p_object_code => l_array_alt_code(Idx)
2587 , p_object_type_code => l_array_alt_type_code(Idx)
2588 , p_application_id => p_application_id
2589 , p_line_definition_code => l_array_jld_code(Idx)
2590 , p_line_definition_owner_code => l_array_jld_owner_code(Idx)
2591 , p_event_class_code => p_event_class
2592 , p_event_type_code => p_event_type
2593 , p_rec_aad_objects => p_rec_aad_objects
2594 );
2595
2596 IF l_ObjectIndex IS NOT NULL THEN
2597
2598 xla_cmp_source_pkg.GetSourcesInAADObject(
2599 p_object => xla_cmp_source_pkg.C_ALT
2600 , p_object_code => l_array_alt_code(Idx)
2601 , p_object_type_code => l_array_alt_type_code(Idx)
2602 , p_application_id => p_application_id
2603 , p_line_definition_code => l_array_jld_code(Idx)
2604 , p_line_definition_owner_code => l_array_jld_owner_code(Idx)
2605 , p_event_class_code => p_event_class
2606 , p_event_type_code => p_event_type
2607 , p_array_source_Index => p_array_evt_source_index
2608 , p_rec_aad_objects => p_rec_aad_objects
2609 );
2610
2611 ELSE
2612
2613 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2614 trace
2615 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = Journal Line Type not cached = '||
2616 'JLT ='||l_array_alt_code(Idx)||' - '||l_array_alt_type_code(Idx)||
2617 ' - JLD ='||l_array_jld_code(Idx)||' - '||l_array_jld_owner_code(Idx)
2618 ,p_level => C_LEVEL_EXCEPTION
2619 ,p_module => l_log_module);
2620 END IF;
2621 RAISE invalid_jlt;
2622
2623 END IF;
2624
2625 p_array_alt_index(Idx) := l_ObjectIndex;
2626
2627 END IF;
2628
2629 END LOOP;
2630
2631 END IF;
2632
2633 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2634 trace
2635 (p_msg => 'END of GetSourcesDefinedInAcctgLine = '|| p_array_alt_index.COUNT
2636 ,p_level => C_LEVEL_PROCEDURE
2637 ,p_module => l_log_module);
2638 END IF;
2639 EXCEPTION
2640 WHEN invalid_jlt THEN
2641 IF alt_cur%ISOPEN THEN CLOSE alt_cur; END IF;
2642 RAISE;
2643 WHEN xla_exceptions_pkg.application_exception THEN
2644 IF alt_cur%ISOPEN THEN CLOSE alt_cur; END IF;
2645 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2646 trace
2647 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2648 ,p_level => C_LEVEL_EXCEPTION
2649 ,p_module => l_log_module);
2650 END IF;
2651 RAISE;
2652 WHEN OTHERS THEN
2653 IF alt_cur%ISOPEN THEN CLOSE alt_cur; END IF;
2654 xla_exceptions_pkg.raise_message
2655 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetSourcesDefinedInAcctgLine');
2656 END GetSourcesDefinedInAcctgLine;
2657
2658 /*--------------------------------------------------------------------+
2659 | |
2660 | Private procedure |
2661 | |
2662 | CollectHeaderAndLineSources |
2663 | |
2664 | Collect header and line sources to extract from the Transaction |
2665 | Objects |
2666 | |
2667 +--------------------------------------------------------------------*/
2668
2669 PROCEDURE CollectHeaderAndLineSources (
2670 p_entity IN VARCHAR2
2671 , p_event_class IN VARCHAR2
2672 , p_event_type IN VARCHAR2
2673 , p_application_id IN NUMBER
2674 , p_product_rule_code IN VARCHAR2
2675 , p_product_rule_type_code IN VARCHAR2
2676 , p_amb_context_code IN VARCHAR2
2677 , p_array_evt_source_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2678 , p_array_hdr_acctg_source OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
2679 , p_array_hdr_acctg_source_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
2680 , p_array_hdr_acct_attr_source OUT NOCOPY xla_cmp_source_pkg.t_array_int
2681 , p_array_line_acctg_source OUT NOCOPY xla_cmp_source_pkg.t_array_VL30
2682 , p_array_line_acctg_source_type OUT NOCOPY xla_cmp_source_pkg.t_array_VL1
2683 , p_array_line_acct_attr_source OUT NOCOPY xla_cmp_source_pkg.t_array_int
2684 , p_hdr_description_index IN OUT NOCOPY BINARY_INTEGER
2685 , p_array_alt_index IN OUT NOCOPY xla_cmp_source_pkg.t_array_ByInt
2686 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
2687 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
2688 )
2689 IS
2690
2691 l_Idx BINARY_INTEGER;
2692 l_log_module VARCHAR2(240);
2693
2694 BEGIN
2695 IF g_log_enabled THEN
2696 l_log_module := C_DEFAULT_MODULE||'.CollectHeaderAndLineSources';
2697 END IF;
2698 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2699 trace
2700 (p_msg => 'BEGIN of CollectHeaderAndLineSources'
2701 ,p_level => C_LEVEL_PROCEDURE
2702 ,p_module => l_log_module);
2703 END IF;
2704
2705 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2706 trace
2707 (p_msg => '# number of sources = '||p_array_evt_source_index.COUNT
2708 ,p_level => C_LEVEL_STATEMENT
2709 ,p_module => l_log_module);
2710 trace
2711 (p_msg => 'Get header description sources'
2712 ,p_level => C_LEVEL_STATEMENT
2713 ,p_module => l_log_module);
2714 END IF;
2715
2716 GetSourcesDefinedInHeader(
2717 p_entity => p_entity
2718 , p_event_class => p_event_class
2719 , p_event_type => p_event_type
2720 , p_application_id => p_application_id
2721 , p_product_rule_code => p_product_rule_code
2722 , p_product_rule_type_code => p_product_rule_type_code
2723 , p_amb_context_code => p_amb_context_code
2724 , p_array_evt_source_index => p_array_evt_source_index
2725 , p_hdr_description_index => p_hdr_description_index
2726 , p_rec_aad_objects => p_rec_aad_objects
2727 );
2728
2729 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2730 trace
2731 (p_msg => 'Get header accounting attribute sources'
2732 ,p_level => C_LEVEL_STATEMENT
2733 ,p_module => l_log_module);
2734
2735 trace
2736 (p_msg => '# number of sources = '||p_array_evt_source_index.COUNT
2737 ,p_level => C_LEVEL_STATEMENT
2738 ,p_module => l_log_module);
2739 END IF;
2740
2741 GetHeaderAcctgSources (
2742 p_entity => p_entity
2743 , p_event_class => p_event_class
2744 , p_event_type => p_event_type
2745 , p_application_id => p_application_id
2746 , p_amb_context_code => p_amb_context_code
2747 , p_product_rule_code => p_product_rule_code
2748 , p_product_rule_type_code => p_product_rule_type_code
2749 , p_array_evt_source_index => p_array_evt_source_index
2750 , p_array_hdr_acctg_source => p_array_hdr_acctg_source
2751 , p_array_hdr_acctg_source_type => p_array_hdr_acctg_source_type
2752 , p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
2753 , p_rec_sources => p_rec_sources
2754 )
2755 ;
2756
2757 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2758 trace
2759 (p_msg => 'Get Journal Line Definition sources'
2760 ,p_level => C_LEVEL_STATEMENT
2761 ,p_module => l_log_module);
2762 trace
2763 (p_msg => '# number of sources = '||p_array_evt_source_index.COUNT
2764 ,p_level => C_LEVEL_STATEMENT
2765 ,p_module => l_log_module);
2766 END IF;
2767
2768
2769 xla_cmp_analytic_criteria_pkg.GetAnalyticalCriteriaSources (
2770 p_entity => p_entity
2771 , p_event_class => p_event_class
2772 , p_event_type => p_event_type
2773 , p_application_id => p_application_id
2774 , p_product_rule_code => p_product_rule_code
2775 , p_product_rule_type_code => p_product_rule_type_code
2776 , p_amb_context_code => p_amb_context_code
2777 , p_array_evt_source_index => p_array_evt_source_index
2778 , p_rec_sources => p_rec_sources );
2779
2780
2781 GetSourcesDefinedInAcctgLine(
2782 p_entity => p_entity
2783 , p_event_class => p_event_class
2784 , p_event_type => p_event_type
2785 , p_application_id => p_application_id
2786 , p_product_rule_code => p_product_rule_code
2787 , p_product_rule_type_code => p_product_rule_type_code
2788 , p_amb_context_code => p_amb_context_code
2789 , p_array_evt_source_index => p_array_evt_source_index
2790 , p_array_alt_index => p_array_alt_index
2791 , p_rec_aad_objects => p_rec_aad_objects
2792 );
2793
2794 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2795 trace
2796 (p_msg => 'Get Reversal Line Accounting Attribute sources'
2797 ,p_level => C_LEVEL_STATEMENT
2798 ,p_module => l_log_module);
2799 trace
2800 (p_msg => '# number of sources = '||p_array_evt_source_index.COUNT
2801 ,p_level => C_LEVEL_STATEMENT
2802 ,p_module => l_log_module);
2803 END IF;
2804
2805 GetLineAcctgSources (
2806 p_entity => p_entity
2807 , p_event_class => p_event_class
2808 , p_application_id => p_application_id
2809 , p_array_evt_source_index => p_array_evt_source_index
2810 , p_array_line_acctg_source => p_array_line_acctg_source
2811 , p_array_line_acctg_source_type => p_array_line_acctg_source_type
2812 , p_array_line_acct_attr_source => p_array_line_acct_attr_source
2813 , p_rec_sources => p_rec_sources
2814 )
2815 ;
2816
2817 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2818 trace
2819 (p_msg => '# of header and line sources = '||p_array_evt_source_index.COUNT
2820 ,p_level => C_LEVEL_STATEMENT
2821 ,p_module => l_log_module);
2822 END IF;
2823
2824 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2825 trace
2826 (p_msg => 'END of CollectHeaderAndLineSources'
2827 ,p_level => C_LEVEL_PROCEDURE
2828 ,p_module => l_log_module);
2829 END IF;
2830 EXCEPTION
2831 WHEN xla_exceptions_pkg.application_exception THEN
2832 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2833 trace
2834 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2835 ,p_level => C_LEVEL_EXCEPTION
2836 ,p_module => l_log_module);
2837 END IF;
2838 RAISE;
2839 WHEN OTHERS THEN
2840 xla_exceptions_pkg.raise_message
2841 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.CollectHeaderAndLineSources');
2842 END CollectHeaderAndLineSources;
2843
2844 /*-----------------------------------------------------------------------+
2845 | |
2846 | Private function |
2847 | |
2848 | GenerateHdrDescription |
2849 | |
2850 | Generates in EventClass_x()/EventType_x() a call to header description |
2851 | |
2852 +-----------------------------------------------------------------------*/
2853
2854 FUNCTION GenerateHdrDescription (
2855 p_hdr_description_index IN BINARY_INTEGER
2856 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
2857 , p_rec_sources IN xla_cmp_source_pkg.t_rec_sources
2858 )
2859 RETURN CLOB
2860 IS
2861
2862 C_CALL_HDR_DESC CONSTANT VARCHAR2(10000):= '
2863 --
2864 xla_ae_header_pkg.SetHdrDescription(
2865 p_description => Description_$desc_code$ (
2866 p_application_id => p_application_id $parameters$
2867 )
2868 );
2869 --
2870 ';
2871
2872 l_hdr_desc CLOB;
2873 l_log_module VARCHAR2(240);
2874 BEGIN
2875 IF g_log_enabled THEN
2876 l_log_module := C_DEFAULT_MODULE||'.GenerateHdrDescription';
2877 END IF;
2878 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2879 trace
2880 (p_msg => 'BEGIN of GenerateHdrDescription'
2881 ,p_level => C_LEVEL_PROCEDURE
2882 ,p_module => l_log_module);
2883 END IF;
2884
2885 l_hdr_desc := NULL;
2886
2887 IF nvl(p_hdr_description_index,0) <> 0 THEN
2888
2889 l_hdr_desc := C_CALL_HDR_DESC;
2890 l_hdr_desc := xla_cmp_string_pkg.replace_token(l_hdr_desc,'$desc_code$', TO_CHAR(p_hdr_description_index)); -- 4417664
2891 l_hdr_desc := xla_cmp_string_pkg.replace_token(l_hdr_desc,'$parameters$',
2892 xla_cmp_call_fct_pkg.GetHeaderParameters(
2893 p_array_source_index => p_rec_aad_objects.array_array_object(p_hdr_description_index)
2894 , p_rec_sources => p_rec_sources
2895 )
2896 );
2897
2898 END IF;
2899
2900 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2901 trace
2902 (p_msg => 'END of GenerateHdrDescription'
2903 ,p_level => C_LEVEL_PROCEDURE
2904 ,p_module => l_log_module);
2905 END IF;
2906 RETURN l_hdr_desc;
2907 EXCEPTION
2908 WHEN VALUE_ERROR THEN
2909 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2910 trace
2911 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2912 ,p_level => C_LEVEL_EXCEPTION
2913 ,p_module => l_log_module);
2914 END IF;
2915 RAISE;
2916 WHEN xla_exceptions_pkg.application_exception THEN
2917 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2918 trace
2919 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
2920 ,p_level => C_LEVEL_EXCEPTION
2921 ,p_module => l_log_module);
2922 END IF;
2923 RAISE;
2924 WHEN OTHERS THEN
2925 xla_exceptions_pkg.raise_message
2926 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateHdrDescription');
2927 END GenerateHdrDescription;
2928
2929 /*-----------------------------------------------------------------------+
2930 | |
2931 | Private function |
2932 | |
2933 | GenerateHdrAcctgSources |
2934 | |
2935 | Generates in EventClass_x()/EventType_x() the set of Header Accounting |
2936 | Attributes. |
2937 | |
2938 +-----------------------------------------------------------------------*/
2939
2940 FUNCTION GenerateHdrAcctgSources (
2941 p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
2942 , p_array_hdr_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
2943 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
2944 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
2945 )
2946 RETURN CLOB
2947 IS
2948 --
2949 C_SET_HDR_ACCT_SOURCES CONSTANT VARCHAR2(10000):=
2950 ' l_rec_acct_attrs.array_acct_attr_code($index$) := ''$accounting_attribute$'';
2951 l_rec_acct_attrs.array_$datatype$_value($index$) := $source$;
2952 ';
2953 --
2954 l_hdr_acctg_sources CLOB;
2955 l_hdr_acctg_source VARCHAR2(32000) ;
2956 l_source VARCHAR2(2000);
2957 l_log_module VARCHAR2(240);
2958 --
2959 l_index NUMBER;
2960 BEGIN
2961 IF g_log_enabled THEN
2962 l_log_module := C_DEFAULT_MODULE||'.GenerateHdrAcctgSources';
2963 END IF;
2964 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2965 trace
2966 (p_msg => 'BEGIN of GenerateHdrAcctgSources'
2967 ,p_level => C_LEVEL_PROCEDURE
2968 ,p_module => l_log_module);
2969 END IF;
2970
2971 l_index := 0;
2972 l_hdr_acctg_sources := C_HDR_ACCT_BODY; -- 4262811
2973
2974 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
2975 trace
2976 (p_msg => 'p_array_hdr_acctg_source.count is:'||to_char(p_array_hdr_acctg_source.COUNT)
2977 ,p_level => C_LEVEL_STATEMENT
2978 ,p_module => l_log_module);
2979 END IF;
2980
2981 IF p_array_hdr_acctg_source.COUNT > 0 THEN
2982
2983 FOR Idx IN p_array_hdr_acctg_source.FIRST .. p_array_hdr_acctg_source.LAST LOOP
2984
2985 IF p_array_hdr_acctg_source.EXISTS(Idx) AND
2986 p_array_hdr_acctg_source_type.EXISTS(Idx) THEN
2987
2988 --l_index := l_index + 1; -- 4262811 Move to below to avoid index starting at 2,3,,,
2989
2990 IF p_array_hdr_acctg_source(Idx) not in ('EXCHANGE_GAIN_CCID', 'EXCHANGE_LOSS_CCID') THEN
2991 IF p_array_hdr_acctg_source(Idx) <> 'ACCRUAL_REVERSAL_GL_DATE' THEN -- 4262811
2992 l_index := l_index + 1; -- 4262811
2993
2994 l_source := xla_cmp_source_pkg.GenerateSource(
2995 p_Index => p_array_hdr_acct_attr_source(Idx)
2996 , p_rec_sources => p_rec_sources
2997 , p_variable => p_array_hdr_acctg_source_type(Idx)
2998 , p_translated_flag => 'N') ;
2999
3000 l_hdr_acctg_source := REPLACE(C_SET_HDR_ACCT_SOURCES,'$index$',to_char(l_index));
3001
3002 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$accounting_attribute$', p_array_hdr_acctg_source(Idx));
3003
3004 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$source$', l_source);
3005
3006 CASE p_rec_sources.array_datatype_code(p_array_hdr_acct_attr_source(Idx))
3007 when 'F' then
3008 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$','num') ;
3009 when 'I' then
3010 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$','num') ;
3011 when 'N' then
3012 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$','num') ;
3013 when 'C' then
3014 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$','char') ;
3015 when 'D' then
3016 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$','date') ;
3017 else
3018 l_hdr_acctg_source := REPLACE(l_hdr_acctg_source,'$datatype$',
3019 p_rec_sources.array_datatype_code(p_array_hdr_acct_attr_source(Idx))) ;
3020 END CASE;
3021
3022 l_hdr_acctg_sources := l_hdr_acctg_sources || l_hdr_acctg_source;
3023
3024 ELSE -- 4262811
3025
3026 -- IF p_rec_sources.array_source_code (Idx) NOT IN ('XLA_NEXT_DAY',
3027 -- 'XLA_FIRST_DAY_NEXT_GL_PERIOD',
3028 -- 'XLA_LAST_DAY_NEXT_GL_PERIOD') OR
3029 --Bug :11718774
3030 IF p_rec_sources.array_source_code (p_array_hdr_acct_attr_source(Idx)) NOT IN
3031 ('XLA_NEXT_DAY',
3032 'XLA_FIRST_DAY_NEXT_GL_PERIOD',
3033 'XLA_LAST_DAY_NEXT_GL_PERIOD') AND
3034 (p_rec_sources.array_source_type_code (p_array_hdr_acct_attr_source(Idx)) <> 'Y' OR
3035 p_rec_sources.array_application_id (p_array_hdr_acct_attr_source(Idx)) <> 602) THEN
3036
3037 l_source := xla_cmp_source_pkg.GenerateSource(
3038 p_Index => p_array_hdr_acct_attr_source(Idx)
3039 , p_rec_sources => p_rec_sources
3040 , p_variable => p_array_hdr_acctg_source_type(Idx)
3041 , p_translated_flag => 'N') ;
3042
3043 l_hdr_acctg_sources := xla_cmp_string_pkg.replace_token(l_hdr_acctg_sources,
3044 '$acc_rev_gl_date_source$', l_source);
3045 END IF;
3046
3047 END IF; -- p_array_hdr_acctg_source(Idx) <> 'ACCRUAL_REVERSAL_GL_DATE'
3048 END IF;
3049
3050 END IF; -- p_array_hdr_acctg_source.EXISTS(Idx)
3051
3052 END LOOP;
3053
3054 -------------------------------------------------------------------------------------
3055 -- 4262811
3056 -------------------------------------------------------------------------------------
3057 -- If the acc_rev_gl_date_source token is not replaced, the ACCRUAL_REVERSAL_GL_DATE
3058 -- attribute is not found. Then replace the accounting attribute by NULL
3059 -------------------------------------------------------------------------------------
3060 l_hdr_acctg_sources := xla_cmp_string_pkg.replace_token(l_hdr_acctg_sources,'$acc_rev_gl_date_source$','NULL');
3061
3062 END IF; -- p_array_hdr_acctg_source.COUNT > 0
3063
3064 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3065 trace
3066 (p_msg => 'END of GenerateHdrAcctgSources'
3067 ,p_level => C_LEVEL_PROCEDURE
3068 ,p_module => l_log_module);
3069 END IF;
3070
3071 RETURN l_hdr_acctg_sources;
3072
3073 EXCEPTION
3074 WHEN VALUE_ERROR THEN
3075 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3076 trace
3077 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3078 ,p_level => C_LEVEL_EXCEPTION
3079 ,p_module => l_log_module);
3080 END IF;
3081 RAISE;
3082 WHEN xla_exceptions_pkg.application_exception THEN
3083 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3084 trace
3085 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3086 ,p_level => C_LEVEL_EXCEPTION
3087 ,p_module => l_log_module);
3088 END IF;
3089 RAISE;
3090 WHEN OTHERS THEN
3091 xla_exceptions_pkg.raise_message
3092 (p_location => 'XLA_CMP_EVENT_TYPE_PKG. GenerateHdrAcctgSources');
3093 END GenerateHdrAcctgSources;
3094
3095 /*-----------------------------------------------------------------------+
3096 | |
3097 | Private function |
3098 | |
3099 | GenerateGainLossAcctSources |
3100 | |
3101 | Generates in EventClass_x()/EventType_x() the default gain/loss ccid |
3102 | calling parameters |
3103 | |
3104 +-----------------------------------------------------------------------*/
3105
3106 FUNCTION GenerateGainLossAcctSources(
3107 p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
3108 , p_array_hdr_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
3109 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
3110 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
3111 )
3112 RETURN CLOB
3113 IS
3114 --
3115 C_CALLING_PARAMS CONSTANT VARCHAR2(10000):='
3116 ,p_gain_ccid => $gain_ccid_source$
3117 ,p_loss_ccid => $loss_ccid_source$
3118 ';
3119 --
3120 l_gain_or_loss_source VARCHAR2(30000);
3121 l_hdr_acctg_source VARCHAR2(32000) ;
3122 l_source VARCHAR2(2000);
3123 l_log_module VARCHAR2(240);
3124 --
3125 l_index NUMBER;
3126 BEGIN
3127 IF g_log_enabled THEN
3128 l_log_module := C_DEFAULT_MODULE||'.GenerateGainLossAcctSources';
3129 END IF;
3130 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3131 trace
3132 (p_msg => 'BEGIN of GenerateGainLossAcctSources'
3133 ,p_level => C_LEVEL_PROCEDURE
3134 ,p_module => l_log_module);
3135 END IF;
3136
3137 l_index := 0;
3138 l_gain_or_loss_source := C_CALLING_PARAMS;
3139
3140 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
3141 trace
3142 (p_msg => 'p_array_hdr_acctg_source.count is:'||to_char(p_array_hdr_acctg_source.COUNT)
3143 ,p_level => C_LEVEL_STATEMENT
3144 ,p_module => l_log_module);
3145 END IF;
3146
3147 IF p_array_hdr_acctg_source.COUNT > 0 THEN
3148 l_index := 0;
3149
3150 FOR Idx IN p_array_hdr_acctg_source.FIRST .. p_array_hdr_acctg_source.LAST LOOP
3151 IF(l_index = 3) THEN
3152 EXIT;
3153 END IF;
3154
3155 IF p_array_hdr_acctg_source.EXISTS(Idx) AND
3156 p_array_hdr_acctg_source_type.EXISTS(Idx) THEN
3157
3158 IF p_array_hdr_acctg_source(Idx) in ('EXCHANGE_GAIN_CCID', 'EXCHANGE_LOSS_CCID') THEN
3159
3160 l_source := xla_cmp_source_pkg.GenerateSource(
3161 p_Index => p_array_hdr_acct_attr_source(Idx)
3162 , p_rec_sources => p_rec_sources
3163 , p_variable => p_array_hdr_acctg_source_type(Idx)
3164 , p_translated_flag => 'N') ;
3165
3166 IF p_array_hdr_acctg_source(Idx) = 'EXCHANGE_GAIN_CCID' THEN
3167 l_index := l_index + 1;
3168 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$gain_ccid_source$', l_source);
3169 ELSE
3170 l_index := l_index + 2;
3171 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$loss_ccid_source$', l_source);
3172 END IF;
3173
3174 END IF;
3175 END IF; -- p_array_hdr_acctg_source.EXISTS(Idx)
3176
3177 END LOOP;
3178
3179 END IF; -- p_array_hdr_acctg_source.COUNT > 0
3180
3181 IF(l_index <3) THEN
3182 IF(l_index = 0 ) THEN
3183 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$gain_ccid_source$', '-1');
3184 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$loss_ccid_source$', '-1');
3185 ELSIF(l_index = 1 ) THEN
3186 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$loss_ccid_source$', '-1');
3187 ELSE
3188 l_gain_or_loss_source:= REPLACE(l_gain_or_loss_source,'$gain_ccid_source$', '-1');
3189 END IF;
3190 END IF;
3191
3192
3193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3194 trace
3195 (p_msg => 'END of GenerateHdrAcctgSources'
3196 ,p_level => C_LEVEL_PROCEDURE
3197 ,p_module => l_log_module);
3198 END IF;
3199
3200 RETURN l_gain_or_loss_source;
3201
3202 EXCEPTION
3203 WHEN VALUE_ERROR THEN
3204 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3205 trace
3206 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3207 ,p_level => C_LEVEL_EXCEPTION
3208 ,p_module => l_log_module);
3209 END IF;
3210 RAISE;
3211 WHEN xla_exceptions_pkg.application_exception THEN
3212 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3213 trace
3214 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3215 ,p_level => C_LEVEL_EXCEPTION
3216 ,p_module => l_log_module);
3217 END IF;
3218 RAISE;
3219 WHEN OTHERS THEN
3220 xla_exceptions_pkg.raise_message
3221 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateGainLossAcctSources');
3222 END GenerateGainLossAcctSources;
3223
3224 /*---------------------------------------------------------------+
3225 | |
3226 | Private function |
3227 | |
3228 | GenerateReversalAcctgSources |
3229 | |
3230 | Generates in EventClass_x()/EventType_x() the set of Reversal |
3231 | Accounting Attributes. |
3232 | |
3233 +---------------------------------------------------------------*/
3234
3235 FUNCTION GenerateReversalAcctgSources (
3236 p_array_line_acctg_source IN xla_cmp_source_pkg.t_array_VL30
3237 , p_array_line_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
3238 , p_array_line_acct_attr_source IN xla_cmp_source_pkg.t_array_int
3239 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
3240 )
3241 RETURN CLOB
3242 IS
3243
3244 C_SET_REV_ACCT_SOURCES CONSTANT VARCHAR2(10000):=
3245 ' l_rec_rev_acct_attrs.array_acct_attr_code($index$) := ''$accounting_attribute$'';
3246 l_rec_rev_acct_attrs.array_$datatype$_value($index$) := $source$;
3247 ';
3248
3249 l_line_acctg_sources CLOB;
3250 l_line_acctg_source VARCHAR2(32000) ;
3251 l_log_module VARCHAR2(240);
3252 --
3253 l_index NUMBER;
3254 BEGIN
3255
3256 IF g_log_enabled THEN
3257 l_log_module := C_DEFAULT_MODULE||'.GenerateReversalAcctgSources';
3258 END IF;
3259 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3260 trace
3261 (p_msg => 'BEGIN of GenerateReversalAcctgSources'
3262 ,p_level => C_LEVEL_PROCEDURE
3263 ,p_module => l_log_module);
3264 END IF;
3265
3266 l_index := 1; --5217187
3267 l_line_acctg_sources := NULL;
3268
3269 FOR Idx IN 1..(p_array_line_acctg_source.COUNT) LOOP
3270
3271 IF p_array_line_acct_attr_source.EXISTS(Idx) AND
3272 p_array_line_acct_attr_source(Idx) IS NOT NULL
3273 THEN
3274 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3275 trace
3276 (p_msg => 'accounting attribute = '||p_array_line_acctg_source(Idx)
3277 ,p_level => C_LEVEL_STATEMENT
3278 ,p_module => l_log_module);
3279 END IF;
3280
3281 l_index := l_index + 1;
3282
3283 l_line_acctg_source := REPLACE(C_SET_REV_ACCT_SOURCES ,'$accounting_attribute$',
3284 p_array_line_acctg_source(Idx));
3285
3286 l_line_acctg_source := REPLACE(l_line_acctg_source , '$source$',
3287 xla_cmp_source_pkg.GenerateSource(
3288 p_Index => p_array_line_acct_attr_source(Idx)
3289 , p_rec_sources => p_rec_sources
3290 , p_variable => p_array_line_acctg_source_type(Idx)
3291 , p_translated_flag => 'N')
3292 );
3293 --
3294 l_line_acctg_source := REPLACE(l_line_acctg_source,'$index$',to_char(l_index));
3295
3296 CASE p_rec_sources.array_datatype_code(p_array_line_acct_attr_source(Idx))
3297 when 'F' then
3298 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$','num') ;
3299 when 'I' then
3300 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$','num') ;
3301 when 'N' then
3302 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$','num') ;
3303 when 'C' then
3304 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$','char') ;
3305 when 'D' then
3306 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$','date') ;
3307 else
3308 l_line_acctg_source := REPLACE(l_line_acctg_source,'$datatype$',
3309 p_rec_sources.array_datatype_code(p_array_line_acct_attr_source(Idx))) ;
3310 END CASE;
3311
3312 l_line_acctg_sources := l_line_acctg_sources || l_line_acctg_source;
3313
3314 END IF;
3315 END LOOP;
3316
3317 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3318 trace
3319 (p_msg => 'END of GenerateReversalAcctgSources'
3320 ,p_level => C_LEVEL_PROCEDURE
3321 ,p_module => l_log_module);
3322 END IF;
3323 RETURN l_line_acctg_sources;
3324 EXCEPTION
3325 WHEN VALUE_ERROR THEN
3326 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3327 trace
3328 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3329 ,p_level => C_LEVEL_EXCEPTION
3330 ,p_module => l_log_module);
3331 END IF;
3332 RAISE;
3333 WHEN xla_exceptions_pkg.application_exception THEN
3334 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3335 trace
3336 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3337 ,p_level => C_LEVEL_EXCEPTION
3338 ,p_module => l_log_module);
3339 END IF;
3340 RAISE;
3341 WHEN OTHERS THEN
3342 xla_exceptions_pkg.raise_message
3343 (p_location => 'XLA_CMP_EVENT_TYPE_PKG. GenerateReversalAcctgSources');
3344 END GenerateReversalAcctgSources;
3345
3346 /*---------------------------------------------------------------+
3347 | |
3348 | Private function |
3349 | |
3350 | GenerateAcctLinetypes |
3351 | |
3352 | Generates in EventClass_x()/EventType_x() the calls to Journal |
3353 | Line Types procedures/ AcctLineType_xxx() |
3354 | |
3355 +---------------------------------------------------------------*/
3356
3357 FUNCTION GenerateAcctLinetypes (
3358 p_array_alt_index IN xla_cmp_source_pkg.t_array_ByInt
3359 , p_array_evt_source_Level IN xla_cmp_source_pkg.t_array_VL1
3360 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
3361 , p_rec_sources IN xla_cmp_source_pkg.t_rec_sources
3362 )
3363 RETURN CLOB
3364 IS
3365
3366 C_ALT_PROC CONSTANT VARCHAR2(10000):= '
3367 --
3368 AcctLineType_$alt_code$ (
3369 p_application_id => p_application_id
3370 ,p_event_id => l_event_id
3371 ,p_calculate_acctd_flag => l_calculate_acctd_flag
3372 ,p_calculate_g_l_flag => l_calculate_g_l_flag
3373 ,p_actual_flag => l_actual_flag
3374 ,p_balance_type_code => l_balance_type_code
3375 ,p_gain_or_loss_ref=> l_gain_or_loss_ref
3376 $parameters$
3377 );
3378 If(l_balance_type_code = ''A'') THEN
3379 l_actual_gain_loss_ref := l_gain_or_loss_ref;
3380 END IF;
3381
3382 --
3383 ';
3384
3385 l_alts CLOB;
3386 l_alt CLOB;
3387 l_log_module VARCHAR2(240);
3388 BEGIN
3389 IF g_log_enabled THEN
3390 l_log_module := C_DEFAULT_MODULE||'.GenerateAcctLinetypes';
3391 END IF;
3392 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3393 trace
3394 (p_msg => 'BEGIN of GenerateAcctLinetypes'
3395 ,p_level => C_LEVEL_PROCEDURE
3396 ,p_module => l_log_module);
3397
3398 END IF;
3399
3400 l_alts := ' l_actual_flag := NULL; l_actual_gain_loss_ref := ''#####'';';
3401 l_alt := NULL;
3402
3403 IF p_array_alt_index.COUNT > 0 THEN
3404
3405 FOR Idx IN p_array_alt_index.FIRST .. p_array_alt_index.LAST LOOP
3406
3407 IF p_array_alt_index.EXISTS(Idx) THEN
3408
3409 l_alt := C_ALT_PROC ;
3410 l_alt := xla_cmp_string_pkg.replace_token(l_alt ,'$alt_code$', TO_CHAR( p_array_alt_index(Idx) )); -- 4417664
3411
3412 l_alt := xla_cmp_string_pkg.replace_token (l_alt ,'$parameters$'
3413 ,xla_cmp_call_fct_pkg.GetLineParameters(
3414 p_array_source_index => p_rec_aad_objects.array_array_object(p_array_alt_index(Idx))
3415 , p_array_source_level => p_array_evt_source_Level
3416 , p_rec_sources => p_rec_sources)
3417 );
3418 l_alts := l_alts || g_chr_newline|| l_alt;
3419
3420 END IF;
3421
3422 END LOOP;
3423
3424 END IF;
3425
3426 IF l_alts IS NULL THEN l_alts:=' null;';END IF;
3427
3428 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3429 trace
3430 (p_msg => 'END of GenerateAcctLinetypes'
3431 ,p_level => C_LEVEL_PROCEDURE
3432 ,p_module => l_log_module);
3433 END IF;
3434 RETURN l_alts;
3435 EXCEPTION
3436 WHEN VALUE_ERROR THEN
3437 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3438 trace
3439 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3440 ,p_level => C_LEVEL_EXCEPTION
3441 ,p_module => l_log_module);
3442 END IF;
3443 RAISE;
3444 WHEN xla_exceptions_pkg.application_exception THEN
3445 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3446 trace
3447 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3448 ,p_level => C_LEVEL_EXCEPTION
3449 ,p_module => l_log_module);
3450 END IF;
3451 RAISE;
3452 WHEN OTHERS THEN
3453 xla_exceptions_pkg.raise_message
3454 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateAcctLinetypes ');
3455 END GenerateAcctLinetypes;
3456
3457
3458
3459 /*---------------------------------------------------------------+
3460 | |
3461 | Private function |
3462 | |
3463 | GenerateAccRevBody |
3464 | |
3465 | 4262811 - |
3466 | Retrieve the source of the accrual reversal GL date |
3467 | accounting attribute. |
3468 | |
3469 | 4884853 - add logic to get array_gl_date for accrual reversal|
3470 | |
3471 +---------------------------------------------------------------*/
3472 FUNCTION GenerateAccRevBody (
3473 p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
3474 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int -- (to generate ACCRUAL_REVERSAL_GL_DATE)
3475 , p_rec_sources IN xla_cmp_source_pkg.t_rec_sources
3476 )
3477 RETURN CLOB
3478 IS
3479
3480 l_body CLOB;
3481 l_log_module VARCHAR2(240);
3482
3483 l_AccRevGlDateIdx NUMBER;
3484 l_source_code VARCHAR2(30);
3485 l_source_type_code VARCHAR2(1);
3486
3487 BEGIN
3488
3489 IF g_log_enabled THEN
3490 l_log_module := C_DEFAULT_MODULE||'.GenerateAccRevBody';
3491 END IF;
3492 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3493 trace
3494 (p_msg => 'BEGIN of GenerateAccRevBody'
3495 ,p_level => C_LEVEL_PROCEDURE
3496 ,p_module => l_log_module);
3497 END IF;
3498
3499 l_body := NULL;
3500 l_AccRevGlDateIdx := IsOptionFlagInEventExtract(
3501 p_source_option => 'ACCRUAL_REVERSAL_GL_DATE' -- value in this attr indicates to reverse
3502 , p_array_source_code => p_array_hdr_acctg_source);
3503
3504
3505 IF (l_AccRevGlDateIdx IS NULL) THEN
3506 l_body := '
3507 -----------------------------------------------
3508 -- No accrual reversal for the event class/type
3509 -----------------------------------------------';
3510 ELSE
3511
3512 l_body := C_ACC_REV_BODY;
3513 -- l_source_type_code := p_rec_sources.array_source_type_code(l_AccRevGlDateIdx);
3514 -- l_source_code := p_rec_sources.array_source_code(l_AccRevGlDateIdx);
3515 l_source_type_code := p_rec_sources.array_source_type_code(p_array_hdr_acct_attr_source(l_AccRevGlDateIdx));
3516 l_source_code := p_rec_sources.array_source_code (p_array_hdr_acct_attr_source(l_AccRevGlDateIdx));
3517
3518 IF (l_source_type_code = 'Y' and l_source_code = 'XLA_NEXT_DAY') THEN
3519 l_body := xla_cmp_string_pkg.replace_token (l_body,'$if_cond$','');
3520 l_body := xla_cmp_string_pkg.replace_token (l_body,'$end_if$', '');
3521 l_body := xla_cmp_string_pkg.replace_token (l_body,'$accrual_reversal_body2$'
3522 ,'
3523 ---------------------- XLA_NEXT_DAY ----------------------
3524 XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx) := ''XLA_NEXT_DAY'';
3525 XLA_AE_HEADER_PKG.GetAccrualRevDate(g_last_hdr_idx
3526 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_target_ledger_id(g_last_hdr_idx)
3527 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx)
3528 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx));
3529 ');
3530 ELSIF (l_source_type_code = 'Y' and l_source_code = 'XLA_FIRST_DAY_NEXT_GL_PERIOD') THEN
3531 l_body := xla_cmp_string_pkg.replace_token (l_body,'$if_cond$','');
3532 l_body := xla_cmp_string_pkg.replace_token (l_body,'$accrual_reversal_body2$'
3533 ,'
3534 ---------------------- XLA_FIRST_DAY_NEXT_GL_PERIOD ----------------------
3535 XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx) := ''XLA_FIRST_DAY_NEXT_GL_PERIOD'';
3536 XLA_AE_HEADER_PKG.GetAccrualRevDate(g_last_hdr_idx
3537 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_target_ledger_id(g_last_hdr_idx)
3538 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx)
3539 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx));
3540 ');
3541 l_body := xla_cmp_string_pkg.replace_token (l_body,'$end_if$', '');
3542
3543 ELSIF (l_source_type_code = 'Y' and l_source_code = 'XLA_LAST_DAY_NEXT_GL_PERIOD') THEN
3544 l_body := xla_cmp_string_pkg.replace_token (l_body,'$if_cond$','');
3545 l_body := xla_cmp_string_pkg.replace_token (l_body,'$accrual_reversal_body2$'
3546 ,'
3547 ---------------------- XLA_LAST_DAY_NEXT_GL_PERIOD ----------------------
3548 XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx) := ''XLA_LAST_DAY_NEXT_GL_PERIOD'';
3549 XLA_AE_HEADER_PKG.GetAccrualRevDate(g_last_hdr_idx
3550 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_target_ledger_id(g_last_hdr_idx)
3551 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx)
3552 ,XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx));
3553 ');
3554 l_body := xla_cmp_string_pkg.replace_token (l_body,'$end_if$', '');
3555
3556 ELSE
3557 l_body := xla_cmp_string_pkg.replace_token (l_body ,'$if_cond$' ,'IF l_acc_rev_gl_date_source IS NOT NULL THEN ');
3558 l_body := xla_cmp_string_pkg.replace_token (l_body,'$accrual_reversal_body2$'
3559 ,'
3560 ---------------------- NONE - Standard Source ----------------------
3561 IF l_acc_rev_gl_date_source < XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx) THEN
3562 xla_accounting_err_pkg.build_message
3563 (p_appli_s_name => ''XLA''
3564 ,p_msg_name => ''XLA_MA_INVALID_GL_DATE''
3565 ,p_token_1 => ''ACCRUAL_REVERSAL_DATE''
3566 ,p_value_1 => l_acc_rev_gl_date_source
3567 ,p_token_2 => ''ACCRUAL_GL_DATE'' -- 4262811
3568 ,p_value_2 => XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(hdr_idx)
3569 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
3570 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
3571 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
3572 );
3573 END IF;
3574 XLA_AE_HEADER_PKG.g_rec_header_new.array_acc_rev_gl_date_option(g_last_hdr_idx) := ''NONE'';
3575 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_last_hdr_idx) := trunc(l_acc_rev_gl_date_source);
3576 ');
3577 l_body := xla_cmp_string_pkg.replace_token (l_body ,'$end_if$' , 'END IF;');
3578
3579 END IF;
3580 END IF;
3581 RETURN l_body;
3582
3583 EXCEPTION
3584 WHEN VALUE_ERROR THEN
3585 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3586 trace
3587 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3588 ,p_level => C_LEVEL_EXCEPTION
3589 ,p_module => l_log_module);
3590 END IF;
3591 RAISE;
3592 WHEN xla_exceptions_pkg.application_exception THEN
3593 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3594 trace
3595 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3596 ,p_level => C_LEVEL_EXCEPTION
3597 ,p_module => l_log_module);
3598 END IF;
3599 RAISE;
3600 WHEN OTHERS THEN
3601 xla_exceptions_pkg.raise_message
3602 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateAccRevBody ');
3603 END GenerateAccRevBody;
3604
3605
3606 /*---------------------------------------------------------------+
3607 | |
3608 | Private function |
3609 | |
3610 | GenerateProcedureBody |
3611 | |
3612 | Generates EventClass_x()/EventType_x() body function |
3613 | |
3614 +---------------------------------------------------------------*/
3615
3616 FUNCTION GenerateProcedureBody (
3617 p_application_id IN NUMBER
3618 , p_product_rule_code IN VARCHAR2
3619 , p_product_rule_type_code IN VARCHAR2
3620 , p_amb_context_code IN VARCHAR2
3621 , p_entity IN VARCHAR2
3622 , p_event_class IN VARCHAR2
3623 , p_event_type IN VARCHAR2
3624
3625 , p_hdr_description_index IN BINARY_INTEGER
3626 , p_array_alt_index IN xla_cmp_source_pkg.t_array_ByInt
3627 , p_array_evt_source_Level IN xla_cmp_source_pkg.t_array_VL1
3628
3629 , p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
3630 , p_array_hdr_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
3631 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
3632 , p_array_line_acctg_source IN xla_cmp_source_pkg.t_array_VL30
3633 , p_array_line_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
3634 , p_array_line_acct_attr_source IN xla_cmp_source_pkg.t_array_int
3635
3636 , p_array_table_name IN xla_cmp_source_pkg.t_array_VL30
3637 , p_array_table_type IN xla_cmp_source_pkg.t_array_VL30
3638 , p_array_table_hash IN xla_cmp_source_pkg.t_array_VL30
3639 , p_array_populated_flag IN xla_cmp_source_pkg.t_array_VL1
3640
3641 , p_array_h_source_index IN xla_cmp_source_pkg.t_array_ByInt
3642 , p_array_h_table_index IN xla_cmp_source_pkg.t_array_ByInt
3643
3644 , p_array_h_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
3645 , p_array_h_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
3646
3647 , p_array_l_source_index IN xla_cmp_source_pkg.t_array_ByInt
3648 , p_array_l_table_index IN xla_cmp_source_pkg.t_array_ByInt
3649
3650 , p_array_l_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
3651 , p_array_l_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
3652
3653 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
3654 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
3655 )
3656 RETURN CLOB
3657 IS
3658
3659 l_body CLOB;
3660 l_ThirdPartyIdx NUMBER;
3661 l_AcctReversalIdx NUMBER;
3662 l_TrxReversalIdx NUMBER;
3663 l_count INTEGER;
3664 l_log_module VARCHAR2(240);
3665
3666 BEGIN
3667 IF g_log_enabled THEN
3668 l_log_module := C_DEFAULT_MODULE||'.GenerateProcedureBody';
3669 END IF;
3670 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3671 trace
3672 (p_msg => 'BEGIN of GenerateProcedureBody'
3673 ,p_level => C_LEVEL_PROCEDURE
3674 ,p_module => l_log_module);
3675 trace
3676 (p_msg => 'event class:'||p_event_class
3677 ||', event type:'||p_event_type
3678 ,p_level => C_LEVEL_PROCEDURE
3679 ,p_module => l_log_module);
3680
3681 END IF;
3682
3683 GetIndexOfOptionFlags(
3684 p_array_hdr_acctg_source => p_array_hdr_acctg_source
3685 , p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
3686 , p_array_line_acctg_source => p_array_line_acctg_source
3687 , p_array_line_acct_attr_source => p_array_line_acct_attr_source
3688 , p_ThirdPartyIdx => l_ThirdPartyIdx
3689 , p_AcctReversalIdx => l_AcctReversalIdx
3690 , p_TrxReversalIdx => l_TrxReversalIdx);
3691
3692 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3693 trace
3694 (p_msg => 'l_ThirdPartyIdx = '||l_ThirdPartyIdx
3695 ||', l_AcctReversalIdx = '||l_AcctReversalIdx
3696 ||', l_TrxReversalIdx = '||l_TrxReversalIdx
3697 ,p_level => C_LEVEL_STATEMENT
3698 ,p_module => l_log_module);
3699 END IF;
3700
3701 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3702 l_count := p_array_h_source_index.COUNT + p_array_h_mls_source_index.COUNT;
3703 trace
3704 (p_msg => 'generate = '||l_count
3705 ,p_level => C_LEVEL_STATEMENT
3706 ,p_module => l_log_module);
3707 END IF;
3708
3709 l_body := C_EVENT_BODY;
3710
3711 --bug 4492149
3712 --IF (p_array_h_source_index.COUNT + p_array_h_mls_source_index.COUNT > 0) THEN
3713
3714 IF l_ThirdPartyIdx IS NOT NULL AND
3715 p_array_hdr_acct_attr_source.EXISTS(l_ThirdPartyIdx) AND
3716 p_array_hdr_acct_attr_source(l_ThirdPartyIdx) IS NOT NULL THEN
3717 --
3718 -- Change third party process
3719 --
3720 l_body := xla_cmp_string_pkg.replace_token
3721 (l_body,'$third_party_code$', C_THIRD_PARTY_CHANGE_BODY);
3722
3723 l_body := xla_cmp_string_pkg.replace_token(l_body
3724 ,'$third_party_change$'
3725 , xla_cmp_source_pkg.GenerateSource(
3726 p_Index => p_array_hdr_acct_attr_source(l_ThirdPartyIdx)
3727 , p_rec_sources => p_rec_sources
3728 , p_variable => p_array_hdr_acctg_source_type(l_ThirdPartyIdx)
3729 , p_translated_flag => 'N'
3730 ));
3731 ELSE
3732 l_body := xla_cmp_string_pkg.replace_token(l_body -- 4417664
3733 ,'$third_party_code$'
3734 ,'-- No Third Party Code generated');
3735 END IF;
3736
3737
3738 IF l_TrxReversalIdx IS NOT NULL AND
3739 p_array_hdr_acct_attr_source.EXISTS(l_TrxReversalIdx) AND
3740 p_array_hdr_acct_attr_source(l_TrxReversalIdx) IS NOT NULL
3741 THEN
3742 l_body := xla_cmp_string_pkg.replace_token
3743 (l_body,'$trx_reversal_source$'
3744 ,xla_cmp_source_pkg.GenerateSource(
3745 p_Index => p_array_hdr_acct_attr_source(l_TrxReversalIdx)
3746 ,p_rec_sources => p_rec_sources
3747 ,p_variable => p_array_hdr_acctg_source_type(l_TrxReversalIdx)
3748 ,p_translated_flag => 'N')
3749 );
3750
3751 ELSE
3752 l_body := xla_cmp_string_pkg.replace_token(l_body,'$trx_reversal_source$','NULL'); -- 4417664
3753 END IF;
3754
3755 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3756 trace
3757 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateFetchHeaderCursor API'
3758 ,p_level => C_LEVEL_STATEMENT
3759 ,p_module => l_log_module);
3760 END IF;
3761 --
3762 -- generate 'Open header cursor'
3763 --
3764 l_body := xla_cmp_string_pkg.replace_token
3765 (l_body
3766 ,'$header_var$'
3767 ,xla_cmp_extract_pkg.GenerateFetchHeaderCursor
3768 (p_array_h_source_index => p_array_h_source_index
3769 ,p_array_h_mls_source_index => p_array_h_mls_source_index
3770 ,p_array_lookup_type => p_rec_sources.array_lookup_type
3771 ,p_array_view_application_id => p_rec_sources.array_view_application_id)
3772 );
3773
3774 --
3775 -- generate the code to cache header sources
3776 l_body := xla_cmp_string_pkg.replace_token
3777 (l_body
3778 ,'$cache_header_sources$'
3779 ,xla_cmp_extract_pkg.GenerateCacheHdrSources
3780 (p_array_h_source_index => p_array_h_source_index
3781 ,p_array_h_mls_source_index => p_array_h_mls_source_index
3782 ,p_array_lookup_type => p_rec_sources.array_lookup_type
3783 ,p_array_view_application_id => p_rec_sources.array_view_application_id
3784 ,p_array_datatype_code => p_rec_sources.array_datatype_code)
3785 );
3786
3787 -- generate 'header accounting sources'
3788 --
3789 l_body := xla_cmp_string_pkg.replace_token
3790 (l_body
3791 ,'$hdr_accounting_attributes$'
3792 ,REPLACE(GenerateHdrAcctgSources
3793 (p_array_hdr_acctg_source => p_array_hdr_acctg_source
3794 ,p_array_hdr_acctg_source_type => p_array_hdr_acctg_source_type
3795 ,p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
3796 ,p_rec_sources => p_rec_sources), '(Idx)', '(hdr_idx)')
3797 ); --7046458 Replaced Idx with hdr_idx.
3798
3799 -------------------------------------------------------------------
3800 -- 4262811 Generate Accrual Reversal
3801 -------------------------------------------------------------------
3802 l_body := xla_cmp_string_pkg.replace_token
3803 (l_body
3804 ,'$accrual_reversal_body$'
3805 ,GenerateAccRevBody(
3806 p_array_hdr_acctg_source => p_array_hdr_acctg_source
3807 ,p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
3808 ,p_rec_sources => p_rec_sources
3809 ));
3810 --
3811 -- generate 'header Description'
3812 --
3813 l_body := xla_cmp_string_pkg.replace_token
3814 (l_body
3815 ,'$call_header_description$'
3816 , GenerateHdrDescription (
3817 p_hdr_description_index => p_hdr_description_index
3818 , p_rec_aad_objects => p_rec_aad_objects
3819 , p_rec_sources => p_rec_sources
3820 )
3821 );
3822
3823 --
3824 -- generate 'header Analytical criteria'
3825 --
3826 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3827 trace
3828 (p_msg => '-> CALL xla_cmp_analytic_criteria_pkg.GenerateHdrAnalyticCriteria API'
3829 ,p_level => C_LEVEL_STATEMENT
3830 ,p_module => l_log_module);
3831 END IF;
3832
3833 l_body := xla_cmp_string_pkg.replace_token
3834 (l_body
3835 ,'$call_hdr_analytic_criteria$'
3836 ,xla_cmp_analytic_criteria_pkg.GenerateHdrAnalyticCriteria
3837 (p_application_id => p_application_id
3838 ,p_product_rule_code => p_product_rule_code
3839 ,p_product_rule_type_code => p_product_rule_type_code
3840 ,p_amb_context_code => p_amb_context_code
3841 ,p_entity => p_entity
3842 ,p_event_class => p_event_class
3843 ,p_event_type => p_event_type
3844 ,p_rec_sources => p_rec_sources)
3845 );
3846
3847 --END IF;
3848
3849 --bug 4492149
3850 --IF (p_array_l_source_index.COUNT + p_array_l_mls_source_index.COUNT > 0 ) THEN
3851 l_body := xla_cmp_string_pkg.replace_token
3852 (l_body
3853 ,'$lines_body$'
3854 ,C_BODY_LINES);
3855
3856 l_body := xla_cmp_string_pkg.replace_token
3857 (l_body
3858 ,'$gain_loss_account_params$'
3859 ,GenerateGainLossAcctSources
3860 (p_array_hdr_acctg_source => p_array_hdr_acctg_source
3861 ,p_array_hdr_acctg_source_type => p_array_hdr_acctg_source_type
3862 ,p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
3863 ,p_rec_sources => p_rec_sources)
3864 );
3865
3866 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3867 trace
3868 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateFetchLineCursor API'
3869 ,p_level => C_LEVEL_STATEMENT
3870 ,p_module => l_log_module);
3871 END IF;
3872 --
3873 -- Generate 'Open Line cursor'
3874 --
3875 l_body := xla_cmp_string_pkg.replace_token
3876 (l_body
3877 ,'$line_var$'
3878 ,xla_cmp_extract_pkg.GenerateFetchLineCursor
3879 (p_array_l_source_index => p_array_l_source_index
3880 ,p_array_l_mls_source_index => p_array_l_mls_source_index
3881 ,p_array_source_code => p_rec_sources.array_source_code
3882 ,p_array_lookup_type => p_rec_sources.array_lookup_type
3883 ,p_array_view_application_id => p_rec_sources.array_view_application_id)
3884 );
3885 --
3886 -- generate 'Accounting line type procedures'
3887 --
3888 l_body := xla_cmp_string_pkg.replace_token
3889 (l_body
3890 ,'$call_alts$'
3891 , GenerateAcctLinetypes (
3892 p_array_alt_index => p_array_alt_index
3893 , p_array_evt_source_Level => p_array_evt_source_Level
3894 , p_rec_aad_objects => p_rec_aad_objects
3895 , p_rec_sources => p_rec_sources
3896 )
3897 );
3898 --
3899 -- replace amb_context_code
3900 --
3901 l_body := xla_cmp_string_pkg.replace_token
3902 (l_body
3903 ,'$amb_context_code$'
3904 , p_amb_context_code
3905 );
3906 --
3907 -- generate line level reversal code
3908 --
3909
3910 IF l_AcctReversalIdx IS NOT NULL OR
3911 p_array_line_acct_attr_source.EXISTS(l_AcctReversalIdx) AND
3912 p_array_line_acct_attr_source(l_AcctReversalIdx) IS NOT NULL
3913 THEN
3914 l_body := xla_cmp_string_pkg.replace_token -- 4417664
3915 (l_body,'$acct_reversal_source$'
3916 , xla_cmp_source_pkg.GenerateSource
3917 (p_Index => p_array_line_acct_attr_source(l_AcctReversalIdx)
3918 ,p_rec_sources => p_rec_sources
3919 ,p_variable => p_array_line_acctG_source_type(l_AcctReversalIdx)
3920 ,p_translated_flag => 'N')
3921 );
3922
3923
3924 l_body := xla_cmp_string_pkg.replace_token
3925 (l_body,'$acct_reversal_code$'
3926 ,GenerateReversalAcctgSources
3927 (p_array_line_acctg_source => p_array_line_acctg_source
3928 ,p_array_line_acctg_source_type => p_array_line_acctg_source_type
3929 ,p_array_line_acct_attr_source => p_array_line_acct_attr_source
3930 ,p_rec_sources => p_rec_sources)
3931 );
3932 ELSE
3933 l_body := xla_cmp_string_pkg.replace_token(l_body,'$acct_reversal_source$','NULL'); -- 4417664
3934 l_body := xla_cmp_string_pkg.replace_token(l_body,'$acct_reversal_code$',' -- No reversal code generated'); -- 4417664
3935 END IF;
3936
3937
3938 --END IF;
3939
3940 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3941 trace
3942 (p_msg => 'END of GenerateProcedureBody'
3943 ,p_level => C_LEVEL_PROCEDURE
3944 ,p_module => l_log_module);
3945 trace
3946 (p_msg => 'l_body:'||to_char(length(l_body))
3947 ,p_level => C_LEVEL_PROCEDURE
3948 ,p_module => l_log_module);
3949 END IF;
3950 RETURN l_body;
3951 EXCEPTION
3952 WHEN VALUE_ERROR THEN
3953 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3954 trace
3955 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3956 ,p_level => C_LEVEL_EXCEPTION
3957 ,p_module => l_log_module);
3958 END IF;
3959 RAISE;
3960 WHEN xla_exceptions_pkg.application_exception THEN
3961 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3962 trace
3963 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
3964 ,p_level => C_LEVEL_EXCEPTION
3965 ,p_module => l_log_module);
3966 END IF;
3967 RAISE;
3968 WHEN OTHERS THEN
3969 xla_exceptions_pkg.raise_message
3970 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateProcedureBody ');
3971 END GenerateProcedureBody;
3972
3973 /*---------------------------------------------------------------+
3974 | |
3975 | Private function |
3976 | |
3977 | PopulateBCObjectNames |
3978 | |
3979 | Generates Event_$Index$() function |
3980 | |
3981 +---------------------------------------------------------------*/
3982
3983 PROCEDURE PopulateBCObjectNames(
3984 p_array_table_name IN OUT NOCOPY xla_cmp_source_pkg.t_array_VL30,
3985 p_array_join_condition IN OUT NOCOPY xla_cmp_source_pkg.t_array_VL2000
3986 )
3987 IS
3988 l_log_module VARCHAR2(240);
3989 BEGIN
3990
3991 IF g_log_enabled THEN
3992 l_log_module := C_DEFAULT_MODULE||'.PopulateBCObjectNames';
3993 END IF;
3994 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3995 trace
3996 (p_msg => 'BEGIN of PopulateBCObjectNames'
3997 ,p_level => C_LEVEL_PROCEDURE
3998 ,p_module => l_log_module);
3999 END IF;
4000
4001 For idx in 1..p_array_table_name.COUNT loop
4002 IF p_array_table_name(idx) = 'AP_INVOICE_EXTRACT_DETAILS_V' THEN
4003 P_array_table_name(idx) := 'AP_EXTRACT_INVOICE_DTLS_BC_V';
4004 ELSIF p_array_table_name(idx) = 'AP_PREPAYAPP_EXTRACT_DETAILS_V' THEN
4005 P_array_table_name(idx) := 'AP_PREPAYAPP_EXTRACT_DTLS_BC_V';
4006 END IF;
4007 End loop;
4008
4009 For idx in 1..p_array_join_condition.COUNT loop
4010 p_array_join_condition(idx) := replace(p_array_join_condition(idx)
4011 ,'AP_INVOICE_EXTRACT_DETAILS_V'
4012 ,'AP_EXTRACT_INVOICE_DTLS_BC_V');
4013 p_array_join_condition(idx) := replace(p_array_join_condition(idx)
4014 ,'AP_PREPAYAPP_EXTRACT_DETAILS_V'
4015 ,'AP_PREPAYAPP_EXTRACT_DTLS_BC_V');
4016 End loop;
4017
4018 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4019 trace
4020 (p_msg => 'END of PopulateBCObjectNames'
4021 ,p_level => C_LEVEL_PROCEDURE
4022 ,p_module => l_log_module);
4023 END IF;
4024 EXCEPTION
4025 WHEN OTHERS THEN
4026 xla_exceptions_pkg.raise_message
4027 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.PopulateBCObjectNames ');
4028 END PopulateBCObjectNames;
4029
4030
4031
4032 /*---------------------------------------------------------------+
4033 | |
4034 | Private function |
4035 | |
4036 | GenerateOneProcedure |
4037 | |
4038 | Generates Event_$Index$() function |
4039 | |
4040 +---------------------------------------------------------------*/
4041
4042 FUNCTION GenerateOneProcedure (
4043 p_application_id IN NUMBER
4044 , p_product_rule_code IN VARCHAR2
4045 , p_product_rule_type_code IN VARCHAR2
4046 , p_amb_context_code IN VARCHAR2
4047 , p_entity IN VARCHAR2
4048 , p_event_class IN VARCHAR2
4049 , p_event_type IN VARCHAR2
4050 --
4051 , p_hdr_description_index IN BINARY_INTEGER
4052 , p_array_alt_index IN xla_cmp_source_pkg.t_array_ByInt
4053 , p_array_evt_source_Level IN xla_cmp_source_pkg.t_array_VL1
4054 --
4055 , p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
4056 , p_array_hdr_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
4057 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
4058 , p_array_line_acctg_source IN xla_cmp_source_pkg.t_array_VL30
4059 , p_array_line_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
4060 , p_array_line_acct_attr_source IN xla_cmp_source_pkg.t_array_int
4061 --
4062 , p_array_table_name IN xla_cmp_source_pkg.t_array_VL30
4063 , p_array_parent_table_index IN xla_cmp_source_pkg.t_array_ByInt
4064 , p_array_table_type IN xla_cmp_source_pkg.t_array_VL30
4065 , p_array_table_hash IN xla_cmp_source_pkg.t_array_VL30
4066 , p_array_populated_flag IN xla_cmp_source_pkg.t_array_VL1
4067 --
4068 , p_array_ref_obj_flag IN xla_cmp_source_pkg.t_array_VL1
4069 , p_array_join_condition IN xla_cmp_source_pkg.t_array_VL2000
4070 --
4071 , p_array_h_source_index IN xla_cmp_source_pkg.t_array_ByInt
4072 , p_array_h_table_index IN xla_cmp_source_pkg.t_array_ByInt
4073 --
4074 , p_array_h_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
4075 , p_array_h_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
4076 --
4077 , p_array_l_source_index IN xla_cmp_source_pkg.t_array_ByInt
4078 , p_array_l_table_index IN xla_cmp_source_pkg.t_array_ByInt
4079 --
4080 , p_array_l_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
4081 , p_array_l_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
4082 --
4083 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
4084 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
4085 --
4086 , p_extract_status IN BOOLEAN
4087 , p_procedure IN VARCHAR2
4088 )
4089 RETURN CLOB
4090 IS
4091 l_event CLOB;
4092 l_log_module VARCHAR2(240);
4093 BEGIN
4094
4095 IF g_log_enabled THEN
4096 l_log_module := C_DEFAULT_MODULE||'.GenerateOneProcedure';
4097 END IF;
4098 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4099 trace
4100 (p_msg => 'BEGIN of GenerateOneProcedure'
4101 ,p_level => C_LEVEL_PROCEDURE
4102 ,p_module => l_log_module);
4103 END IF;
4104
4105 l_event := C_EVENT_TYPE_PROC;
4106
4107 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4108 trace
4109 (p_msg => 'p_extract_status = '||
4110 CASE WHEN p_extract_status THEN 'TRUE' ELSE 'FALSE' END
4111 ,p_level => C_LEVEL_STATEMENT
4112 ,p_module => l_log_module);
4113 END IF;
4114
4115 IF NOT p_extract_status THEN
4116
4117 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_types$', ' '); -- 4417664
4118 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_types$', ' '); -- 4417664
4119 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_variables$' , ' '); -- 4417664
4120 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_variables$' , ' '); -- 4417664
4121 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_cursor$', ' '); -- 4417664
4122 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_cursor$' , ' '); -- 4417664
4123 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_header_cursor$', ' ' ); -- 4417664
4124 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_line_cursor$', ' ' ); -- 4417664
4125 l_event := xla_cmp_string_pkg.replace_token (l_event, '$event_body$' , 'NULL;'); -- 4417664
4126
4127 l_event := xla_cmp_string_pkg.replace_token (l_event, '$no_data_exception$', ' ' ); -- 4417664
4128
4129 ELSE
4130
4131 l_event := xla_cmp_string_pkg.replace_token
4132 (l_event
4133 ,'$event_body$'
4134 ,GenerateProcedureBody
4135 (p_application_id => p_application_id
4136 ,p_product_rule_code => p_product_rule_code
4137 ,p_product_rule_type_code => p_product_rule_type_code
4138 ,p_amb_context_code => p_amb_context_code
4139 ,p_entity => p_entity
4140 ,p_event_class => p_event_class
4141 ,p_event_type => p_event_type
4142 --
4143 ,p_hdr_description_index => p_hdr_description_index
4144 ,p_array_alt_index => p_array_alt_index
4145 , p_array_evt_source_Level => p_array_evt_source_Level
4146 --
4147 ,p_array_hdr_acctg_source => p_array_hdr_acctg_source
4148 ,p_array_hdr_acctg_source_type => p_array_hdr_acctg_source_type
4149 ,p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
4150 ,p_array_line_acctg_source => p_array_line_acctg_source
4151 ,p_array_line_acctg_source_type => p_array_line_acctg_source_type
4152 ,p_array_line_acct_attr_source => p_array_line_acct_attr_source
4153 --
4154 ,p_array_table_name => p_array_table_name
4155 ,p_array_table_type => p_array_table_type
4156 ,p_array_table_hash => p_array_table_hash
4157 ,p_array_populated_flag => p_array_populated_flag
4158 --
4159 ,p_array_h_source_index => p_array_h_source_index
4160 ,p_array_h_table_index => p_array_h_table_index
4161 --
4162 ,p_array_h_mls_source_index => p_array_h_mls_source_index
4163 ,p_array_h_mls_table_index => p_array_h_mls_table_index
4164 --
4165 ,p_array_l_source_index => p_array_l_source_index
4166 ,p_array_l_table_index => p_array_l_table_index
4167 --
4168 ,p_array_l_mls_source_index => p_array_l_mls_source_index
4169 ,p_array_l_mls_table_index => p_array_l_mls_table_index
4170 --
4171 ,p_rec_sources => p_rec_sources
4172 ,p_rec_aad_objects => p_rec_aad_objects)
4173 );
4174
4175 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4176
4177 trace
4178 (p_msg => 'after generateprocedurebody length of l_event:'||to_char(length(l_event))
4179 ,p_level => C_LEVEL_PROCEDURE
4180 ,p_module => l_log_module);
4181
4182 END IF;
4183
4184 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4185 trace
4186 (p_msg => 'COUNT: p_array_h_source_index = '||p_array_h_source_index.COUNT
4187 ||', p_array_h_mls_source_index = '||p_array_h_mls_source_index.COUNT
4188 ,p_level => C_LEVEL_STATEMENT
4189 ,p_module => l_log_module);
4190 END IF;
4191
4192 -- generate the declaration of header variables and header cursor
4193 --
4194 /* --4492149
4195 IF (p_array_h_source_index.COUNT + p_array_h_mls_source_index.COUNT > 0
4196 ) THEN
4197 */
4198 --
4199 -- generate array strucnture definitions for header sources
4200 --
4201 l_event :=
4202 xla_cmp_string_pkg.replace_token
4203 (l_event, '$header_types$'
4204 ,xla_cmp_extract_pkg.GenerateHdrStructure
4205 (p_array_table_name => p_array_table_name
4206 ,p_array_source_code => p_rec_sources.array_source_code
4207 ,p_array_h_source_index => p_array_h_source_index
4208 ,p_array_h_table_index => p_array_h_table_index
4209 ,p_array_h_mls_source_index => p_array_h_mls_source_index
4210 ,p_array_h_mls_table_index => p_array_h_mls_table_index)
4211 );
4212
4213 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4214 trace
4215 (p_msg => 'after GenerateHdrStructure length of l_event = '||to_char(length(l_event))
4216 ,p_level => C_LEVEL_PROCEDURE
4217 ,p_module => l_log_module);
4218 END IF;
4219 --
4220 -- generate the declaration of header variables
4221 --
4222 l_event :=
4223 xla_cmp_string_pkg.replace_token
4224 (l_event, '$header_variables$'
4225 ,xla_cmp_extract_pkg.GenerateHdrVariables
4226 (p_array_h_source_index => p_array_h_source_index
4227 ,p_array_h_mls_source_index => p_array_h_mls_source_index
4228 ,p_array_source_code => p_rec_sources.array_source_code
4229 ,p_array_lookup_type => p_rec_sources.array_lookup_type
4230 ,p_array_view_application_id => p_rec_sources.array_view_application_id)
4231 );
4232
4233 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4234 trace
4235 (p_msg => 'after GenerateHdrVariables length of l_event = '||to_char(length(l_event))
4236 ,p_level => C_LEVEL_PROCEDURE
4237 ,p_module => l_log_module);
4238 END IF;
4239
4240 --
4241 -- generate the header cursor
4242 --
4243 l_event := xla_cmp_string_pkg.replace_token
4244 (l_event
4245 ,'$header_cursor$'
4246 ,XLA_cmp_extract_pkg.GenerateHeaderCursor
4247 (p_array_table_name => p_array_table_name
4248 ,p_array_parent_table_index => p_array_parent_table_index
4249 ,p_array_table_hash => p_array_table_hash
4250 ,p_array_populated_flag => p_array_populated_flag
4251 ,p_array_ref_obj_flag => p_array_ref_obj_flag
4252 ,p_array_join_condition => p_array_join_condition
4253 ,p_array_h_source_index => p_array_h_source_index
4254 ,p_array_h_table_index => p_array_h_table_index
4255 ,p_array_h_mls_source_index => p_array_h_mls_source_index
4256 ,p_array_h_mls_table_index => p_array_h_mls_table_index
4257 ,p_array_source_code => p_rec_sources.array_source_code
4258 ,p_array_lookup_type => p_rec_sources.array_lookup_type
4259 ,p_array_view_application_id => p_rec_sources.array_view_application_id
4260 ,p_procedure => p_procedure)
4261 );
4262
4263 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4264
4265 trace
4266 (p_msg => 'after generateheadercursor length of l_event:'||to_char(length(l_event))
4267 ,p_level => C_LEVEL_PROCEDURE
4268 ,p_module => l_log_module);
4269
4270 END IF;
4271 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_header_cursor$', C_CLOSE_HEADER_CURSOR );-- 4417664
4272 /* --4492149
4273 ELSE
4274 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_types$',' ');-- 4417664
4275 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_variables$',' ');-- 4417664
4276 l_event := xla_cmp_string_pkg.replace_token (l_event, '$header_cursor$',' ');-- 4417664
4277 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_header_cursor$', ' ' );-- 4417664
4278 END IF;
4279 */
4280 --
4281 -- generate line structures, line variables and line cursor
4282 --
4283 /* --4492149
4284 IF (p_array_l_source_index.COUNT +
4285 p_array_l_mls_source_index.COUNT > 0 )
4286 THEN
4287 */
4288 --
4289 -- generate the structure of line variables
4290 --
4291 --
4292 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4293
4294 trace
4295 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateLineStructure API'
4296 ,p_level => C_LEVEL_STATEMENT
4297 ,p_module => l_log_module);
4298
4299 END IF;
4300 --
4301 l_event := xla_cmp_string_pkg.replace_token
4302 (l_event
4303 ,'$line_types$'
4304 ,xla_cmp_extract_pkg.GenerateLineStructure
4305 (p_array_table_name => p_array_table_name
4306 ,p_array_source_code => p_rec_sources.array_source_code
4307 ,p_array_l_source_index => p_array_l_source_index
4308 ,p_array_l_table_index => p_array_l_table_index
4309 ,p_array_l_mls_source_index => p_array_l_mls_source_index
4310 ,p_array_l_mls_table_index => p_array_l_mls_table_index)
4311 );
4312
4313 --
4314 -- generate the declaration of line variables
4315 --
4316 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4317
4318 trace
4319 (p_msg => 'after generatelineStructure length of l_event:'||to_char(length(l_event))
4320 ,p_level => C_LEVEL_PROCEDURE
4321 ,p_module => l_log_module);
4322 trace
4323 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateLineVariables API'
4324 ,p_level => C_LEVEL_STATEMENT
4325 ,p_module => l_log_module);
4326
4327 END IF;
4328 --
4329 l_event := xla_cmp_string_pkg.replace_token
4330 (l_event
4331 ,'$line_variables$'
4332 ,xla_cmp_extract_pkg.GenerateLineVariables
4333 (p_array_l_source_index => p_array_l_source_index
4334 ,p_array_l_mls_source_index => p_array_l_mls_source_index
4335 ,p_array_source_code => p_rec_sources.array_source_code
4336 ,p_array_lookup_type => p_rec_sources.array_lookup_type
4337 ,p_array_view_application_id => p_rec_sources.array_view_application_id)
4338 );
4339 --
4340 -- generate the declaration of line cursor
4341 --
4342 --
4343 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4344
4345 trace
4346 (p_msg => 'after generatelinevariables length of l_event:'||to_char(length(l_event))
4347 ,p_level => C_LEVEL_PROCEDURE
4348 ,p_module => l_log_module);
4349 trace
4350 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateLineCursor API'
4351 ,p_level => C_LEVEL_STATEMENT
4352 ,p_module => l_log_module);
4353
4354 END IF;
4355 --
4356 l_event := xla_cmp_string_pkg.replace_token
4357 (l_event
4358 ,'$line_cursor$'
4359 ,xla_cmp_extract_pkg.GenerateLineCursor
4360 (p_application_id => p_application_id
4361 ,p_array_table_name => p_array_table_name
4362 ,p_array_parent_table_index => p_array_parent_table_index
4363 ,p_array_table_hash => p_array_table_hash
4364 ,p_array_populated_flag => p_array_populated_flag
4365 ,p_array_ref_obj_flag => p_array_ref_obj_flag
4366 ,p_array_join_condition => p_array_join_condition
4367 ,p_array_l_source_index => p_array_l_source_index
4368 ,p_array_l_table_index => p_array_l_table_index
4369 ,p_array_l_mls_source_index => p_array_l_mls_source_index
4370 ,p_array_l_mls_table_index => p_array_l_mls_table_index
4371 ,p_array_source_code => p_rec_sources.array_source_code
4372 ,p_array_lookup_type => p_rec_sources.array_lookup_type
4373 ,p_array_view_application_id => p_rec_sources.array_view_application_id
4374 ,p_procedure => p_procedure)
4375 );
4376
4377 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4378
4379 trace
4380 (p_msg => 'after generatelinecursor length of l_event:'||to_char(length(l_event))
4381 ,p_level => C_LEVEL_PROCEDURE
4382 ,p_module => l_log_module);
4383 trace
4384 (p_msg => '-> CALL xla_cmp_extract_pkg.GenerateLineCursor API'
4385 ,p_level => C_LEVEL_STATEMENT
4386 ,p_module => l_log_module);
4387
4388 END IF;
4389 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_line_cursor$', C_CLOSE_LINE_CURSOR ); --4262811 awan
4390
4391 l_event := xla_cmp_string_pkg.replace_token (l_event, '$no_data_exception$', C_NO_DATA_EXCEPTION);
4392 --
4393 /* --4492149
4394 ELSE
4395 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_types$',' '); -- 4417664
4396 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_variables$', ' '); -- 4417664
4397 l_event := xla_cmp_string_pkg.replace_token (l_event, '$line_cursor$',' '); -- 4417664
4398 l_event := xla_cmp_string_pkg.replace_token (l_event, '$close_line_cursor$', ' ' );-- 4417664
4399 END IF;
4400 */
4401 --
4402 END IF;
4403
4404 --
4405 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4406 trace
4407 (p_msg => 'END of GenerateOneProcedure'
4408 ,p_level => C_LEVEL_PROCEDURE
4409 ,p_module => l_log_module);
4410 trace
4411 (p_msg => 'length of l_event:'||to_char(length(l_event))
4412 ,p_level => C_LEVEL_PROCEDURE
4413 ,p_module => l_log_module);
4414 END IF;
4415 RETURN l_event;
4416 EXCEPTION
4417 WHEN VALUE_ERROR THEN
4418 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4419 trace
4420 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
4421 ,p_level => C_LEVEL_EXCEPTION
4422 ,p_module => l_log_module);
4423 END IF;
4424 RAISE;
4425 WHEN xla_exceptions_pkg.application_exception THEN
4426 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4427 trace
4428 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
4429 ,p_level => C_LEVEL_EXCEPTION
4430 ,p_module => l_log_module);
4431 END IF;
4432 RAISE;
4433 WHEN OTHERS THEN
4434 xla_exceptions_pkg.raise_message
4435 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateOneProcedure');
4436 END GenerateOneProcedure;
4437
4438 /*---------------------------------------------------------------+
4439 | |
4440 | Private function |
4441 | |
4442 | GenerateProcedure |
4443 | |
4444 | Generates EventType_xxx() or EventClass_xxx() function |
4445 | |
4446 +---------------------------------------------------------------*/
4447
4448 FUNCTION GenerateProcedure (
4449 p_entity IN VARCHAR2
4450 , p_event_class IN VARCHAR2
4451 , p_event_type IN VARCHAR2
4452 , p_application_id IN NUMBER
4453 , p_product_rule_code IN VARCHAR2
4454 , p_product_rule_type_code IN VARCHAR2
4455 , p_amb_context_code IN VARCHAR2
4456 , p_acctd_flag IN VARCHAR2
4457 , p_g_l_flag IN VARCHAR2
4458 --
4459 , p_hdr_description_index IN BINARY_INTEGER
4460 , p_array_alt_index IN xla_cmp_source_pkg.t_array_ByInt
4461 , p_array_evt_source_Level IN xla_cmp_source_pkg.t_array_VL1
4462 --
4463 , p_array_hdr_acctg_source IN xla_cmp_source_pkg.t_array_VL30
4464 , p_array_hdr_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
4465 , p_array_hdr_acct_attr_source IN xla_cmp_source_pkg.t_array_int
4466 , p_array_line_acctg_source IN xla_cmp_source_pkg.t_array_VL30
4467 , p_array_line_acctg_source_type IN xla_cmp_source_pkg.t_array_VL1
4468 , p_array_line_acct_attr_source IN xla_cmp_source_pkg.t_array_int
4469 --
4470 , p_array_table_name IN xla_cmp_source_pkg.t_array_VL30
4471 , p_array_parent_table_index IN xla_cmp_source_pkg.t_array_ByInt
4472 , p_array_table_type IN xla_cmp_source_pkg.t_array_VL30
4473 , p_array_table_hash IN xla_cmp_source_pkg.t_array_VL30
4474 , p_array_populated_flag IN xla_cmp_source_pkg.t_array_VL1
4475 --
4476 , p_array_ref_obj_flag IN xla_cmp_source_pkg.t_array_VL1
4477 , p_array_join_condition IN xla_cmp_source_pkg.t_array_VL2000
4478 --
4479 , p_array_h_source_index IN xla_cmp_source_pkg.t_array_ByInt
4480 , p_array_h_table_index IN xla_cmp_source_pkg.t_array_ByInt
4481 --
4482 , p_array_h_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
4483 , p_array_h_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
4484 --
4485 , p_array_l_source_index IN xla_cmp_source_pkg.t_array_ByInt
4486 , p_array_l_table_index IN xla_cmp_source_pkg.t_array_ByInt
4487 --
4488 , p_array_l_mls_source_index IN xla_cmp_source_pkg.t_array_ByInt
4489 , p_array_l_mls_table_index IN xla_cmp_source_pkg.t_array_ByInt
4490
4491 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
4492 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
4493 --
4494 , p_extract_status IN BOOLEAN
4495 , p_procedure IN VARCHAR2
4496 )
4497 RETURN CLOB
4498 IS
4499 l_event CLOB;
4500 l_log_module VARCHAR2(240);
4501 BEGIN
4502 --
4503 IF g_log_enabled THEN
4504 l_log_module := C_DEFAULT_MODULE||'.GenerateProcedure';
4505 END IF;
4506 --
4507 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4508
4509 trace
4510 (p_msg => 'BEGIN of GenerateProcedure '
4511 ,p_level => C_LEVEL_PROCEDURE
4512 ,p_module => l_log_module);
4513
4514 END IF;
4515 --
4516 l_event := GenerateOneProcedure(
4517 p_application_id => p_application_id
4518 , p_product_rule_code => p_product_rule_code
4519 , p_product_rule_type_code => p_product_rule_type_code
4520 , p_amb_context_code => p_amb_context_code
4521 , p_entity => p_entity
4522 , p_event_class => p_event_class
4523 , p_event_type => p_event_type
4524 --
4525 , p_hdr_description_index => p_hdr_description_index
4526 , p_array_alt_index => p_array_alt_index
4527 , p_array_evt_source_Level => p_array_evt_source_Level
4528 --
4529 , p_array_hdr_acctg_source => p_array_hdr_acctg_source
4530 , p_array_hdr_acctg_source_type => p_array_hdr_acctg_source_type
4531 , p_array_hdr_acct_attr_source => p_array_hdr_acct_attr_source
4532 , p_array_line_acctg_source => p_array_line_acctg_source
4533 , p_array_line_acctg_source_type => p_array_line_acctg_source_type
4534 , p_array_line_acct_attr_source => p_array_line_acct_attr_source
4535 --
4536 , p_array_table_name => p_array_table_name
4537 , p_array_parent_table_index => p_array_parent_table_index
4538 , p_array_table_type => p_array_table_type
4539 , p_array_table_hash => p_array_table_hash
4540 , p_array_populated_flag => p_array_populated_flag
4541 --
4542 , p_array_ref_obj_flag => p_array_ref_obj_flag
4543 , p_array_join_condition => p_array_join_condition
4544 --
4545 , p_array_h_source_index => p_array_h_source_index
4546 , p_array_h_table_index => p_array_h_table_index
4547 --
4548 , p_array_h_mls_source_index => p_array_h_mls_source_index
4549 , p_array_h_mls_table_index => p_array_h_mls_table_index
4550 --
4551 , p_array_l_source_index => p_array_l_source_index
4552 , p_array_l_table_index => p_array_l_table_index
4553 --
4554 , p_array_l_mls_source_index => p_array_l_mls_source_index
4555 , p_array_l_mls_table_index => p_array_l_mls_table_index
4556 --
4557 , p_rec_sources => p_rec_sources
4558 , p_rec_aad_objects => p_rec_aad_objects
4559 --
4560 , p_extract_status => p_extract_status
4561 , p_procedure => p_procedure
4562 );
4563 --
4564 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4565 trace
4566 (p_msg => 'length of l_event:'||to_char(length(l_event))
4567 ,p_level => C_LEVEL_PROCEDURE
4568 ,p_module => l_log_module);
4569 END IF;
4570 --
4571 l_event := xla_cmp_string_pkg.replace_token(l_event,'$event_class_code$', p_event_class); -- 4417664
4572 l_event := xla_cmp_string_pkg.replace_token(l_event,'$event_type_code$',p_event_type); -- 4417664
4573 l_event := xla_cmp_string_pkg.replace_token(l_event,'$calculate_acctd_flag$',p_acctd_flag); -- 4417664
4574 l_event := xla_cmp_string_pkg.replace_token(l_event,'$calculate_g_l_flag$',p_g_l_flag); -- 4417664
4575
4576 l_event :=
4577 xla_cmp_string_pkg.replace_token -- 4417664
4578 (l_event,'$event_class_name$'
4579 ,GetEventClassName
4580 (p_application_id => p_application_id
4581 ,p_entity_code => p_entity
4582 ,p_event_class_code => p_event_class)
4583 );
4584
4585 l_event :=
4586 xla_cmp_string_pkg.replace_token -- 4417664
4587 (l_event,'$event_type_name$'
4588 ,GetEventTypeName
4589 (p_application_id => p_application_id
4590 ,p_entity_code => p_entity
4591 ,p_event_class_code => p_event_class
4592 ,p_event_type_code => p_event_type)
4593 );
4594
4595 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4596 trace
4597 (p_msg => 'END of GenerateProcedure'
4598 ,p_level => C_LEVEL_PROCEDURE
4599 ,p_module => l_log_module);
4600 END IF;
4601 --
4602 RETURN l_event;
4603 EXCEPTION
4604 WHEN VALUE_ERROR THEN
4605 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4606 trace
4607 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
4608 ,p_level => C_LEVEL_EXCEPTION
4609 ,p_module => l_log_module);
4610 END IF;
4611 RAISE;
4612 WHEN xla_exceptions_pkg.application_exception THEN
4613 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4614 trace
4615 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
4616 ,p_level => C_LEVEL_EXCEPTION
4617 ,p_module => l_log_module);
4618 END IF;
4619 RAISE;
4620 WHEN OTHERS THEN
4621 xla_exceptions_pkg.raise_message
4622 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateProcedure');
4623 END GenerateProcedure;
4624
4625 /*---------------------------------------------------------------+
4626 | |
4627 | Private function |
4628 | |
4629 | GetEventTypeClassProc |
4630 | |
4631 | Generates EventType_xxx() and EventClass_xxx() functions |
4632 | |
4633 +---------------------------------------------------------------*/
4634 --
4635 FUNCTION GetEventTypeClassProc (
4636 p_entity IN VARCHAR2
4637 , p_event_class IN VARCHAR2
4638 , p_event_type IN VARCHAR2
4639 , p_acctd_flag IN VARCHAR2
4640 , p_g_l_flag IN VARCHAR2
4641 , p_application_id IN NUMBER
4642 , p_product_rule_code IN VARCHAR2
4643 , p_product_rule_type_code IN VARCHAR2
4644 , p_amb_context_code IN VARCHAR2
4645 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
4646 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
4647 , p_procedure IN VARCHAR2
4648 , p_IsCompiled OUT NOCOPY BOOLEAN
4649 )
4650 RETURN DBMS_SQL.VARCHAR2S
4651 IS
4652 --
4653 l_event CLOB;
4654 l_array_event DBMS_SQL.VARCHAR2S;
4655 --
4656 l_IsExtractValid BOOLEAN;
4657 l_IsCompiled BOOLEAN;
4658 --
4659 l_array_evt_source_index xla_cmp_source_pkg.t_array_ByInt;
4660 l_array_evt_source_level xla_cmp_source_pkg.t_array_VL1;
4661 --
4662 l_array_null_source_index xla_cmp_source_pkg.t_array_ByInt;
4663 --
4664 l_array_hdr_acctg_source xla_cmp_source_pkg.t_array_VL30;
4665 l_array_hdr_acctg_source_type xla_cmp_source_pkg.t_array_VL1;
4666 l_array_hdr_acct_attr_source xla_cmp_source_pkg.t_array_int;
4667 l_array_line_acctg_source xla_cmp_source_pkg.t_array_VL30;
4668 l_array_line_acctg_source_type xla_cmp_source_pkg.t_array_VL1;
4669 l_array_line_acct_attr_source xla_cmp_source_pkg.t_array_int;
4670 --
4671 l_array_table_name xla_cmp_source_pkg.t_array_VL30;
4672 l_array_parent_table_index xla_cmp_source_pkg.t_array_ByInt;
4673 l_array_table_type xla_cmp_source_pkg.t_array_VL30;
4674 l_array_table_hash xla_cmp_source_pkg.t_array_VL30;
4675 l_array_populated_flag xla_cmp_source_pkg.t_array_VL1;
4676 --
4677 l_array_ref_obj_flag xla_cmp_source_pkg.t_array_VL1;
4678 l_array_join_condition xla_cmp_source_pkg.t_array_VL2000;
4679 --
4680 l_array_h_source_index xla_cmp_source_pkg.t_array_ByInt;
4681 l_array_h_table_index xla_cmp_source_pkg.t_array_ByInt;
4682 --
4683 l_array_h_mls_source_index xla_cmp_source_pkg.t_array_ByInt;
4684 l_array_h_mls_table_index xla_cmp_source_pkg.t_array_ByInt;
4685 --
4686 l_array_l_source_index xla_cmp_source_pkg.t_array_ByInt;
4687 l_array_l_table_index xla_cmp_source_pkg.t_array_ByInt;
4688 --
4689 l_array_l_mls_source_index xla_cmp_source_pkg.t_array_ByInt;
4690 l_array_l_mls_table_index xla_cmp_source_pkg.t_array_ByInt;
4691 --
4692 l_hdr_description_index BINARY_INTEGER;
4693 l_array_alt_index xla_cmp_source_pkg.t_array_ByInt;
4694 --
4695 l_ObjectIndex BINARY_INTEGER;
4696 l_log_module VARCHAR2(240);
4697 --
4698 -- Transaction Objects Diagnostics variables
4699 --
4700 l_insert_sources CLOB;
4701 l_array_insert_sources DBMS_SQL.VARCHAR2S;
4702 --
4703 BEGIN
4704 IF g_log_enabled THEN
4705 l_log_module := C_DEFAULT_MODULE||'.GetEventTypeClassProc';
4706 END IF;
4707 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4708 trace
4709 (p_msg => 'p_procedure = '||p_procedure
4710 ,p_level => C_LEVEL_PROCEDURE
4711 ,p_module => l_log_module);
4712 trace
4713 (p_msg => 'BEGIN of GetEventTypeClassProc'
4714 ,p_level => C_LEVEL_PROCEDURE
4715 ,p_module => l_log_module);
4716 END IF;
4717
4718 g_entity_name := GetEntityName(
4719 p_entity => p_entity
4720 , p_application_id => p_application_id
4721 );
4722
4723 g_event_class_name := GetEventClassName(
4724 p_application_id => p_application_id
4725 , p_entity_code => p_entity
4726 , p_event_class_code => p_event_class
4727 );
4728
4729 g_event_type_name := GetEventTypeName(
4730 p_application_id => p_application_id
4731 , p_entity_code => p_entity
4732 , p_event_class_code => p_event_class
4733 , p_event_type_code => p_event_type
4734 );
4735
4736
4737 --
4738 l_IsExtractValid := TRUE;
4739 l_IsCompiled := TRUE;
4740 --
4741 CollectHeaderAndLineSources (
4742 p_entity => p_entity
4743 , p_event_class => p_event_class
4744 , p_event_type => p_event_type
4745 , p_application_id => p_application_id
4746 , p_product_rule_code => p_product_rule_code
4747 , p_product_rule_type_code => p_product_rule_type_code
4748 , p_amb_context_code => p_amb_context_code
4749 , p_array_evt_source_index => l_array_evt_source_index
4750 , p_array_hdr_acctg_source => l_array_hdr_acctg_source
4751 , p_array_hdr_acctg_source_type => l_array_hdr_acctg_source_type
4752 , p_array_hdr_acct_attr_source => l_array_hdr_acct_attr_source
4753 , p_array_line_acctg_source => l_array_line_acctg_source
4754 , p_array_line_acctg_source_type => l_array_line_acctg_source_type
4755 , p_array_line_acct_attr_source => l_array_line_acct_attr_source
4756 , p_hdr_description_index => l_hdr_description_index
4757 , p_array_alt_index => l_array_alt_index
4758 , p_rec_aad_objects => p_rec_aad_objects
4759 , p_rec_sources => p_rec_sources
4760 );
4761
4762
4763 -- Call the Extract Integrity Checker to validate sources with
4764 -- event class Extract Objects
4765
4766 l_IsExtractValid := xla_cmp_extract_pkg.CallExtractIntegrityChecker (
4767 p_application_id => p_application_id
4768 , p_entity_code => p_entity
4769 , p_event_class_code => p_event_class
4770 , p_amb_context_code => p_amb_context_code
4771 , p_product_rule_type_code => p_product_rule_type_code
4772 , p_product_rule_code => p_product_rule_code
4773 , p_array_evt_source_index => l_array_evt_source_index
4774 , p_array_application_id => p_rec_sources.array_application_id
4775 , p_array_source_code => p_rec_sources.array_source_code
4776 , p_array_source_type_code => p_rec_sources.array_source_type_code
4777 , p_array_datatype_code => p_rec_sources.array_datatype_code
4778 , p_array_translated_flag => p_rec_sources.array_translated_flag
4779 , p_array_evt_source_Level => l_array_evt_source_level
4780 , p_array_object_name => l_array_table_name
4781 , p_array_parent_object_index => l_array_parent_table_index
4782 , p_array_object_type => l_array_table_type
4783 , p_array_object_hash_id => l_array_table_hash
4784 , p_array_populated_flag => l_array_populated_flag
4785 , p_array_ref_obj_flag => l_array_ref_obj_flag
4786 , p_array_join_condition => l_array_join_condition
4787 , p_array_h_source_index => l_array_h_source_index
4788 , p_array_h_table_index => l_array_h_table_index
4789 , p_array_h_mls_source_index => l_array_h_mls_source_index
4790 , p_array_h_mls_table_index => l_array_h_mls_table_index
4791 , p_array_l_source_index => l_array_l_source_index
4792 , p_array_l_table_index => l_array_l_table_index
4793 , p_array_l_mls_source_index => l_array_l_mls_source_index
4794 , p_array_l_mls_table_index => l_array_l_mls_table_index
4795 )
4796 ;
4797
4798 IF (p_application_id = 200 AND XLA_CMP_PAD_PKG.g_bc_pkg_flag = 'Y') THEN
4799 PopulateBCObjectNames(l_array_table_name, l_array_join_condition);
4800 END IF;
4801
4802 -- generate the event type/event class functions
4803
4804 l_event := GenerateProcedure(
4805 p_entity => p_entity
4806 , p_event_class => p_event_class
4807 , p_event_type => p_event_type
4808 , p_application_id => p_application_id
4809 , p_product_rule_code => p_product_rule_code
4810 , p_product_rule_type_code => p_product_rule_type_code
4811 , p_amb_context_code => p_amb_context_code
4812 , p_acctd_flag => p_acctd_flag
4813 , p_g_l_flag => p_g_l_flag
4814 --
4815 , p_hdr_description_index => l_hdr_description_index
4816 , p_array_alt_index => l_array_alt_index
4817 , p_array_evt_source_Level => l_array_evt_source_level
4818 --
4819 , p_array_hdr_acctg_source => l_array_hdr_acctg_source
4820 , p_array_hdr_acctg_source_type => l_array_hdr_acctg_source_type
4821 , p_array_hdr_acct_attr_source => l_array_hdr_acct_attr_source
4822 , p_array_line_acctg_source => l_array_line_acctg_source
4823 , p_array_line_acctg_source_type => l_array_line_acctg_source_type
4824 , p_array_line_acct_attr_source => l_array_line_acct_attr_source
4825 --
4826 , p_array_table_name => l_array_table_name
4827 , p_array_parent_table_index => l_array_parent_table_index
4828 , p_array_table_type => l_array_table_type
4829 , p_array_table_hash => l_array_table_hash
4830 , p_array_populated_flag => l_array_populated_flag
4831 --
4832 , p_array_ref_obj_flag => l_array_ref_obj_flag
4833 , p_array_join_condition => l_array_join_condition
4834 --
4835 , p_array_h_source_index => l_array_h_source_index
4836 , p_array_h_table_index => l_array_h_table_index
4837 , p_array_h_mls_source_index => l_array_h_mls_source_index
4838 , p_array_h_mls_table_index => l_array_h_mls_table_index
4839 , p_array_l_source_index => l_array_l_source_index
4840 , p_array_l_table_index => l_array_l_table_index
4841 , p_array_l_mls_source_index => l_array_l_mls_source_index
4842 , p_array_l_mls_table_index => l_array_l_mls_table_index
4843 --
4844 , p_rec_sources => p_rec_sources
4845 , p_rec_aad_objects => p_rec_aad_objects
4846 , p_extract_status => l_IsExtractValid
4847 , p_procedure => p_procedure
4848 );
4849
4850 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
4851
4852 trace
4853 (p_msg => 'length of l_event:'|| to_char(length(l_event))
4854 ,p_level => C_LEVEL_STATEMENT
4855 ,p_module => l_log_module);
4856 END IF;
4857
4858 IF p_procedure = 'EVENT_TYPE' THEN
4859
4860 l_ObjectIndex := xla_cmp_source_pkg.CacheAADObject (
4861 p_object => xla_cmp_source_pkg.C_EVT
4862 , p_object_code => p_event_type
4863 , p_object_type_code => 'S'
4864 , p_application_id => p_application_id
4865 , p_array_source_Index => l_array_evt_source_index
4866 , p_rec_aad_objects => p_rec_aad_objects
4867 );
4868
4869 l_event := xla_cmp_string_pkg.replace_token(l_event,'$EVENT_ID$' ,'Type_'||TO_CHAR(l_ObjectIndex)); -- 4417664
4870 l_event := xla_cmp_string_pkg.replace_token(l_event,'$package_name$' , g_package_name); -- 4417664
4871
4872 ELSIF p_procedure = 'EVENT_CLASS' THEN
4873
4874 l_ObjectIndex := xla_cmp_source_pkg.CacheAADObject (
4875 p_object => xla_cmp_source_pkg.C_CLASS
4876 , p_object_code => p_event_class
4877 , p_object_type_code => 'S'
4878 , p_application_id => p_application_id
4879 , p_array_source_Index => l_array_evt_source_index
4880 , p_rec_aad_objects => p_rec_aad_objects
4881 );
4882
4883 l_event := xla_cmp_string_pkg.replace_token(l_event,'$EVENT_ID$' ,'Class_'||TO_CHAR(l_ObjectIndex)); -- 4417664
4884 l_event := xla_cmp_string_pkg.replace_token(l_event,'$package_name$' , g_package_name); -- 4417664
4885
4886 END IF;
4887 --
4888 l_IsCompiled:= l_IsCompiled AND (l_event IS NOT NULL) AND l_IsExtractValid;
4889
4890 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
4891 trace
4892 (p_msg => 'length of l_event:'|| to_char(length(l_event))
4893 ,p_level => C_LEVEL_STATEMENT
4894 ,p_module => l_log_module);
4895 trace
4896 (p_msg => 'l_isCompiled = '||
4897 CASE l_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
4898 ,p_level => C_LEVEL_STATEMENT
4899 ,p_module => l_log_module);
4900 trace
4901 (p_msg => 'l_IsExtractValid= '||
4902 CASE l_IsExtractValid WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
4903 ,p_level => C_LEVEL_STATEMENT
4904 ,p_module => l_log_module);
4905 END IF;
4906
4907 xla_cmp_string_pkg.CreateString(
4908 p_package_text => l_event
4909 ,p_array_string => l_array_event
4910 );
4911
4912 --
4913 --+==========================================================================+
4914 --| |
4915 --| |
4916 --| |
4917 --| |
4918 --| |
4919 --| |
4920 --| |
4921 --| |
4922 --| |
4923 --| Transaction Objects Diagnostics |
4924 --| |
4925 --| |
4926 --| |
4927 --| |
4928 --| |
4929 --| |
4930 --| |
4931 --| |
4932 --| |
4933 --| |
4934 --+==========================================================================+
4935
4936 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
4937 trace
4938 (p_msg => ' -> CALL Transaction Objects Diagnostics '
4939 ,p_level => C_LEVEL_STATEMENT
4940 ,p_module => l_log_module);
4941 END IF;
4942
4943 l_insert_sources := C_INSERT_SOURCES_PROC;
4944 l_insert_sources := xla_cmp_string_pkg.replace_token(l_insert_sources,'$event_class_code$', nvl(p_event_class,' ')); -- 4417664
4945 l_insert_sources := xla_cmp_string_pkg.replace_token(l_insert_sources,'$event_type_code$',nvl(p_event_type,' ')); -- 4417664
4946
4947
4948 l_insert_sources := xla_cmp_string_pkg.replace_token(l_insert_sources,'$insert_header_sources$',
4949 nvl(xla_cmp_extract_pkg.GenerateInsertHdrSources (
4950 --
4951 p_array_table_name => l_array_table_name
4952 , p_array_parent_table_index => l_array_parent_table_index
4953 , p_array_table_hash => l_array_table_hash
4954 , p_array_table_type => l_array_table_type
4955 , p_array_populated_flag => l_array_populated_flag
4956 --
4957 , p_array_ref_obj_flag => l_array_ref_obj_flag
4958 , p_array_join_condition => l_array_join_condition
4959 --
4960 , p_array_h_source_index => l_array_h_source_index
4961 , p_array_h_table_index => l_array_h_table_index
4962 --
4963 , p_array_h_mls_source_index => l_array_h_mls_source_index
4964 , p_array_h_mls_table_index => l_array_h_mls_table_index
4965 --
4966 , p_array_application_id => p_rec_sources.array_application_id
4967 , p_array_source_code => p_rec_sources.array_source_code
4968 , p_array_source_type_code => p_rec_sources.array_source_type_code
4969 , p_array_flex_value_set_id => p_rec_sources.array_flex_value_set_id
4970 , p_array_lookup_type => p_rec_sources.array_lookup_type
4971 , p_array_view_application_id => p_rec_sources.array_view_application_id
4972 --
4973 , p_procedure => p_procedure
4974 ),' ')
4975 );
4976
4977 l_insert_sources := xla_cmp_string_pkg.replace_token(l_insert_sources, '$insert_line_sources$',
4978 nvl(xla_cmp_extract_pkg.GenerateInsertLineSources (
4979 --
4980 p_array_table_name => l_array_table_name
4981 , p_array_parent_table_index => l_array_parent_table_index
4982 , p_array_table_hash => l_array_table_hash
4983 , p_array_table_type => l_array_table_type
4984 , p_array_populated_flag => l_array_populated_flag
4985 --
4986 , p_array_ref_obj_flag => l_array_ref_obj_flag
4987 , p_array_join_condition => l_array_join_condition
4988 --
4989 , p_array_l_source_index => l_array_l_source_index
4990 , p_array_l_table_index => l_array_l_table_index
4991 --
4992 , p_array_l_mls_source_index => l_array_l_mls_source_index
4993 , p_array_l_mls_table_index => l_array_l_mls_table_index
4994 --
4995 , p_array_application_id => p_rec_sources.array_application_id
4996 , p_array_source_code => p_rec_sources.array_source_code
4997 , p_array_source_type_code => p_rec_sources.array_source_type_code
4998 , p_array_flex_value_set_id => p_rec_sources.array_flex_value_set_id
4999 , p_array_lookup_type => p_rec_sources.array_lookup_type
5000 , p_array_view_application_id => p_rec_sources.array_view_application_id
5001 --
5002 , p_procedure => p_procedure
5003 ) ,' ')
5004 );
5005
5006 --
5007 l_insert_sources:= xla_cmp_string_pkg.replace_token(l_insert_sources,'$EVENT_INDEX$' ,TO_CHAR(l_ObjectIndex)); -- 4417664
5008
5009 l_insert_sources:= xla_cmp_string_pkg.replace_token(l_insert_sources,'$package_name$' ,g_package_name); -- 4417664
5010
5011 xla_cmp_string_pkg.CreateString(
5012 p_package_text => l_insert_sources
5013 ,p_array_string => l_array_insert_sources
5014 );
5015
5016
5017 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
5018
5019 trace
5020 (p_msg => 'End call to Transaction Objects Diagnostics '
5021 ,p_level => C_LEVEL_STATEMENT
5022 ,p_module => l_log_module);
5023
5024
5025 trace
5026 (p_msg => 'Concat to event type or event class function the code ='
5027 ||l_array_insert_sources.COUNT
5028 ,p_level => C_LEVEL_STATEMENT
5029 ,p_module => l_log_module);
5030
5031 END IF;
5032
5033 l_array_event := xla_cmp_string_pkg.ConcatTwoStrings (
5034 p_array_string_1 => l_array_insert_sources
5035 ,p_array_string_2 => l_array_event
5036 );
5037
5038 IF (C_LEVEL_STATEMENT>= g_log_level) THEN
5039 trace
5040 (p_msg => 'Event class or Event Type function length ='
5041 ||l_array_event.COUNT
5042 ,p_level => C_LEVEL_STATEMENT
5043 ,p_module => l_log_module);
5044
5045 END IF;
5046 --
5047 ------------------------------------------------------------------------------
5048 --
5049 -- END the generation of Transaction Objects Diagnostics
5050 --
5051 ------------------------------------------------------------------------------
5052 --
5053 l_array_evt_source_index := l_array_null_source_index;
5054 --
5055 p_IsCompiled := l_IsCompiled;
5056 --
5057 --
5058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5059 trace
5060 (p_msg => 'p_IsCompiled = '||
5061 CASE p_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
5062 ,p_level => C_LEVEL_STATEMENT
5063 ,p_module => l_log_module);
5064 trace
5065 (p_msg => 'END of GetEventTypeClassProc'
5066 ,p_level => C_LEVEL_PROCEDURE
5067 ,p_module => l_log_module);
5068 END IF;
5069
5070 RETURN l_array_event;
5071 EXCEPTION
5072 WHEN VALUE_ERROR THEN
5073 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5074 trace
5075 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5076 ,p_level => C_LEVEL_EXCEPTION
5077 ,p_module => l_log_module);
5078 END IF;
5079 RAISE;
5080 WHEN xla_exceptions_pkg.application_exception THEN
5081 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5082 trace
5083 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5084 ,p_level => C_LEVEL_EXCEPTION
5085 ,p_module => l_log_module);
5086 END IF;
5087 RAISE;
5088 WHEN OTHERS THEN
5089 xla_exceptions_pkg.raise_message
5090 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventTypeClassProc ');
5091 END GetEventTypeClassProc;
5092
5093
5094 /*---------------------------------------------------------------+
5095 | |
5096 | Private function |
5097 | |
5098 | GetEventTypeOrClassProc |
5099 | |
5100 | Drives the generation of EventType_xxx() or EventClass_xxx() |
5101 | functions |
5102 | |
5103 +---------------------------------------------------------------*/
5104
5105 FUNCTION GetEventTypeOrClassProc (
5106 p_application_id IN NUMBER
5107 , p_amb_context_code IN VARCHAR2
5108 , p_product_rule_code IN VARCHAR2
5109 , p_product_rule_type_code IN VARCHAR2
5110 , p_entity IN VARCHAR2
5111 , p_event_class IN VARCHAR2
5112 , p_event_type IN VARCHAR2
5113 , p_acctd_flag IN VARCHAR2
5114 , p_g_l_flag IN VARCHAR2
5115 --
5116 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
5117 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
5118 --
5119 , p_IsCompiled OUT NOCOPY BOOLEAN
5120 )
5121 RETURN DBMS_SQL.VARCHAR2S
5122 IS
5123
5124 l_event DBMS_SQL.VARCHAR2S;
5125 l_IsCompiled BOOLEAN;
5126 l_log_module VARCHAR2(240);
5127
5128 BEGIN
5129 IF g_log_enabled THEN
5130 l_log_module := C_DEFAULT_MODULE||'.GetEventTypeOrClassProc';
5131 END IF;
5132 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5133
5134 trace
5135 (p_msg => 'BEGIN of GetEventTypeOrClassProc'
5136 ,p_level => C_LEVEL_PROCEDURE
5137 ,p_module => l_log_module);
5138 trace
5139 (p_msg => 'p_entity = '||p_entity||
5140 ' - p_event_class = '||p_event_class ||
5141 ' - p_event_type = '||p_event_type
5142 ,p_level => C_LEVEL_PROCEDURE
5143 ,p_module => l_log_module);
5144 END IF;
5145 --
5146 l_IsCompiled := TRUE;
5147 p_IsCompiled := TRUE;
5148 --
5149 l_event := xla_cmp_string_pkg.g_null_varchar2s;
5150 --
5151 IF (p_event_type <> p_event_class ||'_ALL') THEN
5152 --
5153 -- generate event type procedure
5154 --
5155 l_event:= GetEventTypeClassProc (
5156 p_entity => p_entity
5157 , p_event_class => p_event_class
5158 , p_event_type => p_event_type
5159 , p_acctd_flag => p_acctd_flag
5160 , p_g_l_flag => p_g_l_flag
5161 , p_application_id => p_application_id
5162 , p_product_rule_code => p_product_rule_code
5163 , p_product_rule_type_code => p_product_rule_type_code
5164 , p_amb_context_code => p_amb_context_code
5165 --
5166 , p_rec_sources => p_rec_sources
5167 , p_rec_aad_objects => p_rec_aad_objects
5168 --
5169 , p_procedure => 'EVENT_TYPE'
5170 , p_IsCompiled => l_IsCompiled
5171 );
5172 --
5173 ELSE
5174 --
5175 -- generate event class procedure
5176 --
5177 l_event:= GetEventTypeClassProc (
5178 p_entity => p_entity
5179 , p_event_class => p_event_class
5180 , p_event_type => p_event_type
5181 , p_acctd_flag => p_acctd_flag
5182 , p_g_l_flag => p_g_l_flag
5183 , p_application_id => p_application_id
5184 , p_product_rule_code => p_product_rule_code
5185 , p_product_rule_type_code => p_product_rule_type_code
5186 , p_amb_context_code => p_amb_context_code
5187 --
5188 , p_rec_sources => p_rec_sources
5189 , p_rec_aad_objects => p_rec_aad_objects
5190 --
5191 , p_procedure => 'EVENT_CLASS'
5192 , p_IsCompiled => l_IsCompiled
5193 );
5194 --
5195 END IF;
5196
5197 --
5198 p_IsCompiled := p_IsCompiled AND l_IsCompiled ;
5199 --
5200 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5201 trace
5202 (p_msg => 'p_IsCompiled = '||
5203 CASE p_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
5204 ,p_level => C_LEVEL_STATEMENT
5205 ,p_module => l_log_module);
5206 trace
5207 (p_msg => 'END of GetEventTypeOrClassProc'
5208 ,p_level => C_LEVEL_PROCEDURE
5209 ,p_module => l_log_module);
5210 END IF;
5211 RETURN l_event;
5212 EXCEPTION
5213 WHEN VALUE_ERROR THEN
5214 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5215 trace
5216 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5217 ,p_level => C_LEVEL_EXCEPTION
5218 ,p_module => l_log_module);
5219 END IF;
5220 RAISE;
5221 WHEN xla_exceptions_pkg.application_exception THEN
5222 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5223 trace
5224 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5225 ,p_level => C_LEVEL_EXCEPTION
5226 ,p_module => l_log_module);
5227 END IF;
5228 RAISE;
5229 WHEN OTHERS THEN
5230 xla_exceptions_pkg.raise_message
5231 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventTypeOrClassProc ');
5232 END GetEventTypeOrClassProc;
5233
5234 /*---------------------------------------------------------------+
5235 | |
5236 | Private function |
5237 | |
5238 | GetEventTypeOrClassProc |
5239 | |
5240 | Generates all EventType_xxx() or EventClass_xxx() from event |
5241 | types and event classes assigned to AAD |
5242 | |
5243 +---------------------------------------------------------------*/
5244
5245 FUNCTION GetEventClassAndTypeProcs (
5246 p_product_rule_code IN VARCHAR2
5247 , p_product_rule_type_code IN VARCHAR2
5248 , p_application_id IN NUMBER
5249 , p_amb_context_code IN VARCHAR2
5250 --
5251 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
5252 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
5253 --
5254 , p_IsCompiled OUT NOCOPY BOOLEAN
5255 )
5256 RETURN DBMS_SQL.VARCHAR2S
5257 IS
5258 --
5259 l_events DBMS_SQL.VARCHAR2S;
5260 l_array_events DBMS_SQL.VARCHAR2S;
5261 --
5262 l_array_entity xla_cmp_source_pkg.t_array_VL30;
5263 l_array_event_class xla_cmp_source_pkg.t_array_VL30;
5264 l_array_event_type xla_cmp_source_pkg.t_array_VL30;
5265 l_array_event_class_acctd_flag xla_cmp_source_pkg.t_array_VL1;
5266 l_array_event_class_g_l_flag xla_cmp_source_pkg.t_array_VL1;
5267 --
5268 l_array_null_entity xla_cmp_source_pkg.t_array_VL30;
5269 l_array_null_event_class xla_cmp_source_pkg.t_array_VL30;
5270 l_array_null_event_type xla_cmp_source_pkg.t_array_VL30;
5271 --
5272 l_IsCompiled BOOLEAN;
5273 l_log_module VARCHAR2(240);
5274 --
5275 BEGIN
5276 IF g_log_enabled THEN
5277 l_log_module := C_DEFAULT_MODULE||'.GetEventClassAndTypeProcs';
5278 END IF;
5279 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5280 trace
5281 (p_msg => 'BEGIN of GetEventClassAndTypeProcs'
5282 ,p_level => C_LEVEL_PROCEDURE
5283 ,p_module => l_log_module);
5284 END IF;
5285
5286 l_IsCompiled := TRUE;
5287 p_IsCompiled := TRUE;
5288
5289 GetEventClassEventType(
5290 p_application_id
5291 , p_amb_context_code
5292 , p_product_rule_code
5293 , p_product_rule_type_code
5294 , l_array_entity
5295 , l_array_event_class
5296 , l_array_event_type
5297 , l_array_event_class_acctd_flag
5298 , l_array_event_class_g_l_flag
5299 );
5300
5301 l_events := xla_cmp_string_pkg.g_null_varchar2s;
5302
5303 IF l_array_event_type.COUNT > 0 THEN
5304 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5305
5306 trace
5307 (p_msg => 'count is:'||to_char(l_array_event_type.COUNT)
5308 ,p_level => C_LEVEL_PROCEDURE
5309 ,p_module => l_log_module);
5310
5311 END IF;
5312
5313 FOR Idx IN l_array_event_type.FIRST .. l_array_event_type.LAST LOOP
5314 IF l_array_event_type.EXISTS(Idx) THEN
5315
5316 l_array_events := GetEventTypeOrClassProc (
5317 p_application_id => p_application_id
5318 , p_amb_context_code => p_amb_context_code
5319 , p_product_rule_code => p_product_rule_code
5320 , p_product_rule_type_code => p_product_rule_type_code
5321 --
5322 , p_entity => l_array_entity(Idx)
5323 , p_event_class => l_array_event_class(Idx)
5324 , p_event_type => l_array_event_type(Idx)
5325 , p_acctd_flag => l_array_event_class_acctd_flag(Idx)
5326 , p_g_l_flag => l_array_event_class_g_l_flag(Idx)
5327 --
5328 , p_rec_sources => p_rec_sources
5329 , p_rec_aad_objects => p_rec_aad_objects
5330 --
5331 , p_IsCompiled => l_IsCompiled
5332 );
5333
5334 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5335 trace
5336 (p_msg => 'l_event length is:'||to_char(l_events.COUNT)
5337 ,p_level => C_LEVEL_PROCEDURE
5338 ,p_module => l_log_module);
5339 trace
5340 (p_msg => 'l__array_event length is:'||to_char(l_array_events.COUNT)
5341 ,p_level => C_LEVEL_PROCEDURE
5342 ,p_module => l_log_module);
5343 END IF;
5344
5345 l_events := xla_cmp_string_pkg.ConcatTwoStrings (
5346 p_array_string_1 => l_events
5347 ,p_array_string_2 => l_array_events
5348 );
5349 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5350 trace
5351 (p_msg => 'l_event length is:'||to_char(l_events.COUNT)
5352 ,p_level => C_LEVEL_PROCEDURE
5353 ,p_module => l_log_module);
5354 END IF;
5355
5356 p_IsCompiled := p_IsCompiled AND l_IsCompiled;
5357
5358 END IF;
5359 END LOOP;
5360 END IF;
5361
5362 l_array_entity := l_array_null_entity;
5363 l_array_event_class := l_array_null_event_class;
5364 l_array_event_type := l_array_null_event_type;
5365 --
5366 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5367 trace
5368 (p_msg => 'p_IsCompiled = '||
5369 CASE p_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
5370 ,p_level => C_LEVEL_STATEMENT
5371 ,p_module => l_log_module);
5372 trace
5373 (p_msg => 'END of GetEventClassAndTypeProcs'
5374 ,p_level => C_LEVEL_PROCEDURE
5375 ,p_module => l_log_module);
5376 END IF;
5377 --
5378 RETURN l_events;
5379 EXCEPTION
5380 WHEN VALUE_ERROR THEN
5381 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5382 trace
5383 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5384 ,p_level => C_LEVEL_EXCEPTION
5385 ,p_module => l_log_module);
5386 END IF;
5387 RAISE;
5388 WHEN xla_exceptions_pkg.application_exception THEN
5389 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5390 trace
5391 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5392 ,p_level => C_LEVEL_EXCEPTION
5393 ,p_module => l_log_module);
5394 END IF;
5395 RAISE;
5396 WHEN OTHERS THEN
5397 xla_exceptions_pkg.raise_message
5398 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GetEventClassAndTypeProcs ');
5399 END GetEventClassAndTypeProcs;
5400
5401 /*-----------------------------------------------------------------------+
5402 | |
5403 | Public function |
5404 | |
5405 | GenerateEventClassAndType |
5406 | |
5407 | Generates the EventType_xxx() and EventCass_xxx() functions from the |
5408 | Event Type Code and Event Class Code assigned to the AAD. |
5409 | |
5410 +-----------------------------------------------------------------------*/
5411
5412 FUNCTION GenerateEventClassAndType (
5413 p_application_id IN NUMBER
5414 , p_product_rule_code IN VARCHAR2
5415 , p_product_rule_type_code IN VARCHAR2
5416 , p_product_rule_version IN VARCHAR2
5417 , p_amb_context_code IN VARCHAR2
5418 , p_product_rule_name IN VARCHAR2
5419 , p_package_name IN VARCHAR2
5420 , p_rec_aad_objects IN OUT NOCOPY xla_cmp_source_pkg.t_rec_aad_objects
5421 , p_rec_sources IN OUT NOCOPY xla_cmp_source_pkg.t_rec_sources
5422 , p_package_body OUT NOCOPY DBMS_SQL.VARCHAR2S
5423 )
5424 RETURN BOOLEAN
5425 IS
5426 --
5427 l_IsCompiled BOOLEAN:= TRUE;
5428 l_events DBMS_SQL.VARCHAR2S;
5429 l_log_module VARCHAR2(240);
5430 --
5431 BEGIN
5432
5433 IF g_log_enabled THEN
5434 l_log_module := C_DEFAULT_MODULE||'.GenerateEventClassAndType';
5435 END IF;
5436 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5437 trace
5438 (p_msg => 'BEGIN of GenerateEventClassAndType'
5439 ,p_level => C_LEVEL_PROCEDURE
5440 ,p_module => l_log_module);
5441
5442 END IF;
5443 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5444 trace
5445 (p_msg => 'p_package_name = '||p_package_name||
5446 ' - p_product_rule_code='||p_product_rule_code||
5447 ' - p_product_rule_type_code='||p_product_rule_type_code||
5448 ' - p_product_rule_version='||p_product_rule_version||
5449 ' - p_product_rule_name='||p_product_rule_name
5450 ,p_level => C_LEVEL_STATEMENT
5451 ,p_module => l_log_module);
5452
5453 END IF;
5454
5455 g_package_name := p_package_name ;
5456 g_product_rule_code := p_product_rule_code;
5457 g_product_rule_type_code := p_product_rule_type_code;
5458 g_product_rule_version := p_product_rule_version;
5459 g_product_rule_name := p_product_rule_name;
5460 g_application_name := XLA_CMP_PAD_PKG.GetApplicationName(p_application_id);
5461
5462 --
5463 l_events := GetEventClassAndTypeProcs (
5464 p_product_rule_code => p_product_rule_code
5465 , p_product_rule_type_code => p_product_rule_type_code
5466 , p_application_id => p_application_id
5467 , p_amb_context_code => p_amb_context_code
5468 , p_rec_sources => p_rec_sources
5469 , p_rec_aad_objects => p_rec_aad_objects
5470 , p_IsCompiled => l_IsCompiled
5471 );
5472
5473
5474 p_package_body := l_events;
5475
5476 g_package_name := NULL;
5477 g_product_rule_code := NULL;
5478 g_product_rule_type_code := NULL;
5479 g_product_rule_version := NULL;
5480 g_product_rule_name := NULL;
5481
5482 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5483 trace
5484 (p_msg => 'l_IsCompiled = '||
5485 CASE l_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
5486 ,p_level => C_LEVEL_STATEMENT
5487 ,p_module => l_log_module);
5488 trace
5489 (p_msg => 'END of GenerateEventClassAndType'
5490 ,p_level => C_LEVEL_PROCEDURE
5491 ,p_module => l_log_module);
5492 END IF;
5493
5494 RETURN l_IsCompiled;
5495 EXCEPTION
5496 WHEN VALUE_ERROR THEN
5497 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5498 trace
5499 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5500 ,p_level => C_LEVEL_EXCEPTION
5501 ,p_module => l_log_module);
5502 END IF;
5503 RAISE;
5504 WHEN xla_exceptions_pkg.application_exception THEN
5505 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5506 trace
5507 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5508 ,p_level => C_LEVEL_EXCEPTION
5509 ,p_module => l_log_module);
5510 END IF;
5511 RAISE;
5512 WHEN OTHERS THEN
5513 xla_exceptions_pkg.raise_message
5514 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateEventClassAndType ');
5515 END GenerateEventClassAndType;
5516
5517 --+==========================================================================+
5518 --| |
5519 --| |
5520 --| |
5521 --| |
5522 --| |
5523 --| |
5524 --| |
5525 --| |
5526 --| |
5527 --| |
5528 --| Generate main procedure |
5529 --| |
5530 --| |
5531 --| |
5532 --| |
5533 --| |
5534 --| |
5535 --| |
5536 --| |
5537 --| |
5538 --+==========================================================================+
5539
5540
5541 /*---------------------------------------------------------------+
5542 | |
5543 | Private function |
5544 | |
5545 | GenerateMainProcedure |
5546 | |
5547 | Generates call to EventType_xxx() or EventClass_xxx() in AAD |
5548 | package. |
5549 | |
5550 +---------------------------------------------------------------*/
5551
5552 FUNCTION GenerateMainProcedure(
5553 p_application_id IN NUMBER
5554 , p_amb_context_code IN VARCHAR2
5555 , p_product_rule_code IN VARCHAR2
5556 , p_product_rule_type_code IN VARCHAR2
5557 , p_product_rule_name IN VARCHAR2
5558 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
5559 )
5560 RETURN CLOB
5561 IS
5562 ------------------------------------------------------------
5563 --
5564 -- Call to EventClass_X() and EventType_X()
5565 --
5566 ------------------------------------------------------------
5567
5568 C_CALL_EVENT_CLASS CONSTANT VARCHAR2(10000) :='
5569 l_created := EventClass_$Index$(
5570 p_application_id => p_application_id
5571 , p_base_ledger_id => p_base_ledger_id
5572 , p_target_ledger_id => p_target_ledger_id
5573 , p_language => l_language
5574 , p_currency_code => l_currency_code
5575 , p_sla_ledger_id => l_sla_ledger_id
5576 , p_pad_start_date => p_pad_start_date
5577 , p_pad_end_date => p_pad_end_date
5578 , p_primary_ledger_id => p_primary_ledger_id
5579 );
5580
5581 ';
5582
5583 C_CALL_EVENT_TYPE CONSTANT VARCHAR2(10000) := '
5584 l_created := EventType_$Index$(
5585 p_application_id => p_application_id
5586 , p_base_ledger_id => p_base_ledger_id
5587 , p_target_ledger_id => p_target_ledger_id
5588 , p_language => l_language
5589 , p_currency_code => l_currency_code
5590 , p_sla_ledger_id => l_sla_ledger_id
5591 , p_pad_start_date => p_pad_start_date
5592 , p_pad_end_date => p_pad_end_date
5593 , p_primary_ledger_id => p_primary_ledger_id
5594 );
5595
5596 ';
5597
5598 ------------------------------------------------------------
5599 --
5600 -- Call Transaction Objects Diagnostics
5601 --
5602 ------------------------------------------------------------
5603 --
5604 C_CALL_INSERT_EXT_SOURCES CONSTANT VARCHAR2(3000) := '
5605
5606 IF ( g_diagnostics_mode =''Y'' ) THEN
5607
5608 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5609 trace
5610 (p_msg => ''CALL Transaction Objects Diagnostics''
5611 ,p_level => C_LEVEL_STATEMENT
5612 ,p_module => l_log_module);
5613
5614 END IF;
5615
5616 insert_sources_$Index$(
5617 p_target_ledger_id => p_target_ledger_id
5618 , p_language => l_language
5619 , p_sla_ledger_id => l_sla_ledger_id
5620 , p_pad_start_date => p_pad_start_date
5621 , p_pad_end_date => p_pad_end_date
5622 );
5623
5624 END IF;
5625 ';
5626
5627 l_MainBodyProc CLOB;
5628 l_name VARCHAR2(80);
5629 l_ObjectIndex BINARY_INTEGER;
5630 l_call_event VARCHAR2(32000);
5631 l_array_entity xla_cmp_source_pkg.t_array_VL30;
5632 l_array_event_type xla_cmp_source_pkg.t_array_VL30;
5633 l_array_NoAcctg_event_type xla_cmp_source_pkg.t_array_VL30;
5634 l_array_event_class xla_cmp_source_pkg.t_array_VL30;
5635 l_array_EventTypeInClass xla_cmp_source_pkg.t_array_VL30;
5636 l_array_event_class_acctd_flag xla_cmp_source_pkg.t_array_VL1;
5637 l_array_event_class_g_l_flag xla_cmp_source_pkg.t_array_VL1;
5638 l_log_module VARCHAR2(240);
5639
5640 BEGIN
5641
5642 IF g_log_enabled THEN
5643 l_log_module := C_DEFAULT_MODULE||'.GenerateMainProcedure';
5644 END IF;
5645 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5646 trace
5647 (p_msg => 'BEGIN of GenerateMainProcedure'
5648 ,p_level => C_LEVEL_PROCEDURE
5649 ,p_module => l_log_module);
5650 END IF;
5651
5652 l_MainBodyProc := NULL;
5653
5654 GetEventClassEventType(
5655 p_application_id => p_application_id
5656 , p_amb_context_code => p_amb_context_code
5657 , p_product_rule_code => p_product_rule_code
5658 , p_product_rule_type_code => p_product_rule_type_code
5659 , p_array_entity => l_array_entity
5660 , p_array_event_class => l_array_event_class
5661 , p_array_event_type => l_array_event_type
5662 , p_array_event_class_acctd_flag => l_array_event_class_acctd_flag
5663 , p_array_event_class_g_l_flag => l_array_event_class_g_l_flag
5664 );
5665
5666 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5667 trace
5668 (p_msg => 'l_array_event_type.COUNT = '||l_array_event_type.COUNT
5669 ,p_level => C_LEVEL_STATEMENT
5670 ,p_module => l_log_module);
5671 END IF;
5672
5673 GetNoAccountEventTypes(
5674 p_application_id => p_application_id
5675 , p_amb_context_code => p_amb_context_code
5676 , p_product_rule_code => p_product_rule_code
5677 , p_product_rule_type_code => p_product_rule_type_code
5678 , p_array_event_type => l_array_NoAcctg_event_type
5679 )
5680 ;
5681 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5682 trace
5683 (p_msg => 'l_array_NoAcctg_event_type.COUNT = '||l_array_NoAcctg_event_type.COUNT
5684 ,p_level => C_LEVEL_STATEMENT
5685 ,p_module => l_log_module);
5686 END IF;
5687
5688 IF l_array_event_type.COUNT > 0 THEN
5689 FOR Idx IN l_array_event_type.FIRST .. l_array_event_type.LAST LOOP
5690 IF (l_array_event_type(Idx) <> l_array_event_class(Idx)||'_ALL') THEN
5691
5692 l_ObjectIndex := xla_cmp_source_pkg.GetAADObjectPosition(
5693 p_object => xla_cmp_source_pkg.C_EVT
5694 , p_object_code => l_array_event_type(Idx)
5695 , p_object_type_code => 'S'
5696 , p_application_id => p_application_id
5697 , p_event_class_code => NULL
5698 , p_event_type_code => NULL
5699 , p_rec_aad_objects => p_rec_aad_objects);
5700
5701
5702
5703 IF l_ObjectIndex IS NOT NULL THEN
5704 --
5705 l_call_event := C_CALL_EVENT_TYPE ;
5706 l_call_event := l_call_event || C_CALL_INSERT_EXT_SOURCES;
5707 l_call_event := REPLACE(l_call_event,'$Index$', TO_CHAR(l_ObjectIndex));
5708 l_MainBodyProc := l_MainBodyProc ||l_call_event ;
5709 END IF;
5710 ELSE
5711
5712 GetEventType(
5713 p_application_id => p_application_id
5714 , p_entity_code => l_array_entity(Idx)
5715 , p_event_class_code => l_array_event_class(Idx)
5716 , p_array_event_type => l_array_EventTypeInClass);
5717 --
5718 IF l_array_EventTypeInClass.COUNT > 0 THEN
5719
5720 l_ObjectIndex := xla_cmp_source_pkg.GetAADObjectPosition(
5721 p_object => xla_cmp_source_pkg.C_CLASS
5722 , p_object_code => l_array_event_class(Idx)
5723 , p_object_type_code => 'S'
5724 , p_application_id => p_application_id
5725 , p_event_class_code => NULL
5726 , p_event_type_code => NULL
5727 , p_rec_aad_objects => p_rec_aad_objects);
5728
5729 IF l_ObjectIndex IS NOT NULL THEN
5730 --
5731 l_call_event := C_CALL_EVENT_CLASS;
5732 l_call_event := l_call_event ||C_CALL_INSERT_EXT_SOURCES;
5733 l_call_event := REPLACE(l_call_event,'$Index$', TO_CHAR(l_ObjectIndex));
5734 l_MainBodyProc := l_MainBodyProc ||l_call_event ;
5735 END IF;
5736 ELSE
5737 --
5738 BEGIN
5739 --
5740 l_name := GetEventClassName(
5741 p_application_id => p_application_id
5742 , p_entity_code => l_array_entity(Idx)
5743 , p_event_class_code => l_array_event_class(Idx)) ;
5744 --
5745
5746 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5747 trace
5748 (p_msg => 'ERROR: XLA_CMP_NO_EVENT_TYPE '
5749 ,p_level => C_LEVEL_EXCEPTION
5750 ,p_module => l_log_module);
5751 END IF;
5752
5753 xla_exceptions_pkg.raise_message
5754 ('XLA'
5755 ,'XLA_CMP_NO_EVENT_TYPE'
5756 ,'PAD_NAME'
5757 , XLA_CMP_PAD_PKG.g_component_name
5758 ,'PAD_OWNER'
5759 , XLA_CMP_PAD_PKG.g_owner
5760 ,'EVENT_CLASS_NAME'
5761 , l_name);
5762
5763 END;
5764 END IF;
5765 END IF;
5766 END LOOP;
5767 ELSE
5768
5769 l_MainBodyProc := NULL;
5770
5771 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5772 trace
5773 (p_msg => 'ERROR: XLA_CMP_NO_EVENT_CLASS '
5774 ,p_level => C_LEVEL_EXCEPTION
5775 ,p_module => l_log_module);
5776 END IF;
5777 xla_exceptions_pkg.raise_message
5778 ('XLA'
5779 ,'XLA_CMP_NO_EVENT_CLASS'
5780 ,'PAD_NAME'
5781 , XLA_CMP_PAD_PKG.g_component_name
5782 ,'PAD_OWNER'
5783 , XLA_CMP_PAD_PKG.g_owner);
5784 END IF;
5785 --
5786 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5787 trace
5788 (p_msg => 'END of GenerateMainProcedure'
5789 ,p_level => C_LEVEL_PROCEDURE
5790 ,p_module => l_log_module);
5791
5792 END IF;
5793 RETURN l_MainBodyProc;
5794 EXCEPTION
5795 WHEN VALUE_ERROR THEN
5796 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5797 trace
5798 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5799 ,p_level => C_LEVEL_EXCEPTION
5800 ,p_module => l_log_module);
5801 END IF;
5802 RAISE;
5803 WHEN xla_exceptions_pkg.application_exception THEN
5804 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5805 trace
5806 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5807 ,p_level => C_LEVEL_EXCEPTION
5808 ,p_module => l_log_module);
5809 END IF;
5810 RAISE;
5811 WHEN OTHERS THEN
5812 xla_exceptions_pkg.raise_message
5813 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.GenerateMainProcedure');
5814 END GenerateMainProcedure;
5815
5816 /*-----------------------------------------------------------------+
5817 | |
5818 | Public function |
5819 | |
5820 | BuildMainProc |
5821 | |
5822 | Generates the main procedure CreateHeadersAndLines() in the AAD |
5823 | packages |
5824 | |
5825 +-----------------------------------------------------------------*/
5826
5827 FUNCTION BuildMainProc(
5828 p_application_id IN NUMBER
5829 , p_product_rule_code IN VARCHAR2
5830 , p_product_rule_type_code IN VARCHAR2
5831 , p_product_rule_name IN VARCHAR2
5832 , p_product_rule_version IN VARCHAR2
5833 , p_amb_context_code IN VARCHAR2
5834 , p_package_name IN VARCHAR2
5835 --
5836 , p_rec_aad_objects IN xla_cmp_source_pkg.t_rec_aad_objects
5837 --
5838 , p_package_body OUT NOCOPY DBMS_SQL.VARCHAR2S
5839 )
5840 RETURN BOOLEAN
5841 IS
5842 --
5843 l_MainProcedure CLOB;
5844 l_MainBody CLOB;
5845 l_array_main DBMS_SQL.VARCHAR2S;
5846 l_IsCompiled BOOLEAN;
5847 l_log_module VARCHAR2(240);
5848 --
5849 BEGIN
5850 --
5851 IF g_log_enabled THEN
5852 l_log_module := C_DEFAULT_MODULE||'.BuildMainProc';
5853 END IF;
5854 --
5855 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5856 trace
5857 (p_msg => 'BEGIN of BuildMainProc'
5858 ,p_level => C_LEVEL_PROCEDURE
5859 ,p_module => l_log_module);
5860 END IF;
5861
5862 l_IsCompiled := TRUE;
5863 l_array_main := xla_cmp_string_pkg.g_null_varchar2s;
5864 l_MainBody := NULL;
5865
5866 l_MainBody := GenerateMainProcedure(
5867 p_application_id => p_application_id
5868 , p_amb_context_code => p_amb_context_code
5869 , p_product_rule_code => p_product_rule_code
5870 , p_product_rule_type_code => p_product_rule_type_code
5871 , p_product_rule_name => p_product_rule_name
5872 , p_rec_aad_objects => p_rec_aad_objects
5873 );
5874
5875 l_IsCompiled := l_MainBody IS NOT NULL;
5876
5877 l_MainProcedure := C_MAIN_PROCEDURE ;
5878
5879 l_MainProcedure := xla_cmp_string_pkg.replace_token(l_MainProcedure , -- 4417664
5880 '$PACKAGE_NAME$',p_package_name);
5881
5882 l_MainProcedure := xla_cmp_string_pkg.replace_token
5883 (l_MainProcedure
5884 ,'$BODY_MAIN_PROCEDURE$'
5885 ,l_MainBody);
5886
5887 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5888 trace
5889 (p_msg => '-> CALL xla_cmp_string_pkg.CreateString API'
5890 ,p_level => C_LEVEL_STATEMENT
5891 ,p_module => l_log_module);
5892 END IF;
5893
5894 xla_cmp_string_pkg.CreateString
5895 (p_package_text => l_MainProcedure
5896 ,p_array_string => l_array_main);
5897
5898 p_package_body := l_array_main ;
5899
5900 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5901 trace
5902 (p_msg => 'l_IsCompiled = '||
5903 CASE l_IsCompiled WHEN TRUE THEN 'TRUE' ELSE 'FALSE' END
5904 ,p_level => C_LEVEL_STATEMENT
5905 ,p_module => l_log_module);
5906 trace
5907 (p_msg => 'END of BuildMainProc'
5908 ,p_level => C_LEVEL_PROCEDURE
5909 ,p_module => l_log_module);
5910 END IF;
5911 --
5912 RETURN l_IsCompiled;
5913 EXCEPTION
5914 WHEN VALUE_ERROR THEN
5915 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5916 trace
5917 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5918 ,p_level => C_LEVEL_EXCEPTION
5919 ,p_module => l_log_module);
5920 END IF;
5921 RAISE;
5922 WHEN xla_exceptions_pkg.application_exception THEN
5923 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5924 trace
5925 (p_msg => 'ERROR: XLA_CMP_COMPILER_ERROR = '||sqlerrm
5926 ,p_level => C_LEVEL_EXCEPTION
5927 ,p_module => l_log_module);
5928 END IF;
5929 RAISE;
5930 WHEN OTHERS THEN
5931 xla_exceptions_pkg.raise_message
5932 (p_location => 'XLA_CMP_EVENT_TYPE_PKG.BuildMainProc');
5933 END BuildMainProc;
5934 --
5935 --=============================================================================
5936 --
5937 --
5938 --
5939 --
5940 --
5941 --
5942 --
5943 --
5944 --
5945 --
5946 --
5947 --
5948 --
5949 --
5950 --
5951 --
5952 --
5953 --
5954 --
5955 --
5956 --
5957 --
5958 --=============================================================================
5959 --=============================================================================
5960 -- *********** Initialization routine **********
5961 --=============================================================================
5962
5963 BEGIN
5964
5965 g_log_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
5966 g_log_enabled := fnd_log.test
5967 (log_level => g_log_level
5968 ,module => C_DEFAULT_MODULE);
5969
5970 IF NOT g_log_enabled THEN
5971 g_log_level := C_LEVEL_LOG_DISABLED;
5972 END IF;
5973 --
5974 END xla_cmp_event_type_pkg; --