[Home] [Help]
PACKAGE BODY: APPS.XLA_CMP_TAB_PKG
Source
1 PACKAGE BODY xla_cmp_tab_pkg AS
2 /* $Header: xlacptab.pkb 120.15.12000000.2 2007/10/09 08:10:24 vkasina ship $ */
3 /*======================================================================+
4 | Copyright (c) 1995-2002 Oracle Corporation |
5 | Redwood Shores, CA, USA |
6 | All rights reserved. |
7 +=======================================================================+
8 | PACKAGE NAME |
9 | xla_cmp_tab_pkg |
10 | |
11 | DESCRIPTION |
12 | Transaction Account Builder API Compiler |
13 | |
14 | HISTORY |
15 | 26-JAN-04 A.Quaglia Created |
16 | 04-JUN-04 A.Quaglia Changed hash_id to NUMBER |
17 | ,row_id to base_rowid |
18 | ,ccid, target_ccid to NUMBER(15) |
19 | 07-JUN-04 A.Quaglia Fixed NOCOPY in one forward declaration |
20 | 17-JUN-04 A.Quaglia compile_api_srs: added messaging for conc |
21 | request. |
22 | Some params were still IN OUT instd of OUT|
23 | 18-JUN-04 A.Quaglia Added concatenated_segments to the API |
24 | 21-JUN-04 A.Quaglia get_ccid_additional_info: |
25 | removed x_concatenated_values |
26 | 21-JUN-04 A.Quaglia build_declarations: |
27 | removed condition on compile status |
28 | when selecting the TAT sources: |
29 | Introduced local variables so that OUT |
30 | params are assigned at the end. |
31 | build_implementations: |
32 | removed condition on compile status |
33 | when selecting the TAT sources: |
34 | build_global_temp_table |
35 | removed condition on compile status |
36 | when selecting the TAT sources: |
37 | 30-JUL-04 A.Quaglia changed message tokens |
38 | 18-MAI-05 K.Boussema added the column dummy_rowid in GT tables |
39 | to fix bug 4344773 |
40 | 10-MAR-2006 Jorge Larre Bug 5088359 |
41 | Add ORDER BY xsb.source_code to the selects that retrieve the |
42 | sources to build the interface table to be in sync with the |
43 | select that retrieves the source to build the compiled package. |
44 | 11-AUG-2006 Jorge Larre Bug 5318196 |
45 | a)In procedure write_online_tab (C_TMPL_TAB_WRITE_PROC_IMPL) |
46 | the determination of the new index for inserting a new row in |
47 | g_array_xla_tab must be done with COUNT + 1 instead of COUNT. |
48 | The loop that uses l_watermark must be begin with FIRST |
49 | instead of 0. |
50 | b)In procedure read_online_tab (C_TMPL_TAB_READ_PROC_IMPL) |
51 | the loop that uses l_watermark must be begin with FIRST |
52 | instead of 0. |
53 | 15-AUG-2006 Jorge Larre Bug 5318196 |
54 | a)In procedure write_online_tab (C_TMPL_TAB_WRITE_PROC_IMPL) |
55 | the array may be empty, so we must use a variable to store |
56 | the value of FIRST and nullify it with 1. New variable: |
57 | l_start. |
58 | b)In procedure read_online_tab (C_TMPL_TAB_READ_PROC_IMPL) |
59 | the array may be empty, so we must use a variable to store |
60 | the value of FIRST and nullify it with 1. New variable: |
61 | l_start. |
62 +======================================================================*/
63
64 --
65 -- Private exceptions
66 --
67
68 le_fatal_error EXCEPTION;
69
70 --
71 -- Private types
72 --
73 --
74 -- Private constants
75 --
76
77 g_chr_newline CONSTANT VARCHAR2(1) := xla_environment_pkg.g_chr_newline;
78
79 G_STANDARD_MESSAGE CONSTANT VARCHAR2(1) := xla_exceptions_pkg.C_STANDARD_MESSAGE;
80 G_OA_MESSAGE CONSTANT VARCHAR2(1) := xla_exceptions_pkg.C_OA_MESSAGE;
81
82 --Set the message mode to use the message stack instead of raising an exception
83 g_msg_mode CONSTANT VARCHAR2(1) := G_OA_MESSAGE;
84
85
86 --+==========================================================================+
87 --| package specification template |
88 --+==========================================================================+
89
90 --
91 C_TMPL_TAB_PACKAGE_SPEC CONSTANT CLOB :=
92 'CREATE OR REPLACE PACKAGE $TAB_API_PACKAGE_NAME_1$ AS' ||
93 g_chr_newline||
94 '/'||'* $Header: xlacptab.pkb 120.15.12000000.2 2007/10/09 08:10:24 vkasina ship $ */' ||
95 g_chr_newline||
96 '/'|| '*======================================================================+
97 | Copyright (c) 2004 Oracle Corporation |
98 | Redwood Shores, CA, USA |
99 | All rights reserved. |
100 +=======================================================================+
101 | PACKAGE NAME |
102 | $TAB_API_PACKAGE_NAME_2$
103 | |
104 | DESCRIPTION |
105 | |
106 | Transaction Account Builder API. |
107 | |
108 | Package generated by Oracle Subledger Accounting for |
109 | |
110 | $APPLICATION_NAME$
111 | (application_id: $APPLICATION_ID$
112 | |
113 | ATTENTION: |
114 | This package has been automatically generated by the |
115 | Oracle Subledger Accounting Compiler. You should not modify its |
116 | content manually. |
117 | This package has been generated according to the Transaction |
118 | Account Types setup for this application. |
119 | In case of issues independent of the setup (e.g. GSCC errors) |
120 | please log a bug against Oracle Subledger Accounting. |
121 | |
122 | |
123 | HISTORY |
124 | $HISTORY$
125 | |
126 +=======================================================================*'
127 ||'/'
128 ||
129 '
130
131 --Public constants
132 C_RET_STS_SUCCESS CONSTANT VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
133 C_RET_STS_ERROR CONSTANT VARCHAR2(1) := FND_API.G_RET_STS_ERROR;
134 C_RET_STS_UNEXP_ERROR CONSTANT VARCHAR2(1) := FND_API.G_RET_STS_UNEXP_ERROR;
135 C_FALSE CONSTANT VARCHAR2(1) := FND_API.G_FALSE;
136 C_TRUE CONSTANT VARCHAR2(1) := FND_API.G_TRUE;
137
138 --Public record types
139 $TAB_REC_TYPE_DECLARATIONS$
140
141
142 --Public table types
143 $TAB_TABLE_TYPE_DECLARATIONS$
144
145
146 --Public variables
147 $TAB_TABLE_VAR_DECLARATIONS$
148
149
150 --Public procedures
151 PROCEDURE run
152 (
153 p_api_version IN NUMBER
154 ,p_account_definition_type_code IN VARCHAR2
155 ,p_account_definition_code IN VARCHAR2
156 ,p_transaction_coa_id IN NUMBER
157 ,p_mode IN VARCHAR2
158 ,x_return_status OUT NOCOPY VARCHAR2
159 ,x_msg_count OUT NOCOPY NUMBER
160 ,x_msg_data OUT NOCOPY VARCHAR2
161 );
162
163 PROCEDURE reset_online_interface
164 (
165 p_api_version IN NUMBER
166 ,x_return_status OUT NOCOPY VARCHAR2
167 ,x_msg_count OUT NOCOPY NUMBER
168 ,x_msg_data OUT NOCOPY VARCHAR2
169 );
170
171 $TAB_WRITE_PROC_DECLARATIONS$
172
173 $TAB_READ_PROC_DECLARATIONS$
174
175 END $TAB_API_PACKAGE_NAME_1$;
176 ';
177
178 --+==========================================================================+
179 --| end of package specification template |
180 --+==========================================================================+
181
182 --+==========================================================================+
183 --| global temporary table declaration template |
184 --+==========================================================================+
185 C_TMPL_TAB_GLOBAL_TEMP_TABLE CONSTANT CLOB :=
186 'CREATE GLOBAL TEMPORARY TABLE $ORACLE_USER_NAME$.$GLOBAL_TABLE_NAME$
187 ( SOURCE_DISTRIBUTION_ID_CHAR_1 VARCHAR2(240) --INPUT
188 ,SOURCE_DISTRIBUTION_ID_CHAR_2 VARCHAR2(240) --INPUT
189 ,SOURCE_DISTRIBUTION_ID_CHAR_3 VARCHAR2(240) --INPUT
190 ,SOURCE_DISTRIBUTION_ID_CHAR_4 VARCHAR2(240) --INPUT
191 ,SOURCE_DISTRIBUTION_ID_CHAR_5 VARCHAR2(240) --INPUT
192 ,SOURCE_DISTRIBUTION_ID_NUM_1 NUMBER --INPUT
193 ,SOURCE_DISTRIBUTION_ID_NUM_2 NUMBER --INPUT
194 ,SOURCE_DISTRIBUTION_ID_NUM_3 NUMBER --INPUT
195 ,SOURCE_DISTRIBUTION_ID_NUM_4 NUMBER --INPUT
196 ,SOURCE_DISTRIBUTION_ID_NUM_5 NUMBER --INPUT
197 ,ACCOUNT_TYPE_CODE VARCHAR2(30) NOT NULL --INPUT
198 $SOURCE_TABLE_FIELD_DECLARATIONS$
199 ,PROCESSED_FLAG VARCHAR2(1) --INTERNAL
200 ,SEGMENT1 VARCHAR2(30) --INTERNAL
201 ,SEGMENT2 VARCHAR2(30) --INTERNAL
202 ,SEGMENT3 VARCHAR2(30) --INTERNAL
203 ,SEGMENT4 VARCHAR2(30) --INTERNAL
204 ,SEGMENT5 VARCHAR2(30) --INTERNAL
205 ,SEGMENT6 VARCHAR2(30) --INTERNAL
206 ,SEGMENT7 VARCHAR2(30) --INTERNAL
207 ,SEGMENT8 VARCHAR2(30) --INTERNAL
208 ,SEGMENT9 VARCHAR2(30) --INTERNAL
209 ,SEGMENT10 VARCHAR2(30) --INTERNAL
210 ,SEGMENT11 VARCHAR2(30) --INTERNAL
211 ,SEGMENT12 VARCHAR2(30) --INTERNAL
212 ,SEGMENT13 VARCHAR2(30) --INTERNAL
213 ,SEGMENT14 VARCHAR2(30) --INTERNAL
214 ,SEGMENT15 VARCHAR2(30) --INTERNAL
215 ,SEGMENT16 VARCHAR2(30) --INTERNAL
216 ,SEGMENT17 VARCHAR2(30) --INTERNAL
217 ,SEGMENT18 VARCHAR2(30) --INTERNAL
218 ,SEGMENT19 VARCHAR2(30) --INTERNAL
219 ,SEGMENT20 VARCHAR2(30) --INTERNAL
220 ,SEGMENT21 VARCHAR2(30) --INTERNAL
221 ,SEGMENT22 VARCHAR2(30) --INTERNAL
222 ,SEGMENT23 VARCHAR2(30) --INTERNAL
223 ,SEGMENT24 VARCHAR2(30) --INTERNAL
224 ,SEGMENT25 VARCHAR2(30) --INTERNAL
225 ,SEGMENT26 VARCHAR2(30) --INTERNAL
226 ,SEGMENT27 VARCHAR2(30) --INTERNAL
227 ,SEGMENT28 VARCHAR2(30) --INTERNAL
228 ,SEGMENT29 VARCHAR2(30) --INTERNAL
229 ,SEGMENT30 VARCHAR2(30) --INTERNAL
230 ,TARGET_CCID NUMBER(15) --OUTPUT
231 ,CONCATENATED_SEGMENTS VARCHAR2(2000) --OUTPUT
232 ,MSG_COUNT NUMBER --OUTPUT
233 ,MSG_DATA VARCHAR2(2000) --OUTPUT
234 ,DUMMY_ROWID UROWID --INTERNAL
235 )
236 ON COMMIT DELETE ROWS';
237
238 C_TMPL_SOURCE_TABLE_FIELD_DECL CONSTANT CLOB :=
239 ' ,$SOURCE_CODE$ $SOURCE_SPECIFIC_DATATYPE$ --INPUT';
240
241
242 C_TMPL_TAB_GLOBAL_TABLE_NAME CONSTANT CLOB :=
243 '$PRODUCT_ABBR$_XLA_TAB$OBJECT_NAME_AFFIX$GT';
244
245 --N.B.: the following constant is not used in the templates
246 C_TMPL_TAB_PLSQL_TABLE_NAME CONSTANT CLOB :=
247 'g_array_xla_tab$OBJECT_NAME_AFFIX$';
248
249
250 --+==========================================================================+
251 --| package body template |
252 --+==========================================================================+
253
254 --
255 C_TMPL_TAB_PACKAGE_BODY CONSTANT CLOB :=
256 'CREATE OR REPLACE PACKAGE BODY $TAB_API_PACKAGE_NAME_1$ AS' ||
257 g_chr_newline||
258 '/'||'* $Header: xlacptab.pkb 120.15.12000000.2 2007/10/09 08:10:24 vkasina ship $ */' ||
259 g_chr_newline||
260 '/'|| '*======================================================================+
261 | Copyright (c) 2004 Oracle Corporation |
262 | Redwood Shores, CA, USA |
263 | All rights reserved. |
264 +=======================================================================+
265 | PACKAGE NAME |
266 | $TAB_API_PACKAGE_NAME_2$
267 | |
268 | DESCRIPTION |
269 | |
270 | Transaction Account Builder API. |
271 | |
272 | Package generated by Oracle Subledger Accounting for |
273 | |
274 | $APPLICATION_NAME$
275 | (application_id: $APPLICATION_ID$
276 | |
277 | ATTENTION: |
278 | This package has been automatically generated by the |
279 | Oracle Subledger Accounting Compiler. You should not modify its |
280 | content manually. |
281 | This package has been generated according to the Transaction |
282 | Account Types setup for this application. |
283 | In case of issues independent of the setup (e.g. GSCC errors) |
284 | please log a bug against Oracle Subledger Accounting. |
285 | |
286 | |
287 | HISTORY |
288 | $HISTORY$
289 | |
290 +=======================================================================*'
291 ||'/'
292 ||
293 '
294 --Private exceptions
295 le_fatal_error EXCEPTION;
296 --Private constants
297 C_API_VERSION CONSTANT NUMBER(1) := 1;
298 C_PACKAGE_NAME CONSTANT VARCHAR2(30) := ''$TAB_API_PACKAGE_NAME_1$'';
299
300
301 --=============================================================================
302 -- *********** Local Trace Routine **********
303 --=============================================================================
304 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
305 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
306 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
307 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
308 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
309 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
310
311 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
312 C_DEFAULT_MODULE CONSTANT VARCHAR2(240) := ''$oracle_user_name$.plsql.$TAB_API_PACKAGE_NAME_3$'';
313
314 g_log_level NUMBER;
315 g_log_enabled BOOLEAN;
316
317 PROCEDURE trace
318 ( p_module IN VARCHAR2 DEFAULT C_DEFAULT_MODULE
319 ,p_msg IN VARCHAR2
320 ,p_level IN NUMBER
321 )
322 IS
323 BEGIN
324 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
325 fnd_log.message(p_level, p_module);
326 ELSIF p_level >= g_log_level THEN
327 fnd_log.string(p_level, p_module, p_msg);
328 END IF;
329
330 EXCEPTION
331 WHEN app_exceptions.application_exception THEN
332 RAISE;
333 WHEN OTHERS THEN
334 fnd_message.set_name(''XLA'', ''XLA_TAB_UNHANDLED_EXCEPTION'');
335 fnd_message.set_token( ''PROCEDURE''
336 ,''$TAB_API_PACKAGE_NAME_3$.trace'');
337 RAISE;
338 END trace;
339
340 --Private procedure
341 PROCEDURE reset_online_interface
342 IS
343 l_log_module VARCHAR2 (2000);
344 BEGIN
345 IF g_log_enabled THEN
346 l_log_module := C_DEFAULT_MODULE||''.reset_online_interface'';
347 END IF;
348
349 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
350 trace
351 ( p_module => l_log_module
352 ,p_msg => ''BEGIN '' || l_log_module
353 ,p_level => C_LEVEL_PROCEDURE);
354 END IF;
355
356 --Remove all the elements from the PLSQL tables
357 $RESET_ONLINE_INTERFACES_STMTS$
358
359 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
360 trace
361 (p_msg => ''END '' || l_log_module
362 ,p_level => C_LEVEL_PROCEDURE);
363 END IF;
364
365 EXCEPTION
366 WHEN OTHERS THEN
367 RAISE;
368 END reset_online_interface;
369
370
371
372 --Public procedures
373 PROCEDURE run
374 (
375 p_api_version IN NUMBER
376 ,p_account_definition_type_code IN VARCHAR2
377 ,p_account_definition_code IN VARCHAR2
378 ,p_transaction_coa_id IN NUMBER
379 ,p_mode IN VARCHAR2
380 ,x_return_status OUT NOCOPY VARCHAR2
381 ,x_msg_count OUT NOCOPY NUMBER
382 ,x_msg_data OUT NOCOPY VARCHAR2
383 )
384 IS
385 l_return_status VARCHAR2(1);
386 l_return_msg_name VARCHAR2(30);
387 l_msg_count NUMBER;
388 l_msg_data VARCHAR2(2000);
389 l_log_module VARCHAR2 (2000);
390 BEGIN
391 IF g_log_enabled THEN
392 l_log_module := C_DEFAULT_MODULE||''.run'';
393 END IF;
394
395 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
396 trace
397 ( p_module => l_log_module
398 ,p_msg => ''BEGIN '' || l_log_module
399 ,p_level => C_LEVEL_PROCEDURE);
400 END IF;
401
402 --Initialize the global message table
403 FND_MSG_PUB.Initialize;
404
405 xla_tab_pub_pkg.run
406 (
407 p_api_version => p_api_version
408 ,p_application_id => $APPLICATION_ID_2$
409 ,p_account_definition_type_code => p_account_definition_type_code
410 ,p_account_definition_code => p_account_definition_code
411 ,p_transaction_coa_id => p_transaction_coa_id
412 ,p_mode => p_mode
413 ,x_return_status => l_return_status
414 ,x_msg_count => l_msg_count
415 ,x_msg_data => l_msg_data
416 );
417
418 IF l_return_status <> C_RET_STS_SUCCESS
419 THEN
420 --Push the error message again so that it does not get lost
421 IF l_msg_data IS NOT NULL
422 THEN
423 fnd_msg_pub.initialize;
424
425 fnd_message.set_encoded
426 (
427 encoded_message => l_msg_data
428 );
429
430 --Add it to the message table
431 fnd_msg_pub.add;
432
433 --Reset single message variables
434 l_msg_count := NULL;
435 l_msg_data := NULL;
436 END IF;
437 RAISE le_fatal_error;
438 END IF;
439
440 --Assign out parameters
441 x_msg_count := NVL(l_msg_count, 0);
442 x_msg_data := l_msg_data;
443 x_return_status := C_RET_STS_SUCCESS;
444
445 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
446 trace
447 ( p_module => l_log_module
448 ,p_msg => ''END '' || l_log_module
449 ,p_level => C_LEVEL_PROCEDURE);
450 END IF;
451
452 EXCEPTION
453 WHEN le_fatal_error THEN
454 --Remove all the elements from the PLSQL table
455 reset_online_interface;
456 --If there is a no token message to log
457 --Set the failure message on the stack
458 fnd_message.set_name
459 (
460 application => ''XLA''
461 ,name => ''XLA_TAB_RUN_FAILED''
462 );
463 fnd_message.set_token( ''FUNCTION_NAME''
464 ,''$TAB_API_PACKAGE_NAME_3$.run'');
465
466 --Add it to the message table
467 fnd_msg_pub.add;
468
469 --If there is only one message retrieve it
470 fnd_msg_pub.Count_And_Get
471 (
472 p_count => l_msg_count
473 ,p_data => l_msg_data
474 );
475 --Put the message on the stack to ensure old Forms detect the error
476 fnd_message.set_encoded
477 (
478 encoded_message => l_msg_data
479 );
480 --Assign out parameters
481 x_msg_count := l_msg_count;
482 x_msg_data := l_msg_data;
483 IF l_return_status IS NOT NULL
484 THEN
485 x_return_status := l_return_status;
486 ELSE
487 x_return_status := C_RET_STS_UNEXP_ERROR;
488 END IF;
489 WHEN OTHERS THEN
490 --Remove all the elements from the PLSQL table
491 reset_online_interface;
492 --Add the standard unexpected error message
493 fnd_msg_pub.Add_Exc_Msg
494 ( p_pkg_name => C_PACKAGE_NAME
495 ,p_procedure_name => ''run''
496 );
497 --If there is only one message retrieve it
498 fnd_msg_pub.Count_And_Get
499 (
500 p_count => l_msg_count
501 ,p_data => l_msg_data
502 );
503 --Put the message on the stack to ensure all Forms detect the error
504 fnd_message.set_encoded
505 (
506 encoded_message => l_msg_data
507 );
508 --Assign out parameters
509 x_msg_count := l_msg_count;
510 x_msg_data := l_msg_data;
511 x_return_status := C_RET_STS_UNEXP_ERROR;
512 END run;
513
514
515 PROCEDURE reset_online_interface
516 (
517 p_api_version IN NUMBER
518 ,x_return_status OUT NOCOPY VARCHAR2
519 ,x_msg_count OUT NOCOPY NUMBER
520 ,x_msg_data OUT NOCOPY VARCHAR2
521 )
522 IS
523 l_return_status VARCHAR2(1);
524 l_return_msg_name VARCHAR2(30);
525
526 l_msg_count NUMBER;
527 l_msg_data VARCHAR2(2000);
528
529 l_log_module VARCHAR2 (2000);
530
531 BEGIN
532 IF g_log_enabled THEN
533 l_log_module := C_DEFAULT_MODULE||''.reset_online_interface'';
534 END IF;
535
536 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
537 trace
538 ( p_module => l_log_module
539 ,p_msg => ''BEGIN '' || l_log_module
540 ,p_level => C_LEVEL_PROCEDURE);
541 END IF;
542
543 --Initialize the global message table
544 FND_MSG_PUB.Initialize;
545
546 --Initialize return status and message local variables
547 l_return_msg_name:= NULL;
548 l_return_status := NULL;
549
550 IF NOT FND_API.Compatible_API_Call
551 (
552 p_current_version_number => C_API_VERSION
553 ,p_caller_version_number => p_api_version
554 ,p_api_name => ''reset_online_interface''
555 ,p_pkg_name => C_PACKAGE_NAME
556 )
557 THEN
558 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
559 END IF;
560
561 --Remove all the elements from the PLSQL tables
562 reset_online_interface;
563
564 --Assign out parameters
565 x_msg_count := l_msg_count;
566 x_msg_data := l_msg_data;
567
568 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
569 trace
570 ( p_module => l_log_module
571 ,p_msg => ''END '' || l_log_module
572 ,p_level => C_LEVEL_PROCEDURE);
573 END IF;
574
575 EXCEPTION
576 WHEN le_fatal_error THEN
577 --If there is a no token message to log
578 IF l_return_msg_name IS NOT NULL
579 THEN
580 --Set it on the stack
581 fnd_message.set_name
582 (
583 application => ''XLA''
584 ,name => l_return_msg_name
585 );
586 --Add it to the message table
587 fnd_msg_pub.add;
588 END IF;
589 --If there is only one message retrieve it
590 fnd_msg_pub.Count_And_Get
591 (
592 p_count => l_msg_count
593 ,p_data => l_msg_data
594 );
595 --Put the message on the stack to ensure old Forms detect the error
596 fnd_message.set_encoded
597 (
598 encoded_message => l_msg_data
599 );
600 --Assign out parameters
601 x_msg_count := l_msg_count;
602 x_msg_data := l_msg_data;
603 IF l_return_status IS NOT NULL
604 THEN
605 x_return_status := l_return_status;
606 ELSE
607 x_return_status := C_RET_STS_UNEXP_ERROR;
608 END IF;
609 WHEN OTHERS THEN
610 --Add the standard unexpected error message
611 fnd_msg_pub.Add_Exc_Msg
612 ( p_pkg_name => C_PACKAGE_NAME
613 ,p_procedure_name => ''reset_online_interface''
614 );
615 --If there is only one message retrieve it
616 fnd_msg_pub.Count_And_Get
617 (
618 p_count => l_msg_count
619 ,p_data => l_msg_data
620 );
621 --Put the message on the stack to ensure all Forms detect the error
622 fnd_message.set_encoded
623 (
624 encoded_message => l_msg_data
625 );
626 --Assign out parameters
627 x_msg_count := l_msg_count;
628 x_msg_data := l_msg_data;
629 x_return_status := C_RET_STS_UNEXP_ERROR;
630 END reset_online_interface;
631
632
633 $TAB_WRITE_PROC_IMPLS$
634
635 $TAB_READ_PROC_IMPLS$
636
637
638 --Trace initialization
639 BEGIN
640 g_log_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
641 g_log_enabled := fnd_log.test
642 (log_level => g_log_level
643 ,module => C_DEFAULT_MODULE);
644
645 IF NOT g_log_enabled THEN
646 g_log_level := C_LEVEL_LOG_DISABLED;
647 END IF;
648
649
650 END $TAB_API_PACKAGE_NAME_1$;
651 ';
652
653 --+==========================================================================+
654 --| end of package body template |
655 --+==========================================================================+
656
657
658
659 C_TMPL_TAB_RESET_ONLINE_INT_ST CONSTANT VARCHAR2(100) :=
660 ' g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE;
661 ';
662
663
664
665 C_TMPL_TAB_REC_TYPE_DECLAR CONSTANT CLOB :=
666 ' TYPE t_rec_xla_tab$OBJECT_NAME_AFFIX$ IS RECORD
667 ( base_rowid UROWID --INTERNAL
668 ,source_distribution_id_num_1 NUMBER --INPUT
669 ,source_distribution_id_num_2 NUMBER --INPUT
670 ,source_distribution_id_num_3 NUMBER --INPUT
671 ,source_distribution_id_num_4 NUMBER --INPUT
672 ,source_distribution_id_num_5 NUMBER --INPUT
673 ,account_type_code VARCHAR2(30) --NOT NULL --INPUT
674 --START of source list
675 $SOURCE_REC_FIELD_DECLARATIONS$
676 --END of source list
677 ,target_ccid NUMBER(15) --OUTPUT
678 ,concatenated_segments VARCHAR2(2000) --OUTPUT
679 ,msg_count NUMBER --OUTPUT
680 ,msg_data VARCHAR2(2000) --OUTPUT
681 );
682 ';
683
684 C_TMPL_SOURCE_REC_FIELD_DECLAR CONSTANT CLOB :=
685 ' ,$SOURCE_CODE$ $SOURCE_SPECIFIC_DATATYPE$ --INPUT';
686
687 C_CHAR_SOURCE_SIZE CONSTANT INTEGER := 80;
688
689 C_TMPL_TAB_TABLE_TYPE_DECLAR CONSTANT CLOB :=
690 ' TYPE t_array_xla_tab$OBJECT_NAME_AFFIX$
691 IS TABLE OF t_rec_xla_tab$OBJECT_NAME_AFFIX$ INDEX BY BINARY_INTEGER;';
692
693 C_TMPL_TAB_TABLE_VAR_DECLAR CONSTANT CLOB :=
694 ' g_array_xla_tab$OBJECT_NAME_AFFIX$ t_array_xla_tab$OBJECT_NAME_AFFIX$;';
695
696
697 C_TMPL_SOURCE_REC_FIELD_ASSGN CONSTANT CLOB :=
698 ' g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).$SOURCE_CODE_LEFT$ := $SOURCE_CODE_RIGHT$;';
699
700 C_TMPL_TAB_WRITE_PROC_NAME CONSTANT VARCHAR2(100) :=
701 'write_online_tab$OBJECT_NAME_AFFIX$';
702
703 C_TMPL_TAB_WRITE_PROC_DECLAR CONSTANT CLOB :=
704 ' PROCEDURE ' || C_TMPL_TAB_WRITE_PROC_NAME || '
705 (
706 p_api_version IN NUMBER --INPUT NOT NULL
707 ,p_source_distrib_id_num_1 IN NUMBER --INPUT
708 ,p_source_distrib_id_num_2 IN NUMBER --INPUT
709 ,p_source_distrib_id_num_3 IN NUMBER --INPUT
710 ,p_source_distrib_id_num_4 IN NUMBER --INPUT
711 ,p_source_distrib_id_num_5 IN NUMBER --INPUT
712 ,p_account_type_code IN VARCHAR2 --INPUT NOT NULL
713 --START of source list
714 $SOURCE_PROC_PARAM_DECLARATIONS$
715 --END of source list
716 ,x_return_status OUT NOCOPY VARCHAR2 --OUTPUT
717 ,x_msg_count OUT NOCOPY NUMBER --OUTPUT
718 ,x_msg_data OUT NOCOPY VARCHAR2 --OUTPUT
719 );';
720
721
722 C_TMPL_TAB_WRITE_PROC_IMPL CONSTANT CLOB :=
723 ' PROCEDURE '|| C_TMPL_TAB_WRITE_PROC_NAME || '
724 (
725 p_api_version IN NUMBER --INPUT NOT NULL
726 ,p_source_distrib_id_num_1 IN NUMBER --INPUT
727 ,p_source_distrib_id_num_2 IN NUMBER --INPUT
728 ,p_source_distrib_id_num_3 IN NUMBER --INPUT
729 ,p_source_distrib_id_num_4 IN NUMBER --INPUT
730 ,p_source_distrib_id_num_5 IN NUMBER --INPUT
731 ,p_account_type_code IN VARCHAR2 --INPUT NOT NULL
732 --START of source list
733 $SOURCE_PROC_PARAM_DECLARATIONS$
734 --END of source list
735 ,x_return_status OUT NOCOPY VARCHAR2 --OUTPUT
736 ,x_msg_count OUT NOCOPY NUMBER --OUTPUT
737 ,x_msg_data OUT NOCOPY VARCHAR2 --OUTPUT
738 )
739 IS
740 l_return_status VARCHAR2(1);
741 l_return_msg_name VARCHAR2(30);
742 l_msg_count NUMBER;
743 l_msg_data VARCHAR2(2000);
744 l_watermark NUMBER;
745 l_start NUMBER;
746 l_new_idx NUMBER;
747
748 l_log_module VARCHAR2 (2000);
749 BEGIN
750 IF g_log_enabled THEN
751 l_log_module := C_DEFAULT_MODULE||''write_online_tab$OBJECT_NAME_AFFIX$'';
752 END IF;
753
754 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
755 trace
756 ( p_module => l_log_module
757 ,p_msg => ''BEGIN '' || l_log_module
758 ,p_level => C_LEVEL_PROCEDURE);
759 END IF;
760
761 --Initialize the global message table
762 FND_MSG_PUB.Initialize;
763
764 --Initialize return status and message local variables
765 l_return_msg_name := NULL;
766 l_return_status := NULL;
767
768 IF NOT FND_API.Compatible_API_Call
769 (
770 p_current_version_number => C_API_VERSION
771 ,p_caller_version_number => p_api_version
772 ,p_api_name => ''write_online_tab$OBJECT_NAME_AFFIX$''
773 ,p_pkg_name => C_PACKAGE_NAME
774 )
775 THEN
776 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
777 END IF;
778
779 --p_account_type_code cannot be NULL
780 IF p_account_type_code IS NULL
781 THEN
782 --Assign an error message and a return code of FAILURE
783 l_return_msg_name := ''XLA_TAB_WR_ROW_ACCT_TYPE_NULL'';
784 RAISE le_fatal_error;
785 END IF;
786
787 --Get the highest index of the PL/SQL table
788 --Cannot use COUNT since some elements might have been
789 --collected and deleted
790 l_watermark := NVL(g_array_xla_tab$OBJECT_NAME_AFFIX$.LAST, 1);
791 l_start := NVL(g_array_xla_tab$OBJECT_NAME_AFFIX$.FIRST, 1);
792
793 --Loop on all the rows of the PL/SQL table
794 FOR i IN l_start..l_watermark
795 LOOP
796 --If the current row has the same key of the new row
797 IF g_array_xla_tab$OBJECT_NAME_AFFIX$.EXISTS(i)
798 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_1 = p_source_distrib_id_num_1
799 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_1 IS NULL AND p_source_distrib_id_num_1 IS NULL
800 )
801 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_2 = p_source_distrib_id_num_2
802 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_2 IS NULL AND p_source_distrib_id_num_2 IS NULL
803 )
804 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_3 = p_source_distrib_id_num_3
805 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_3 IS NULL AND p_source_distrib_id_num_3 IS NULL
806 )
807 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_4 = p_source_distrib_id_num_4
808 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_4 IS NULL AND p_source_distrib_id_num_4 IS NULL
809 )
810 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_5 = p_source_distrib_id_num_5
811 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_5 IS NULL AND p_source_distrib_id_num_5 IS NULL
812 )
813 AND g_array_xla_tab$OBJECT_NAME_AFFIX$(i).account_type_code = p_account_type_code
814 THEN
815 --Assign a return code of FAILURE
816 l_return_status := C_RET_STS_UNEXP_ERROR;
817 --Set the TAB message onto the message stack
818 FND_MESSAGE.SET_NAME
819 (
820 application => ''XLA''
821 ,name => ''XLA_TAB_WR_ROW_DUPLICATE''
822 );
823
824 --Replace the token for the flex message retrieved above
825 FND_MESSAGE.SET_TOKEN
826 (
827 token => ''TRX_ACCT_TYPE_CODE''
828 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).account_type_code
829 );
830 --Replace the token for the flex message retrieved above
831 FND_MESSAGE.SET_TOKEN
832 (
833 token => ''SOURCE_DIST_ID_NUM1''
834 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_1
835 );
836 --Replace the token for the flex message retrieved above
837 FND_MESSAGE.SET_TOKEN
838 (
839 token => ''SOURCE_DIST_ID_NUM2''
840 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_2
841 );
842 --Replace the token for the flex message retrieved above
843 FND_MESSAGE.SET_TOKEN
844 (
845 token => ''SOURCE_DIST_ID_NUM3''
846 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_3
847 );
848 --Replace the token for the flex message retrieved above
849 FND_MESSAGE.SET_TOKEN
850 (
851 token => ''SOURCE_DIST_ID_NUM4''
852 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_4
853 );
854 --Replace the token for the flex message retrieved above
855 FND_MESSAGE.SET_TOKEN
856 (
857 token => ''SOURCE_DIST_ID_NUM5''
858 ,value => g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_5
859 );
860
861 fnd_msg_pub.add;
862
863 --Raise a local exception
864 RAISE le_fatal_error;
865 --Elsif the current row has already been processed
866 ELSIF g_array_xla_tab$OBJECT_NAME_AFFIX$.EXISTS(i)
867 AND g_array_xla_tab$OBJECT_NAME_AFFIX$(i).target_ccid IS NOT NULL
868 AND g_array_xla_tab$OBJECT_NAME_AFFIX$(i).msg_data IS NOT NULL
869 THEN
870 --It means the caller has previously uploaded the interface and run
871 --the processing but has not collected all the results.
872 --Assign an error message and a return code of FAILURE
873 l_return_msg_name := ''XLA_TAB_WR_ROW_PROCESSED'';
874 l_return_status := C_RET_STS_UNEXP_ERROR;
875 --Raise a local exception
876 RAISE le_fatal_error;
877 END IF;
878 END LOOP;
879
880 --Get the index of the new row
881 l_new_idx := g_array_xla_tab$OBJECT_NAME_AFFIX$.COUNT + 1;
882 --Assign the values to the new row
883 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).source_distribution_id_num_1 := p_source_distrib_id_num_1;
884 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).source_distribution_id_num_2 := p_source_distrib_id_num_2;
885 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).source_distribution_id_num_3 := p_source_distrib_id_num_3;
886 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).source_distribution_id_num_4 := p_source_distrib_id_num_4;
887 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).source_distribution_id_num_5 := p_source_distrib_id_num_5;
888 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).account_type_code := p_account_type_code;
889 --START of source list
890 $SOURCE_REC_FIELD_ASSIGNMENTS$
891 --END of source list
892 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).target_ccid := NULL;
893 g_array_xla_tab$OBJECT_NAME_AFFIX$(l_new_idx).msg_data := NULL;
894
895 --Assign out parameters
896 x_return_status := C_RET_STS_SUCCESS;
897 x_msg_data := NULL;
898 x_msg_count := 0;
899
900
901 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
902 trace
903 ( p_module => l_log_module
904 ,p_msg => ''END '' || l_log_module
905 ,p_level => C_LEVEL_PROCEDURE);
906 END IF;
907
908 EXCEPTION
909 WHEN le_fatal_error THEN
910 --Remove all the elements from the PLSQL table
911 g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE;
912 --If there is a no token message to log
913 IF l_return_msg_name IS NOT NULL
914 THEN
915 --Set it on the stack
916 fnd_message.set_name
917 (
918 application => ''XLA''
919 ,name => l_return_msg_name
920 );
921 --Add it to the message table
922 fnd_msg_pub.add;
923 END IF;
924 --If there is only one message retrieve it
925 fnd_msg_pub.Count_And_Get
926 (
927 p_count => l_msg_count
928 ,p_data => l_msg_data
929 );
930 --Put the message on the stack to ensure old Forms detect the error
931 fnd_message.set_encoded
932 (
933 encoded_message => l_msg_data
934 );
935 --Assign out parameters
936 x_msg_count := l_msg_count;
937 x_msg_data := l_msg_data;
938 IF l_return_status IS NOT NULL
939 THEN
940 x_return_status := l_return_status;
941 ELSE
942 x_return_status := C_RET_STS_UNEXP_ERROR;
943 END IF;
944 WHEN OTHERS THEN
945 --Remove all the elements from the PLSQL table
946 g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE;
947 --Add the standard unexpected error message
948 fnd_msg_pub.Add_Exc_Msg
949 ( p_pkg_name => C_PACKAGE_NAME
950 ,p_procedure_name => ''write_online_tab$OBJECT_NAME_AFFIX$''
951 );
952 --If there is only one message retrieve it
953 fnd_msg_pub.Count_And_Get
954 (
955 p_count => l_msg_count
956 ,p_data => l_msg_data
957 );
958 --Put the message on the stack to ensure all Forms detect the error
959 fnd_message.set_encoded
960 (
961 encoded_message => l_msg_data
962 );
963 --Assign out parameters
964 x_msg_count := l_msg_count;
965 x_msg_data := l_msg_data;
966 x_return_status := C_RET_STS_UNEXP_ERROR;
967 END write_online_tab$OBJECT_NAME_AFFIX$;
968 ';
969
970
971 C_TMPL_SOURCE_PROC_PARAM_DECLA CONSTANT CLOB :=
972 ' ,$SOURCE_CODE$ IN $SOURCE_GENERIC_DATATYPE$ --INPUT';
973
974 C_TMPL_TAB_READ_PROC_NAME CONSTANT VARCHAR2(100) :=
975 'read_online_tab$OBJECT_NAME_AFFIX$';
976
977 C_TMPL_TAB_READ_PROC_DECLAR CONSTANT CLOB :=
978 ' PROCEDURE '|| C_TMPL_TAB_READ_PROC_NAME || '
979 (
980 p_api_version IN NUMBER
981 ,p_source_distrib_id_num_1 IN NUMBER
982 ,p_source_distrib_id_num_2 IN NUMBER
983 ,p_source_distrib_id_num_3 IN NUMBER
984 ,p_source_distrib_id_num_4 IN NUMBER
985 ,p_source_distrib_id_num_5 IN NUMBER
986 ,p_account_type_code IN VARCHAR2
987 ,x_target_ccid OUT NOCOPY NUMBER
988 ,x_concatenated_segments OUT NOCOPY VARCHAR2
989 ,x_return_status OUT NOCOPY VARCHAR2
990 ,x_msg_count OUT NOCOPY NUMBER
991 ,x_msg_data OUT NOCOPY VARCHAR2
992 );';
993
994 C_TMPL_TAB_READ_PROC_IMPL CONSTANT CLOB :=
995 ' PROCEDURE '|| C_TMPL_TAB_READ_PROC_NAME || '
996 (
997 p_api_version IN NUMBER
998 ,p_source_distrib_id_num_1 IN NUMBER
999 ,p_source_distrib_id_num_2 IN NUMBER
1000 ,p_source_distrib_id_num_3 IN NUMBER
1001 ,p_source_distrib_id_num_4 IN NUMBER
1002 ,p_source_distrib_id_num_5 IN NUMBER
1003 ,p_account_type_code IN VARCHAR2
1004 ,x_target_ccid OUT NOCOPY NUMBER
1005 ,x_concatenated_segments OUT NOCOPY VARCHAR2
1006 ,x_return_status OUT NOCOPY VARCHAR2
1007 ,x_msg_count OUT NOCOPY NUMBER
1008 ,x_msg_data OUT NOCOPY VARCHAR2
1009 )
1010 IS
1011 TYPE lt_table_V2000 IS TABLE OF VARCHAR2(2000);
1012
1013 l_return_status VARCHAR2(1);
1014 l_return_msg_name VARCHAR2(30);
1015
1016 l_msg_count NUMBER;
1017 l_msg_data VARCHAR2(2000);
1018
1019 l_found BOOLEAN;
1020 l_watermark NUMBER;
1021 l_start NUMBER;
1022 l_row_base_rowid UROWID;
1023 l_row_target_ccid NUMBER;
1024 l_row_concatenated_segments VARCHAR2(2000);
1025 l_row_msg_count NUMBER;
1026 l_row_msg_data VARCHAR2(2000);
1027 l_table_of_row_errors lt_table_V2000;
1028
1029 l_log_module VARCHAR2 (2000);
1030 BEGIN
1031 IF g_log_enabled THEN
1032 l_log_module := C_DEFAULT_MODULE||''read_online_tab$OBJECT_NAME_AFFIX$'';
1033 END IF;
1034
1035 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1036 trace
1037 ( p_module => l_log_module
1038 ,p_msg => ''BEGIN '' || l_log_module
1039 ,p_level => C_LEVEL_PROCEDURE);
1040 END IF;
1041
1042 --Initialize the global message table
1043 FND_MSG_PUB.Initialize;
1044
1045 --Initialize return status and message local variables
1046 l_return_msg_name:= NULL;
1047 l_return_status := NULL;
1048
1049 IF NOT FND_API.Compatible_API_Call
1050 (
1051 p_current_version_number => C_API_VERSION
1052 ,p_caller_version_number => p_api_version
1053 ,p_api_name => ''read_online_tab$OBJECT_NAME_AFFIX$''
1054 ,p_pkg_name => C_PACKAGE_NAME
1055 )
1056 THEN
1057 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1058 END IF;
1059
1060 --Start the actual logic
1061
1062 --p_account_type_code cannot be NULL
1063 IF p_account_type_code IS NULL
1064 THEN
1065 --Assign an error message and a return code of FAILURE
1066 l_return_msg_name := ''XLA_TAB_RD_ROW_ACCT_TYPE_NULL'';
1067 RAISE le_fatal_error;
1068 END IF;
1069
1070 l_found := FALSE;
1071
1072 --Get the highest index of the PL/SQL table
1073 --Cannot use COUNT since some elements might have been
1074 --collected and deleted
1075 l_watermark := NVL(g_array_xla_tab$OBJECT_NAME_AFFIX$.LAST, 1);
1076 l_start := NVL(g_array_xla_tab$OBJECT_NAME_AFFIX$.FIRST, 1);
1077
1078 --Loop on all the rows of the PL/SQL table
1079 FOR i IN l_start..l_watermark
1080 LOOP
1081 --If the current row identifiers correspond to the IN parameters
1082 IF g_array_xla_tab$OBJECT_NAME_AFFIX$.EXISTS(i)
1083 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_1 = p_source_distrib_id_num_1
1084 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_1 IS NULL AND p_source_distrib_id_num_1 IS NULL
1085 )
1086 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_2 = p_source_distrib_id_num_2
1087 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_2 IS NULL AND p_source_distrib_id_num_2 IS NULL
1088 )
1089 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_3 = p_source_distrib_id_num_3
1090 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_3 IS NULL AND p_source_distrib_id_num_3 IS NULL
1091 )
1092 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_4 = p_source_distrib_id_num_4
1093 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_4 IS NULL AND p_source_distrib_id_num_4 IS NULL
1094 )
1095 AND ( g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_5 = p_source_distrib_id_num_5
1096 OR g_array_xla_tab$OBJECT_NAME_AFFIX$(i).source_distribution_id_num_5 IS NULL AND p_source_distrib_id_num_5 IS NULL
1097 )
1098 AND g_array_xla_tab$OBJECT_NAME_AFFIX$(i).account_type_code = p_account_type_code
1099 THEN
1100 --Set the element found flag
1101 l_found := TRUE;
1102
1103 --Assign the target ccid and encoded message to local variables
1104 l_row_base_rowid :=
1105 g_array_xla_tab$OBJECT_NAME_AFFIX$(i).base_rowid;
1106
1107 l_row_target_ccid :=
1108 g_array_xla_tab$OBJECT_NAME_AFFIX$(i).target_ccid;
1109
1110 l_row_concatenated_segments :=
1111 g_array_xla_tab$OBJECT_NAME_AFFIX$(i).concatenated_segments;
1112
1113 l_row_msg_count :=
1114 NVL(g_array_xla_tab$OBJECT_NAME_AFFIX$(i).msg_count, 0);
1115
1116 l_row_msg_data :=
1117 g_array_xla_tab$OBJECT_NAME_AFFIX$(i).msg_data;
1118
1119 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1120 trace
1121 (p_module => l_log_module
1122 ,p_msg => ''l_row_base_rowid = '' || l_row_base_rowid
1123 ,p_level => C_LEVEL_STATEMENT);
1124 trace
1125 (p_module => l_log_module
1126 ,p_msg => ''l_row_target_ccid = '' || l_row_target_ccid
1127 ,p_level => C_LEVEL_STATEMENT);
1128 trace
1129 (p_module => l_log_module
1130 ,p_msg => ''l_row_msg_count = '' || l_row_msg_count
1131 ,p_level => C_LEVEL_STATEMENT);
1132 trace
1133 (p_module => l_log_module
1134 ,p_msg => ''l_row_msg_data = '' || l_row_msg_data
1135 ,p_level => C_LEVEL_STATEMENT);
1136 END IF;
1137
1138 --If the line has not been processed raise an error
1139 IF l_row_target_ccid IS NULL
1140 AND l_row_msg_count = 0
1141 THEN
1142 l_return_msg_name := ''XLA_TBA_RD_ROW_UNPROCESSED'';
1143 --Raise a local exception
1144 RAISE le_fatal_error;
1145 END IF;
1146
1147 --remove the element
1148 g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE(i);
1149
1150 --exit the loop
1151 EXIT;
1152 END IF;
1153 END LOOP;
1154
1155 --If no match found raise an error
1156 IF NOT l_found
1157 THEN
1158 l_return_msg_name := ''XLA_TBA_RD_ROW_NOT_FOUND'';
1159 RAISE le_fatal_error;
1160 END IF;
1161
1162 --If the row has only one error push it on the stack
1163 IF l_row_msg_count = 1
1164 THEN
1165 --push it on the message stack
1166 fnd_message.set_encoded
1167 (
1168 encoded_message => l_row_msg_data
1169 );
1170 --Add it to the message table
1171 fnd_msg_pub.add;
1172 --If there is only one message retrieve it
1173 fnd_msg_pub.count_and_get
1174 (
1175 p_count => l_msg_count
1176 ,p_data => l_msg_data
1177 );
1178 --Put the message on the stack to ensure old Forms detect the error
1179 fnd_message.set_encoded
1180 (
1181 encoded_message => l_msg_data
1182 );
1183 --Set the return values
1184 l_msg_count := l_msg_count;
1185 l_msg_data := l_msg_data;
1186 --Set return status
1187 l_return_status := C_RET_STS_ERROR;
1188 --If the row has more than one error fetch them from the error table
1189 ELSIF l_row_msg_count > 1
1190 THEN
1191 --Read the errors from XLA_TAB_ERRORS_GT and push them on the stack
1192 SELECT xte.msg_data
1193 BULK COLLECT
1194 INTO l_table_of_row_errors
1195 FROM xla_tab_errors_gt xte
1196 WHERE xte.base_rowid = l_row_base_rowid;
1197 --Loop on the errors and push them on the stack
1198 FOR i IN l_table_of_row_errors.FIRST .. l_table_of_row_errors.LAST
1199 LOOP
1200 --Push the current message on the stack
1201 fnd_message.set_encoded
1202 (
1203 encoded_message => l_table_of_row_errors(i)
1204 );
1205 --Add the stacked message to the table
1206 fnd_msg_pub.add;
1207 END LOOP;
1208 --Set the return values
1209 l_msg_count := l_row_msg_count;
1210 l_msg_data := NULL;
1211 l_return_status := C_RET_STS_ERROR;
1212 ELSE
1213 --The row has been found and has no errors
1214 l_msg_count := 0;
1215 l_msg_data := NULL;
1216 l_return_status := C_RET_STS_SUCCESS;
1217 END IF;
1218
1219 --Assign out parameters
1220 x_target_ccid := l_row_target_ccid;
1221 x_concatenated_segments := l_row_concatenated_segments;
1222 x_msg_count := l_msg_count;
1223 x_msg_data := l_msg_data;
1224
1225 IF l_return_status IS NOT NULL
1226 THEN
1227 x_return_status := l_return_status;
1228 ELSE
1229 x_return_status := C_RET_STS_UNEXP_ERROR;
1230 END IF;
1231
1232 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1233 trace
1234 ( p_module => l_log_module
1235 ,p_msg => ''END '' || l_log_module
1236 ,p_level => C_LEVEL_PROCEDURE);
1237 END IF;
1238
1239 EXCEPTION
1240 WHEN le_fatal_error THEN
1241 --Remove all the elements from the PLSQL table
1242 g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE;
1243 --If there is a no token message to log
1244 IF l_return_msg_name IS NOT NULL
1245 THEN
1246 --Set it on the stack
1247 fnd_message.set_name
1248 (
1249 application => ''XLA''
1250 ,name => l_return_msg_name
1251 );
1252 --Add it to the message table
1253 fnd_msg_pub.add;
1254 END IF;
1255 --If there is only one message retrieve it
1256 fnd_msg_pub.Count_And_Get
1257 (
1258 p_count => l_msg_count
1259 ,p_data => l_msg_data
1260 );
1261 --Put the message on the stack to ensure old Forms detect the error
1262 fnd_message.set_encoded
1263 (
1264 encoded_message => l_msg_data
1265 );
1266 --Assign out parameters
1267 x_msg_count := l_msg_count;
1268 x_msg_data := l_msg_data;
1269 IF l_return_status IS NOT NULL
1270 THEN
1271 x_return_status := l_return_status;
1272 ELSE
1273 x_return_status := C_RET_STS_UNEXP_ERROR;
1274 END IF;
1275 WHEN OTHERS THEN
1276 --Remove all the elements from the PLSQL table
1277 g_array_xla_tab$OBJECT_NAME_AFFIX$.DELETE;
1278 --Add the standard unexpected error message
1279 fnd_msg_pub.Add_Exc_Msg
1280 ( p_pkg_name => C_PACKAGE_NAME
1281 ,p_procedure_name => ''read_online_tab$OBJECT_NAME_AFFIX$''
1282 );
1283 --If there is only one message retrieve it
1284 fnd_msg_pub.Count_And_Get
1285 (
1286 p_count => l_msg_count
1287 ,p_data => l_msg_data
1288 );
1289 --Put the message on the stack to ensure all Forms detect the error
1290 fnd_message.set_encoded
1291 (
1292 encoded_message => l_msg_data
1293 );
1294 --Assign out parameters
1295 x_msg_count := l_msg_count;
1296 x_msg_data := l_msg_data;
1297 x_return_status := C_RET_STS_UNEXP_ERROR;
1298 END read_online_tab$OBJECT_NAME_AFFIX$;
1299 ';
1300
1301
1302 --
1303 -- Global variables
1304 --
1305 g_user_id CONSTANT INTEGER := xla_environment_pkg.g_usr_id;
1306 g_login_id CONSTANT INTEGER := xla_environment_pkg.g_login_id;
1307 g_prog_appl_id CONSTANT INTEGER := xla_environment_pkg.g_prog_appl_id;
1308 g_prog_id CONSTANT INTEGER := xla_environment_pkg.g_prog_id;
1309 g_req_id CONSTANT INTEGER := NVL(xla_environment_pkg.g_req_id, -1);
1310
1311
1312
1313 g_application_info xla_cmp_common_pkg.lt_application_info;
1314 g_user_name VARCHAR2(2000); --100 in the table
1315 g_tab_api_package_name VARCHAR2(30); --length validation is important
1316 --
1317
1318 -- Cursor declarations
1319 --
1320
1321
1322
1323 --=============================================================================
1324 -- *********** Local Trace Routine **********
1325 --=============================================================================
1326 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
1327 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
1328 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
1329 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
1330 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
1331 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
1332
1333 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
1334 C_DEFAULT_MODULE CONSTANT VARCHAR2(240) := 'xla.plsql.xla_cmp_tab_pkg';
1335
1336 g_log_level NUMBER;
1337 g_log_enabled BOOLEAN;
1338
1339 --1-STATEMENT, 2-PROCEDURE, 3-EVENT, 4-EXCEPTION, 5-ERROR, 6-UNEXPECTED
1340
1341 PROCEDURE trace
1342 ( p_module IN VARCHAR2 DEFAULT C_DEFAULT_MODULE
1343 ,p_msg IN VARCHAR2
1344 ,p_level IN NUMBER
1345 ) IS
1346 BEGIN
1347 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
1348 fnd_log.message(p_level, p_module);
1349 ELSIF p_level >= g_log_level THEN
1350 fnd_log.string(p_level, p_module, p_msg);
1351 END IF;
1352
1353 EXCEPTION
1354 WHEN xla_exceptions_pkg.application_exception THEN
1355 RAISE;
1356 WHEN OTHERS THEN
1357 xla_exceptions_pkg.raise_message
1358 (p_location => 'xla_cmp_tab_pkg.trace');
1359 END trace;
1360
1361
1362 --Forward declarations of private functions
1363
1364 FUNCTION init_global_variables
1365 ( p_application_id IN NUMBER
1366 )
1367 RETURN BOOLEAN;
1368 FUNCTION get_tab_api_package_name
1369 (
1370 p_tab_api_package_name OUT NOCOPY VARCHAR2
1371 )
1372 RETURN BOOLEAN;
1373
1374
1375 FUNCTION create_package_spec
1376 RETURN BOOLEAN;
1377
1378 FUNCTION create_package_body
1379 RETURN BOOLEAN;
1380
1381 FUNCTION create_temp_tables
1382 RETURN BOOLEAN;
1383
1384 FUNCTION build_package_spec
1385 (
1386 p_package_spec_text OUT NOCOPY CLOB
1387 )
1388 RETURN BOOLEAN;
1389
1390 FUNCTION build_package_body
1391 (
1392 p_package_body_text OUT NOCOPY CLOB
1393 )
1394 RETURN BOOLEAN;
1395
1396 FUNCTION build_package_history
1397 (
1398 p_package_history OUT NOCOPY CLOB
1399 )
1400 RETURN BOOLEAN;
1401
1402 FUNCTION build_declarations
1403 (
1404 p_record_type_declarations OUT NOCOPY CLOB
1405 ,p_table_type_declarations OUT NOCOPY CLOB
1406 ,p_table_var_declarations OUT NOCOPY CLOB
1407 ,p_write_proc_declarations OUT NOCOPY CLOB
1408 ,p_read_proc_declarations OUT NOCOPY CLOB
1409 )
1410 RETURN BOOLEAN;
1411
1412 FUNCTION build_implementations
1413 (
1414 x_write_proc_implementations OUT NOCOPY CLOB
1415 ,x_read_proc_implementations OUT NOCOPY CLOB
1416 ,x_reset_interface_proc_stmts OUT NOCOPY CLOB
1417 )
1418 RETURN BOOLEAN;
1419
1420 FUNCTION build_global_temp_table
1421 (
1422 p_object_name_affix IN VARCHAR2
1423 ,x_global_table_name OUT NOCOPY VARCHAR2
1424 ,x_table_creation_text OUT NOCOPY CLOB
1425 )
1426 RETURN BOOLEAN;
1427
1428
1429 PROCEDURE compile_api_srs
1430 ( p_errbuf OUT NOCOPY VARCHAR2
1431 ,p_retcode OUT NOCOPY NUMBER
1432 ,p_application_id IN NUMBER
1433 )
1434 IS
1435 l_msg_count NUMBER;
1436 l_msg_data VARCHAR2 (2000);
1437 l_log_module VARCHAR2 (2000);
1438 BEGIN
1439 IF g_log_enabled THEN
1440 l_log_module := C_DEFAULT_MODULE||'.compile_api_srs';
1441 END IF;
1442
1443 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1444 trace
1445 (p_module => l_log_module
1446 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.compile_api_srs'
1447 ,p_level => C_LEVEL_PROCEDURE);
1448 END IF;
1449
1450 IF xla_cmp_tab_pkg.compile_api(
1451 p_application_id => p_application_id
1452 )
1453 THEN
1454 IF (C_LEVEL_EVENT >= g_log_level) THEN
1455 trace
1456 (p_module => l_log_module
1457 ,p_msg => 'TAB API built successfully'
1458 ,p_level => C_LEVEL_EVENT);
1459 END IF;
1460 --Report the "successfully compiled" message in the output
1461 fnd_file.put_line
1462 (
1463 fnd_file.output
1464 ,xla_messages_pkg.get_message
1465 (
1466 'XLA'
1467 ,'XLA_TAB_CMP_TAB_API_SUCCEEDED'
1468 ,'APPLICATION_NAME'
1469 ,g_application_info.application_name
1470 )
1471 );
1472 p_retcode := 0;
1473 ELSE
1474 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1475 trace
1476 (p_module => l_log_module
1477 ,p_msg => 'Unable to build TAB API'
1478 ,p_level => C_LEVEL_EXCEPTION);
1479 END IF;
1480 --Report the "unsuccessfully compiled" message in the output
1481 fnd_file.put_line
1482 (
1483 fnd_file.output
1484 ,xla_messages_pkg.get_message
1485 (
1486 'XLA'
1487 ,'XLA_TAB_CMP_TAB_API_FAILED'
1488 ,'APPLICATION_NAME'
1489 ,g_application_info.application_name
1490 )
1491 );
1492 --Report the errors
1493 fnd_msg_pub.Count_And_Get
1494 (
1495 p_count => l_msg_count
1496 ,p_data => l_msg_data
1497 );
1498 --If msg_count 0 it might be the message is on the old stack
1499 IF l_msg_count = 0
1500 THEN
1501 fnd_file.put_line
1502 (
1503 fnd_file.log
1504 ,fnd_message.get()
1505 );
1506 ELSIF l_msg_count = 1
1507 THEN
1508 fnd_message.set_encoded
1509 (
1510 encoded_message => l_msg_data
1511 );
1512 fnd_file.put_line
1513 (
1514 fnd_file.log
1515 ,fnd_message.get()
1516 );
1517 ELSIF l_msg_count > 1
1518 THEN
1519 FOR i IN 1..l_msg_count
1520 LOOP
1521 fnd_file.put_line
1522 (
1523 fnd_file.log
1524 ,fnd_msg_pub.get(p_encoded => 'F')
1525 );
1526 END LOOP;
1527 END IF;
1528 p_retcode := 2;
1529 END IF;
1530
1531 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1532 trace
1533 (p_module => l_log_module
1534 ,p_msg => 'p_retcode = ' || p_retcode
1535 ,p_level => C_LEVEL_STATEMENT);
1536 END IF;
1537
1538 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1539 trace
1540 (p_module => l_log_module
1541 ,p_msg => 'RETURN ' || C_DEFAULT_MODULE||'.compile_api_srs'
1542 ,p_level => C_LEVEL_PROCEDURE);
1543 END IF;
1544
1545 EXCEPTION
1546 WHEN xla_exceptions_pkg.application_exception
1547 THEN
1548 RAISE;
1549 WHEN OTHERS
1550 THEN
1551 xla_exceptions_pkg.raise_message
1552 (p_location => 'xla_cmp_tab_pkg.compile_api_srs');
1553
1554 END compile_api_srs;
1555
1556
1557 FUNCTION compile_api
1558 (
1559 p_application_id IN NUMBER
1560 )
1561 RETURN BOOLEAN
1562 IS
1563 l_return_value BOOLEAN;
1564
1565 l_user_name VARCHAR2(30);
1566 lr_application_info xla_cmp_common_pkg.lt_application_info;
1567 l_log_module VARCHAR2 (2000);
1568
1569 BEGIN
1570 IF g_log_enabled THEN
1571 l_log_module := C_DEFAULT_MODULE||'.compile_api';
1572 END IF;
1573
1574 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1575 trace
1576 (p_module => l_log_module
1577 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.compile_api'
1578 ,p_level => C_LEVEL_PROCEDURE);
1579 END IF;
1580
1581 l_return_value := TRUE;
1582
1583 --Lock TATs setup data for the application
1584 IF NOT xla_cmp_lock_pkg.lock_tats_and_sources
1585 (
1586 p_application_id => p_application_id
1587 )
1588 THEN
1589 l_return_value := FALSE;
1590 END IF;
1591
1592 --Remove Transaction Account Definitions deleted in the UI
1593 --for this application
1594 IF NOT remove_deleted_tats
1595 (
1596 p_application_id => p_application_id
1597 )
1598 THEN
1599 IF (C_LEVEL_ERROR >= g_log_level) THEN
1600 trace
1601 (p_module => l_log_module
1602 ,p_msg => 'remove_deleted_tats failed, aborting...'
1603 ,p_level => C_LEVEL_ERROR);
1604 END IF;
1605 l_return_value := FALSE;
1606 RAISE le_fatal_error;
1607 END IF;
1608
1609 --Initialize global variables
1610 IF NOT init_global_variables
1611 (
1612 p_application_id => p_application_id
1613 )
1614 THEN
1615 --If global vars cannot be set we cannot continue
1616 IF (C_LEVEL_ERROR >= g_log_level) THEN
1617 trace
1618 (p_module => l_log_module
1619 ,p_msg => 'init_global_variables failed'
1620 ,p_level => C_LEVEL_ERROR);
1621 END IF;
1622 l_return_value := FALSE;
1623 RAISE le_fatal_error;
1624 END IF;
1625
1626 --Create Package Header
1627 IF NOT create_package_spec
1628 THEN
1629 --If global vars cannot be set we cannot continue
1630 IF (C_LEVEL_ERROR >= g_log_level) THEN
1631 trace
1632 (p_module => l_log_module
1633 ,p_msg => 'create_package_spec failed'
1634 ,p_level => C_LEVEL_ERROR);
1635 END IF;
1636 l_return_value := FALSE;
1637 END IF;
1638
1639 --Create Package Body
1640 IF NOT create_package_body
1641 THEN
1642 --If global vars cannot be set we cannot continue
1643 IF (C_LEVEL_ERROR >= g_log_level) THEN
1644 trace
1645 (p_module => l_log_module
1646 ,p_msg => 'create_package_body failed'
1647 ,p_level => C_LEVEL_ERROR);
1648 END IF;
1649 l_return_value := FALSE;
1650 END IF;
1651
1652 --Create Global Temporary Tables
1653 IF NOT create_temp_tables
1654 THEN
1655 --If global vars cannot be set we cannot continue
1656 IF (C_LEVEL_ERROR >= g_log_level) THEN
1657 trace
1658 (p_module => l_log_module
1659 ,p_msg => 'create_package_body failed'
1660 ,p_level => C_LEVEL_ERROR);
1661 END IF;
1662 l_return_value := FALSE;
1663 END IF;
1664
1665 --Assign the new compile_status_code to the TATs
1666 UPDATE xla_tab_acct_types_b xtat
1667 SET xtat.compile_status_code =
1668 xla_cmp_common_pkg.G_COMPILE_STATUS_CODE_COMPILED
1669 WHERE xtat.application_id = p_application_id
1670 AND xtat.enabled_flag = 'Y'
1671 AND xtat.compile_status_code IS NOT NULL;
1672
1673 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1674 trace
1675 (p_module => l_log_module
1676 ,p_msg => 'value returned= '
1677 || CASE l_return_value
1678 WHEN TRUE THEN 'TRUE'
1679 WHEN FALSE THEN 'FALSE'
1680 ELSE 'NULL'
1681 END
1682 ,p_level => C_LEVEL_STATEMENT );
1683 END IF;
1684
1685 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1686 trace
1687 (p_module => l_log_module
1688 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.compile_api'
1689 ,p_level => C_LEVEL_PROCEDURE);
1690 END IF;
1691
1692 --If success in all phases return TRUE Else FALSE
1693 RETURN l_return_value;
1694
1695 EXCEPTION
1696 WHEN le_fatal_error
1697 THEN
1698 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1699 trace
1700 (p_module => l_log_module
1701 ,p_msg => 'EXCEPTION:' ||
1702 ' Cannot initialize global variables, aborting...'
1703 ,p_level => C_LEVEL_EXCEPTION);
1704 END IF;
1705 --Push a message in the message stack
1706 --without raising an exception
1707 xla_exceptions_pkg.raise_message
1708 ( p_appli_s_name => 'XLA'
1709 ,p_msg_name => 'XLA_TAB_CMP_TAB_API_FAILED'
1710 ,p_token_1 => 'APPLICATION_NAME'
1711 ,p_value_1 => g_application_info.application_name
1712 ,p_msg_mode => g_msg_mode
1713 );
1714
1715 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1716 trace
1717 (p_module => l_log_module
1718 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.compile_api'
1719 ,p_level => C_LEVEL_PROCEDURE);
1720 END IF;
1721 RETURN FALSE;
1722 WHEN xla_exceptions_pkg.application_exception
1723 THEN
1724 RAISE;
1725 WHEN OTHERS
1726 THEN
1727 xla_exceptions_pkg.raise_message
1728 (p_location => 'xla_cmp_tab_pkg.compile_api');
1729 END compile_api;
1730
1731
1732
1733 /*======================================================================+
1734 | |
1735 | Private Function |
1736 | |
1737 | init_global_variables |
1738 | |
1739 | This program initializes the global variables required by the |
1740 | package. It retrieves the user name, builds the package and |
1741 | table names of the Transaction Account Builder API being |
1742 | compiled, etc., and sets the global variables. |
1743 | |
1744 | |
1745 +======================================================================*/
1746 FUNCTION init_global_variables
1747 ( p_application_id IN NUMBER
1748 )
1749 RETURN BOOLEAN
1750 IS
1751 l_return_value BOOLEAN;
1752 l_log_module VARCHAR2 (2000);
1753 BEGIN
1754 IF g_log_enabled THEN
1755 l_log_module := C_DEFAULT_MODULE||'.init_global_variables';
1756 END IF;
1757
1758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1759 trace
1760 (p_module => l_log_module
1761 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.init_global_variables'
1762 ,p_level => C_LEVEL_PROCEDURE);
1763 END IF;
1764
1765 l_return_value := TRUE;
1766 /*
1767 --Retrieve and set the User Name (xla_cmp_common_pkg.get_user_name)
1768 --Set the application id
1769 --Retrieve and set the Application Information (xla_cmp_common_pkg.get_application_info)
1770 --Build and set the Transaction Account Builder package name (get_tab_api_package_name)
1771 --Retrieve and set the object name affixes (read_distinct_affixes)
1772 */
1773 --Retrieve current user name
1774 IF NOT xla_cmp_common_pkg.get_user_name
1775 (
1776 p_user_id => g_user_id
1777 ,p_user_name => g_user_name
1778 )
1779 THEN
1780 IF (C_LEVEL_ERROR >= g_log_level) THEN
1781 trace
1782 (p_module => l_log_module
1783 ,p_msg => 'ERROR:' ||
1784 ' Cannot determine user name.'
1785 ,p_level => C_LEVEL_ERROR);
1786 END IF;
1787 END IF;
1788
1789 --Retrieve and set the application info
1790 IF NOT xla_cmp_common_pkg.get_application_info
1791 (
1792 p_application_id => p_application_id
1793 ,p_application_info => g_application_info
1794 )
1795 THEN
1796 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1797 trace
1798 (p_module => l_log_module
1799 ,p_msg => 'EXCEPTION:' ||
1800 ' Cannot read application info, aborting...'
1801 ,p_level => C_LEVEL_EXCEPTION);
1802 END IF;
1803 RAISE le_fatal_error;
1804 END IF;
1805
1806 --Build the api package name
1807 IF NOT get_tab_api_package_name
1808 (
1809 p_tab_api_package_name => g_tab_api_package_name
1810 )
1811 THEN
1812 IF (C_LEVEL_ERROR >= g_log_level) THEN
1813 trace
1814 (p_module => l_log_module
1815 ,p_msg => 'ERROR:' ||
1816 ' Cannot determine the TAB API package name.'
1817 ,p_level => C_LEVEL_ERROR);
1818 END IF;
1819 END IF;
1820
1821 --Build distinct object_name
1822 IF NOT read_distinct_affixes( p_application_id => p_application_id)
1823 THEN
1824 l_return_value := FALSE;
1825 IF (C_LEVEL_ERROR >= g_log_level) THEN
1826 trace
1827 (p_module => l_log_module
1828 ,p_msg => 'ERROR:' ||
1829 ' Cannot determine the TAB API affixes. ' ||
1830 'Check if at least one enabled Transaction ' ||
1831 'Account Type exists for this application.'
1832 ,p_level => C_LEVEL_ERROR);
1833 END IF;
1834
1835 RAISE le_fatal_error;
1836
1837 END IF;
1838
1839 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1840 trace
1841 (p_module => l_log_module
1842 ,p_msg => 'value returned= '
1843 || CASE l_return_value
1844 WHEN TRUE THEN 'TRUE'
1845 WHEN FALSE THEN 'FALSE'
1846 ELSE 'NULL'
1847 END
1848 ,p_level => C_LEVEL_STATEMENT );
1849 END IF;
1850
1851 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1852 trace
1853 (p_module => l_log_module
1854 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.init_global_variables'
1855 ,p_level => C_LEVEL_PROCEDURE);
1856 END IF;
1857
1858 RETURN l_return_value;
1859
1860 EXCEPTION
1861 WHEN le_fatal_error
1862 THEN
1863 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1864 trace
1865 (p_module => l_log_module
1866 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.init_global_variables'
1867 ,p_level => C_LEVEL_PROCEDURE);
1868 END IF;
1869 RETURN FALSE;
1870 WHEN xla_exceptions_pkg.application_exception
1871 THEN
1872 RAISE;
1873 WHEN OTHERS
1874 THEN
1875 xla_exceptions_pkg.raise_message
1876 (p_location => 'xla_cmp_tab_pkg.init_global_variables');
1877
1878 END init_global_variables;
1879
1880
1881 /*======================================================================+
1882 | |
1883 | Private Function |
1884 | |
1885 | create_package_spec |
1886 | |
1887 | |
1888 | |
1889 | |
1890 +======================================================================*/
1891 FUNCTION create_package_spec
1892 RETURN BOOLEAN
1893 IS
1894 l_return_value BOOLEAN;
1895 l_package_spec_text CLOB;
1896 l_log_module VARCHAR2 (2000);
1897
1898 BEGIN
1899 IF g_log_enabled THEN
1900 l_log_module := C_DEFAULT_MODULE||'.create_package_spec';
1901 END IF;
1902
1903 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1904 trace
1905 (p_module => l_log_module
1906 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.create_package_spec'
1907 ,p_level => C_LEVEL_PROCEDURE);
1908 END IF;
1909
1910 l_return_value := TRUE;
1911
1912 --build the package specification
1913 IF NOT build_package_spec
1914 (
1915 p_package_spec_text => l_package_spec_text
1916 )
1917 THEN
1918 l_return_value := FALSE;
1919 IF (C_LEVEL_ERROR >= g_log_level) THEN
1920 trace
1921 (p_module => l_log_module
1922 ,p_msg => 'build_package_spec failed'
1923 ,p_level => C_LEVEL_ERROR);
1924 END IF;
1925 END IF;
1926
1927 IF NOT xla_cmp_create_pkg.push_database_object
1928 (
1929 p_object_name => g_tab_api_package_name
1930 ,p_object_type => 'PACKAGE'
1931 ,p_object_owner => NULL --current user
1932 ,p_apps_account => g_application_info.apps_account
1933 ,p_msg_mode => G_OA_MESSAGE
1934 ,p_ddl_text => l_package_spec_text
1935 )
1936 THEN
1937 l_return_value := FALSE;
1938 IF (C_LEVEL_ERROR >= g_log_level) THEN
1939 trace
1940 (p_module => l_log_module
1941 ,p_msg => 'push_database_object failed'
1942 ,p_level => C_LEVEL_ERROR);
1943 END IF;
1944 END IF;
1945
1946 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1947 trace
1948 ( p_module => l_log_module
1949 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.create_package_spec'
1950 ,p_level => C_LEVEL_PROCEDURE
1951 );
1952 END IF;
1953
1954 RETURN l_return_value;
1955
1956 EXCEPTION
1957 WHEN xla_exceptions_pkg.application_exception
1958 THEN
1959 RAISE;
1960 WHEN OTHERS
1961 THEN
1962 xla_exceptions_pkg.raise_message
1963 (p_location => 'xla_cmp_tab_pkg.create_package_spec');
1964
1965 END create_package_spec;
1966
1967
1968
1969
1970 /*======================================================================+
1971 | |
1972 | Private Function |
1973 | |
1974 | build_package_spec |
1975 | |
1976 | |
1977 | |
1978 | |
1979 +======================================================================*/
1980 FUNCTION build_package_spec
1981 (
1982 p_package_spec_text OUT NOCOPY CLOB
1983 )
1984 RETURN BOOLEAN
1985 IS
1986 l_history CLOB;
1987 l_tab_rec_type_declarations CLOB;
1988 l_table_type_declarations CLOB;
1989 l_table_var_declarations CLOB;
1990 l_write_proc_declarations CLOB;
1991 l_read_proc_declarations CLOB;
1992
1993 l_return_value BOOLEAN;
1994 l_log_module VARCHAR2 (2000);
1995 BEGIN
1996 IF g_log_enabled THEN
1997 l_log_module := C_DEFAULT_MODULE||'.build_package_spec';
1998 END IF;
1999
2000 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2001 trace
2002 (p_module => l_log_module
2003 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_package_spec'
2004 ,p_level => C_LEVEL_PROCEDURE);
2005 END IF;
2006
2007 --take the package specification template
2008 --replace the package name tokens
2009 p_package_spec_text := xla_cmp_string_pkg.replace_token
2010 (
2011 C_TMPL_TAB_PACKAGE_SPEC
2012 ,'$TAB_API_PACKAGE_NAME_1$'
2013 ,g_tab_api_package_name
2014 );
2015
2016 p_package_spec_text := xla_cmp_string_pkg.replace_token
2017 (
2018 p_package_spec_text
2019 ,'$TAB_API_PACKAGE_NAME_2$'
2020 ,RPAD( g_tab_api_package_name
2021 , 66
2022 , ' '
2023 )
2024 || '|'
2025 );
2026
2027 --replace the application name token
2028 p_package_spec_text := xla_cmp_string_pkg.replace_token
2029 (
2030 p_package_spec_text
2031 ,'$APPLICATION_NAME$'
2032 ,RPAD( g_application_info.application_name
2033 , 66
2034 , ' '
2035 ) || '|'
2036 );
2037
2038 --replace the application id token
2039 p_package_spec_text := xla_cmp_string_pkg.replace_token
2040 (
2041 p_package_spec_text
2042 ,'$APPLICATION_ID$'
2043 ,RPAD( TO_CHAR(g_application_info.application_id) || ')'
2044 , 49
2045 , ' '
2046 ) || '|'
2047 );
2048
2049 --build the package history
2050 IF NOT build_package_history (l_history )
2051 THEN
2052 --not a fatal error
2053 IF (C_LEVEL_ERROR >= g_log_level) THEN
2054 trace
2055 (p_module => l_log_module
2056 ,p_msg => 'cannot build package history'
2057 ,p_level => C_LEVEL_ERROR);
2058 END IF;
2059 l_return_value := FALSE;
2060 END IF;
2061
2062 --replace the history token
2063 p_package_spec_text := xla_cmp_string_pkg.replace_token
2064 (
2065 p_package_spec_text
2066 ,'$HISTORY$'
2067 ,RPAD( l_history
2068 , 66
2069 , ' '
2070 ) || '|'
2071 );
2072
2073 --build the type and function declarations
2074 IF NOT build_declarations
2075 (
2076 p_record_type_declarations => l_tab_rec_type_declarations
2077 ,p_table_type_declarations => l_table_type_declarations
2078 ,p_table_var_declarations => l_table_var_declarations
2079 ,p_write_proc_declarations => l_write_proc_declarations
2080 ,p_read_proc_declarations => l_read_proc_declarations
2081 )
2082 THEN
2083 --not a fatal error
2084 IF (C_LEVEL_ERROR >= g_log_level) THEN
2085 trace
2086 (p_module => l_log_module
2087 ,p_msg => 'cannot build declarations'
2088 ,p_level => C_LEVEL_ERROR);
2089 END IF;
2090 l_return_value := FALSE;
2091 END IF;
2092
2093 --replace the record type declarations token
2094 p_package_spec_text := xla_cmp_string_pkg.replace_token(
2095 p_package_spec_text
2096 ,'$TAB_REC_TYPE_DECLARATIONS$'
2097 ,l_tab_rec_type_declarations
2098 );
2099
2100 --replace the table type declarations token
2101 p_package_spec_text := xla_cmp_string_pkg.replace_token(
2102 p_package_spec_text
2103 ,'$TAB_TABLE_TYPE_DECLARATIONS$'
2104 ,l_table_type_declarations
2105 );
2106
2107 --replace the table variable declarations token
2108 p_package_spec_text := xla_cmp_string_pkg.replace_token(
2109 p_package_spec_text
2110 ,'$TAB_TABLE_VAR_DECLARATIONS$'
2111 ,l_table_var_declarations
2112 );
2113
2114 --replace the write procedure declarations token
2115 p_package_spec_text := xla_cmp_string_pkg.replace_token(
2116 p_package_spec_text
2117 ,'$TAB_WRITE_PROC_DECLARATIONS$'
2118 ,l_write_proc_declarations
2119 );
2120
2121 --replace the read procedure declarations token
2122 p_package_spec_text := xla_cmp_string_pkg.replace_token(
2123 p_package_spec_text
2124 ,'$TAB_READ_PROC_DECLARATIONS$'
2125 ,l_read_proc_declarations
2126 );
2127
2128 l_return_value := TRUE;
2129
2130 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2131 trace
2132 (p_module => l_log_module
2133 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_package_spec'
2134 ,p_level => C_LEVEL_PROCEDURE);
2135 END IF;
2136
2137 RETURN l_return_value;
2138
2139 EXCEPTION
2140 WHEN xla_exceptions_pkg.application_exception
2141 THEN
2142 RAISE;
2143 WHEN OTHERS
2144 THEN
2145 xla_exceptions_pkg.raise_message
2146 (p_location => 'xla_cmp_tab_pkg.build_package_spec');
2147
2148 END build_package_spec;
2149
2150
2151
2152 /*======================================================================+
2153 | |
2154 | Private Function |
2155 | |
2156 | build_package_history |
2157 | |
2158 | |
2159 | |
2160 | |
2161 +======================================================================*/
2162 FUNCTION build_package_history (p_package_history OUT NOCOPY CLOB)
2163 RETURN BOOLEAN
2164 IS
2165 l_return_value BOOLEAN;
2166 l_log_module VARCHAR2 (2000);
2167 BEGIN
2168 IF g_log_enabled THEN
2169 l_log_module := C_DEFAULT_MODULE||'.build_package_history';
2170 END IF;
2171
2172 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2173 trace
2174 (p_module => l_log_module
2175 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_package_history'
2176 ,p_level => C_LEVEL_PROCEDURE);
2177 END IF;
2178
2179 p_package_history := TO_CHAR(SYSDATE, 'DD-MON-RR')
2180 || ' XLA '
2181 || 'Generated by Oracle Subledger Accounting Compiler';
2182
2183 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2184 trace
2185 (p_module => l_log_module
2186 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_package_history'
2187 ,p_level => C_LEVEL_PROCEDURE);
2188 END IF;
2189
2190 RETURN l_return_value;
2191 EXCEPTION
2192 WHEN xla_exceptions_pkg.application_exception
2193 THEN
2194 RAISE;
2195 WHEN OTHERS
2196 THEN
2197 xla_exceptions_pkg.raise_message
2198 (p_location => 'xla_cmp_tab_pkg.build_package_history');
2199
2200 END build_package_history;
2201
2202
2203
2204 /*======================================================================+
2205 | |
2206 | Private Function |
2207 | |
2208 | build_record_type_declarations |
2209 | |
2210 | |
2211 | |
2212 | |
2213 +======================================================================*/
2214 FUNCTION build_declarations
2215 (
2216 p_record_type_declarations OUT NOCOPY CLOB
2217 ,p_table_type_declarations OUT NOCOPY CLOB
2218 ,p_table_var_declarations OUT NOCOPY CLOB
2219 ,p_write_proc_declarations OUT NOCOPY CLOB
2220 ,p_read_proc_declarations OUT NOCOPY CLOB
2221 )
2222 RETURN BOOLEAN
2223 IS
2224 l_return_value BOOLEAN;
2225 l_record_type_declar CLOB;
2226 l_table_type_declar CLOB;
2227 l_table_var_declar CLOB;
2228 l_write_proc_declar CLOB;
2229 l_read_proc_declar CLOB;
2230
2231 l_source_rec_field_declars CLOB;
2232 l_source_rec_field_declar CLOB;
2233
2234 l_source_proc_param_declars CLOB;
2235 l_source_proc_param_declar CLOB;
2236
2237 l_record_type_declarations CLOB;
2238 l_table_type_declarations CLOB;
2239 l_table_var_declarations CLOB;
2240 l_write_proc_declarations CLOB;
2241 l_read_proc_declarations CLOB;
2242
2243
2244 l_datatype_specific_declar VARCHAR2(30);
2245 l_datatype_generic_declar VARCHAR2(30);
2246
2247 l_log_module VARCHAR2 (2000);
2248
2249 BEGIN
2250 IF g_log_enabled THEN
2251 l_log_module := C_DEFAULT_MODULE||'.build_declarations';
2252 END IF;
2253
2254 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2255 trace
2256 (p_module => l_log_module
2257 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_declarations'
2258 ,p_level => C_LEVEL_PROCEDURE);
2259 END IF;
2260
2261 l_record_type_declarations := NULL;
2262 l_table_type_declarations := NULL;
2263 l_table_var_declarations := NULL;
2264 l_write_proc_declarations := NULL;
2265 l_read_proc_declarations := NULL;
2266
2267
2268 --For each distinct object name affix
2269 FOR affix_index IN 1..g_all_object_name_affixes.COUNT
2270 LOOP
2271 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2272 trace
2273 (p_msg => 'current affix: ' ||
2274 NVL(g_all_object_name_affixes(affix_index), 'NULL')
2275 ,p_level => C_LEVEL_STATEMENT);
2276 END IF;
2277
2278 --get the various templates
2279 l_record_type_declar := C_TMPL_TAB_REC_TYPE_DECLAR;
2280 l_table_type_declar := C_TMPL_TAB_TABLE_TYPE_DECLAR;
2281 l_table_var_declar := C_TMPL_TAB_TABLE_VAR_DECLAR;
2282 l_write_proc_declar := C_TMPL_TAB_WRITE_PROC_DECLAR;
2283 l_read_proc_declar := C_TMPL_TAB_READ_PROC_DECLAR;
2284
2285 --replace the object_name_affix
2286 l_record_type_declar := xla_cmp_string_pkg.replace_token
2287 (
2288 l_record_type_declar
2289 ,'$OBJECT_NAME_AFFIX$'
2290 ,CASE
2291 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
2292 ELSE '_' || g_all_object_name_affixes(affix_index)
2293 END
2294 );
2295 l_table_type_declar := xla_cmp_string_pkg.replace_token
2296 (
2297 l_table_type_declar
2298 ,'$OBJECT_NAME_AFFIX$'
2299 ,CASE
2300 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
2301 ELSE '_' || g_all_object_name_affixes(affix_index)
2302 END
2303 );
2304 l_table_var_declar := xla_cmp_string_pkg.replace_token
2305 (
2306 l_table_var_declar
2307 ,'$OBJECT_NAME_AFFIX$'
2308 ,CASE
2309 WHEN g_all_object_name_affixes(affix_index) IS NULL
2310 THEN RPAD( ' '
2311 ,21
2312 ,' '
2313 )
2314 ELSE '_' ||
2315 RPAD( g_all_object_name_affixes(affix_index)
2316 ,20
2317 ,' '
2318 )
2319 END
2320 );
2321 l_write_proc_declar := xla_cmp_string_pkg.replace_token
2322 (
2323 l_write_proc_declar
2324 ,'$OBJECT_NAME_AFFIX$'
2325 ,CASE
2326 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
2327 ELSE '_' || g_all_object_name_affixes(affix_index)
2328 END
2329 );
2330 l_read_proc_declar := xla_cmp_string_pkg.replace_token
2331 (
2332 l_read_proc_declar
2333 ,'$OBJECT_NAME_AFFIX$'
2334 ,CASE
2335 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
2336 ELSE '_' || g_all_object_name_affixes(affix_index)
2337 END
2338 );
2339
2340 l_source_rec_field_declars := NULL;
2341 l_source_proc_param_declars := NULL;
2342
2343 --For each distinct source
2344 FOR source_rec IN
2345 (
2346 SELECT DISTINCT xsb.source_code
2347 ,xsb.source_type_code
2348 ,xsb.enabled_flag
2349 ,xsb.datatype_code
2350 FROM xla_tab_acct_types_b xtat
2351 ,xla_tab_acct_type_srcs xtsrc
2352 ,xla_sources_b xsb
2353 WHERE xtat.application_id = g_application_info.application_id
2354 AND NVL( xtat.object_name_affix
2355 ,LPAD('A',32, 'A')
2356 )
2357 = NVL( g_all_object_name_affixes(affix_index)
2358 ,LPAD('A',32, 'A')
2359 )
2360 AND xtat.enabled_flag = 'Y'
2361 AND xtsrc.account_type_code = xtat.account_type_code
2362 AND xsb.application_id = xtsrc.source_application_id
2363 AND xsb.source_code = xtsrc.source_code
2364 AND xsb.source_type_code = xtsrc.source_type_code
2365 ORDER BY xsb.source_code
2366 )
2367 LOOP
2368 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2369 trace
2370 ( p_module => l_log_module
2371 ,p_msg => 'Source code: ' || source_rec.source_code
2372 ,p_level => C_LEVEL_STATEMENT);
2373 END IF;
2374
2375 --If not a seeded source log an error and go to the next source
2376 IF source_rec.source_type_code <> 'S'
2377 THEN
2378 l_return_value := FALSE;
2379 IF (C_LEVEL_ERROR >= g_log_level) THEN
2380 trace
2381 ( p_module => l_log_module
2382 ,p_msg => 'Source ' || source_rec.source_code ||
2383 ' is not a seeded source.' ||
2384 'It will not be considered.'
2385 ,p_level => C_LEVEL_ERROR);
2386 END IF;
2387 --If source is not enabled log an error and go to the next source
2388 ELSIF source_rec.enabled_flag <> 'Y'
2389 THEN
2390 l_return_value := FALSE;
2391 IF (C_LEVEL_ERROR >= g_log_level) THEN
2392 trace
2393 (p_module => l_log_module
2394 ,p_msg => 'Source ' || source_rec.source_code ||
2395 ' is not enabled.' ||
2396 'It will not be considered.'
2397 ,p_level => C_LEVEL_ERROR);
2398 END IF;
2399 ELSE
2400 l_return_value := TRUE;
2401
2402 --get the template for the source record field declaration
2403 l_source_rec_field_declar := C_TMPL_SOURCE_REC_FIELD_DECLAR;
2404 l_source_proc_param_declar := C_TMPL_SOURCE_PROC_PARAM_DECLA;
2405
2406 --replace the source code
2407 l_source_rec_field_declar := xla_cmp_string_pkg.replace_token
2408 (
2409 l_source_rec_field_declar
2410 ,'$SOURCE_CODE$'
2411 ,RPAD( LOWER(source_rec.source_code)
2412 ,34
2413 ,' '
2414 )
2415 );
2416 --replace the source code
2417 l_source_proc_param_declar := xla_cmp_string_pkg.replace_token
2418 (
2419 l_source_proc_param_declar
2420 ,'$SOURCE_CODE$'
2421 ,RPAD( LOWER(source_rec.source_code)
2422 ,34
2423 ,' '
2424 )
2425 );
2426
2427
2428 --replace the datatype
2429 CASE
2430 WHEN source_rec.datatype_code = 'I'
2431 THEN l_datatype_specific_declar := 'INTEGER';
2432 l_datatype_generic_declar := 'INTEGER';
2433 WHEN source_rec.datatype_code = 'N'
2434 THEN l_datatype_specific_declar := 'NUMBER';
2435 l_datatype_generic_declar := 'NUMBER';
2436 WHEN source_rec.datatype_code = 'C'
2437 THEN l_datatype_specific_declar := 'VARCHAR2('|| C_CHAR_SOURCE_SIZE ||')';
2438 l_datatype_generic_declar := 'VARCHAR2';
2439 WHEN source_rec.datatype_code = 'D'
2440 THEN l_datatype_specific_declar := 'DATE';
2441 l_datatype_generic_declar := 'DATE';
2442 WHEN source_rec.datatype_code = 'F'
2443 THEN l_datatype_specific_declar := 'INTEGER';
2444 l_datatype_generic_declar := 'INTEGER';
2445 ELSE
2446 l_return_value := FALSE;
2447 IF (C_LEVEL_ERROR >= g_log_level) THEN
2448 trace
2449 (p_module => l_log_module
2450 ,p_msg => 'Source ' || source_rec.source_code ||
2451 ' has an unknown datatype: ' ||
2452 source_rec.datatype_code ||'. ' ||
2453 'It will not be considered.'
2454 ,p_level => C_LEVEL_ERROR);
2455 END IF;
2456
2457 END CASE;
2458
2459 l_source_rec_field_declar := xla_cmp_string_pkg.replace_token
2460 (
2461 l_source_rec_field_declar
2462 ,'$SOURCE_SPECIFIC_DATATYPE$'
2463 ,RPAD( l_datatype_specific_declar
2464 ,25
2465 ,' '
2466 )
2467 );
2468
2469 l_source_proc_param_declar := xla_cmp_string_pkg.replace_token
2470 (
2471 l_source_proc_param_declar
2472 ,'$SOURCE_GENERIC_DATATYPE$'
2473 ,RPAD( l_datatype_generic_declar
2474 ,25
2475 ,' '
2476 )
2477 );
2478
2479
2480 IF l_source_rec_field_declars IS NOT NULL
2481 THEN
2482 l_source_rec_field_declars := l_source_rec_field_declars ||
2483 g_chr_newline;
2484 END IF;
2485
2486 IF l_source_proc_param_declars IS NOT NULL
2487 THEN
2488 l_source_proc_param_declars := l_source_proc_param_declars ||
2489 g_chr_newline;
2490 END IF;
2491
2492 l_source_rec_field_declars := l_source_rec_field_declars ||
2493 l_source_rec_field_declar;
2494
2495 l_source_proc_param_declars := l_source_proc_param_declars ||
2496 l_source_proc_param_declar;
2497 END IF;
2498 END LOOP;
2499
2500 --replace the source field declarations
2501 l_record_type_declar := xla_cmp_string_pkg.replace_token
2502 (
2503 l_record_type_declar
2504 ,'$SOURCE_REC_FIELD_DECLARATIONS$'
2505 ,NVL(l_source_rec_field_declars, ' ')
2506 );
2507
2508 --replace the source parameter declarations
2509 l_write_proc_declar := xla_cmp_string_pkg.replace_token
2510 (
2511 l_write_proc_declar
2512 ,'$SOURCE_PROC_PARAM_DECLARATIONS$'
2513 ,NVL(l_source_proc_param_declars, ' ')
2514 );
2515
2516 --Concatenate the partial results into the OUT params
2517 IF l_record_type_declarations IS NOT NULL
2518 THEN
2519 l_record_type_declarations := l_record_type_declarations ||
2520 g_chr_newline;
2521 END IF;
2522 IF l_table_type_declarations IS NOT NULL
2523 THEN
2524 l_table_type_declarations := l_table_type_declarations ||
2525 g_chr_newline;
2526 END IF;
2527 IF l_table_var_declarations IS NOT NULL
2528 THEN
2529 l_table_var_declarations := l_table_var_declarations ||
2530 g_chr_newline;
2531 END IF;
2532 IF l_write_proc_declarations IS NOT NULL
2533 THEN
2534 l_write_proc_declarations := l_write_proc_declarations ||
2535 g_chr_newline;
2536 END IF;
2537 IF l_read_proc_declarations IS NOT NULL
2538 THEN
2539 l_read_proc_declarations := l_read_proc_declarations ||
2540 g_chr_newline;
2541 END IF;
2542
2543 l_record_type_declarations := l_record_type_declarations ||
2544 l_record_type_declar;
2545
2546 l_table_type_declarations := l_table_type_declarations ||
2547 l_table_type_declar;
2548
2549 l_table_var_declarations := l_table_var_declarations ||
2550 l_table_var_declar;
2551
2552 l_write_proc_declarations := l_write_proc_declarations ||
2553 l_write_proc_declar;
2554
2555 l_read_proc_declarations := l_read_proc_declarations ||
2556 l_read_proc_declar;
2557
2558 END LOOP;
2559
2560 --Assign return variables
2561 p_record_type_declarations := l_record_type_declarations;
2562 p_table_type_declarations := l_table_type_declarations;
2563 p_table_var_declarations := l_table_var_declarations;
2564 p_write_proc_declarations := l_write_proc_declarations;
2565 p_read_proc_declarations := l_read_proc_declarations;
2566
2567 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2568 trace
2569 (p_module => l_log_module
2570 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_declarations'
2571 ,p_level => C_LEVEL_PROCEDURE);
2572 END IF;
2573
2574 RETURN l_return_value;
2575 EXCEPTION
2576 WHEN xla_exceptions_pkg.application_exception
2577 THEN
2578 RAISE;
2579 WHEN OTHERS
2580 THEN
2581 xla_exceptions_pkg.raise_message
2582 (p_location => 'xla_cmp_tab_pkg.build_declarations');
2583
2584 END build_declarations;
2585
2586
2587
2588
2589 /*======================================================================+
2590 | |
2591 | Private Function |
2592 | |
2593 | create_package_body |
2594 | |
2595 | |
2596 | |
2597 | |
2598 +======================================================================*/
2599 FUNCTION create_package_body
2600 RETURN BOOLEAN
2601 IS
2602 l_return_value BOOLEAN;
2603 l_package_body_text CLOB;
2604
2605 l_log_module VARCHAR2 (2000);
2606
2607 BEGIN
2608 IF g_log_enabled THEN
2609 l_log_module := C_DEFAULT_MODULE||'.create_package_body';
2610 END IF;
2611
2612 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2613 trace
2614 (p_module => l_log_module
2615 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.create_package_body'
2616 ,p_level => C_LEVEL_PROCEDURE);
2617 END IF;
2618
2619 --build the package body
2620 IF NOT build_package_body
2621 (
2622 p_package_body_text => l_package_body_text
2623 )
2624 THEN
2625 l_return_value := FALSE;
2626 IF (C_LEVEL_ERROR >= g_log_level) THEN
2627 trace
2628 (p_module => l_log_module
2629 ,p_msg => 'build_package_body failed'
2630 ,p_level => C_LEVEL_ERROR);
2631 END IF;
2632 END IF;
2633
2634 IF NOT xla_cmp_create_pkg.push_database_object
2635 (
2636 p_object_name => g_tab_api_package_name
2637 ,p_object_type => 'PACKAGE BODY'
2638 ,p_object_owner => NULL --current user
2639 ,p_apps_account => g_application_info.apps_account
2640 ,p_msg_mode => G_OA_MESSAGE
2641 ,p_ddl_text => l_package_body_text
2642 )
2643 THEN
2644 l_return_value := FALSE;
2645 IF (C_LEVEL_ERROR >= g_log_level) THEN
2646 trace
2647 (p_module => l_log_module
2648 ,p_msg => 'push_database_object failed'
2649 ,p_level => C_LEVEL_ERROR);
2650 END IF;
2651 END IF;
2652
2653 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2654 trace
2655 (p_module => l_log_module
2656 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.create_package_body'
2657 ,p_level => C_LEVEL_PROCEDURE);
2658 END IF;
2659
2660 RETURN l_return_value;
2661 EXCEPTION
2662 WHEN xla_exceptions_pkg.application_exception
2663 THEN
2664 RAISE;
2665 WHEN OTHERS
2666 THEN
2667 xla_exceptions_pkg.raise_message
2668 (p_location => 'xla_cmp_tab_pkg.create_package_body');
2669
2670 END create_package_body;
2671
2672
2673 /*======================================================================+
2674 | |
2675 | Private Function |
2676 | |
2677 | build_package_spec |
2678 | |
2679 | |
2680 | |
2681 | |
2682 +======================================================================*/
2683 FUNCTION build_package_body
2684 (
2685 p_package_body_text OUT NOCOPY CLOB
2686 )
2687 RETURN BOOLEAN
2688 IS
2689 l_history CLOB;
2690 l_write_proc_impls CLOB;
2691 l_read_proc_impls CLOB;
2692 l_reset_interface_proc_stmts CLOB;
2693
2694 l_package_body_text CLOB;
2695
2696 l_return_value BOOLEAN;
2697
2698 l_index INTEGER;
2699
2700 l_log_module VARCHAR2 (2000);
2701 BEGIN
2702 IF g_log_enabled THEN
2703 l_log_module := C_DEFAULT_MODULE||'.build_package_body';
2704 END IF;
2705
2706 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2707 trace
2708 (p_module => l_log_module
2709 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_package_body'
2710 ,p_level => C_LEVEL_PROCEDURE);
2711 END IF;
2712
2713 l_return_value := TRUE;
2714
2715 --take the package body template
2716 l_package_body_text := C_TMPL_TAB_PACKAGE_BODY;
2717
2718 --replace the package name tokens
2719 l_package_body_text := xla_cmp_string_pkg.replace_token
2720 (
2721 l_package_body_text
2722 ,'$TAB_API_PACKAGE_NAME_1$'
2723 ,g_tab_api_package_name
2724 );
2725
2726 l_package_body_text := xla_cmp_string_pkg.replace_token
2727 (
2728 l_package_body_text
2729 ,'$TAB_API_PACKAGE_NAME_2$'
2730 ,RPAD( g_tab_api_package_name
2731 , 66
2732 , ' '
2733 )
2734 || '|'
2735 );
2736
2737 l_package_body_text := xla_cmp_string_pkg.replace_token
2738 (
2739 l_package_body_text
2740 ,'$TAB_API_PACKAGE_NAME_3$'
2741 ,LOWER(g_tab_api_package_name)
2742 );
2743
2744 l_package_body_text := xla_cmp_string_pkg.replace_token
2745 (
2746 l_package_body_text
2747 ,'$oracle_user_name$'
2748 ,LOWER(g_application_info.oracle_username)
2749 );
2750
2751 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2752 trace
2753 (p_module => l_log_module
2754 ,p_msg => 'Replaced package name tokens'
2755 ,p_level => C_LEVEL_STATEMENT);
2756 END IF;
2757
2758 --replace the application name token
2759 l_package_body_text := xla_cmp_string_pkg.replace_token
2760 (
2761 l_package_body_text
2762 ,'$APPLICATION_NAME$'
2763 ,RPAD( g_application_info.application_name
2764 , 66
2765 , ' '
2766 ) || '|'
2767 );
2768
2769 --replace the application id token
2770 l_package_body_text := xla_cmp_string_pkg.replace_token
2771 (
2772 l_package_body_text
2773 ,'$APPLICATION_ID$'
2774 ,RPAD( TO_CHAR(g_application_info.application_id) || ')'
2775 , 49
2776 , ' '
2777 ) || '|'
2778 );
2779 l_package_body_text := xla_cmp_string_pkg.replace_token
2780 (
2781 l_package_body_text
2782 ,'$APPLICATION_ID_2$'
2783 ,TO_CHAR(g_application_info.application_id)
2784 );
2785
2786 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2787 trace
2788 (p_module => l_log_module
2789 ,p_msg => 'Replaced application tokens'
2790 ,p_level => C_LEVEL_STATEMENT);
2791 END IF;
2792
2793
2794 --build the package history
2795 IF NOT build_package_history (l_history )
2796 THEN
2797 --not a fatal error
2798 IF (C_LEVEL_ERROR >= g_log_level) THEN
2799 trace
2800 (p_module => l_log_module
2801 ,p_msg => 'cannot build package history'
2802 ,p_level => C_LEVEL_ERROR);
2803 END IF;
2804 l_return_value := FALSE;
2805 END IF;
2806
2807 --replace the history token
2808 l_package_body_text := xla_cmp_string_pkg.replace_token
2809 (
2810 l_package_body_text
2811 ,'$HISTORY$'
2812 ,RPAD( l_history
2813 , 66
2814 , ' '
2815 ) || '|'
2816 );
2817
2818 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2819 trace
2820 (p_module => l_log_module
2821 ,p_msg => 'Replaced history token'
2822 ,p_level => C_LEVEL_STATEMENT);
2823 END IF;
2824
2825 --build the type and function implementations
2826 IF NOT build_implementations
2827 (
2828 x_write_proc_implementations => l_write_proc_impls
2829 ,x_read_proc_implementations => l_read_proc_impls
2830 ,x_reset_interface_proc_stmts => l_reset_interface_proc_stmts
2831 )
2832 THEN
2833 --not a fatal error
2834 IF (C_LEVEL_ERROR >= g_log_level) THEN
2835 trace
2836 (p_module => l_log_module
2837 ,p_msg => 'cannot build implementations'
2838 ,p_level => C_LEVEL_ERROR);
2839 END IF;
2840 l_return_value := FALSE;
2841 END IF;
2842
2843 --replace the write procedure implementations token
2844 l_package_body_text := xla_cmp_common_pkg.replace_token
2845 (
2846 p_original_text => l_package_body_text
2847 ,p_token => '$TAB_WRITE_PROC_IMPLS$'
2848 ,p_replacement_text => l_write_proc_impls
2849 );
2850
2851 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2852 trace
2853 (p_module => l_log_module
2854 ,p_msg => 'Replaced write proc impls tokens'
2855 ,p_level => C_LEVEL_STATEMENT);
2856 END IF;
2857
2858 --replace the read procedure implementations token
2859 l_package_body_text := xla_cmp_common_pkg.replace_token
2860 (
2861 p_original_text => l_package_body_text
2862 ,p_token => '$TAB_READ_PROC_IMPLS$'
2863 ,p_replacement_text => l_read_proc_impls
2864 );
2865
2866 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2867 trace
2868 (p_module => l_log_module
2869 ,p_msg => 'Replaced read proc impls tokens'
2870 ,p_level => C_LEVEL_STATEMENT);
2871 END IF;
2872
2873 --replace the reset online interface statements token
2874 l_package_body_text := xla_cmp_common_pkg.replace_token
2875 (
2876 p_original_text => l_package_body_text
2877 ,p_token => '$RESET_ONLINE_INTERFACES_STMTS$'
2878 ,p_replacement_text => l_reset_interface_proc_stmts
2879 );
2880
2881 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2882 trace
2883 (p_module => l_log_module
2884 ,p_msg => 'Replaced read proc impls tokens'
2885 ,p_level => C_LEVEL_STATEMENT);
2886 END IF;
2887
2888 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2889 trace
2890 (p_module => l_log_module
2891 ,p_msg => 'p_package_body_text length: ' ||
2892 LENGTH(l_package_body_text)
2893 ,p_level => C_LEVEL_STATEMENT);
2894 END IF;
2895
2896 --Assign return variables
2897 p_package_body_text := l_package_body_text;
2898
2899 l_return_value := TRUE;
2900
2901 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2902 trace
2903 (p_module => l_log_module
2904 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_package_body'
2905 ,p_level => C_LEVEL_PROCEDURE);
2906 END IF;
2907
2908 RETURN l_return_value;
2909
2910 EXCEPTION
2911 WHEN xla_exceptions_pkg.application_exception
2912 THEN
2913 RAISE;
2914 WHEN OTHERS
2915 THEN
2916 xla_exceptions_pkg.raise_message
2917 (p_location => 'xla_cmp_tab_pkg.build_package_body');
2918
2919 END build_package_body;
2920
2921
2922 /*======================================================================+
2923 | |
2924 | Private Function |
2925 | |
2926 | build_proc_implementations |
2927 | |
2928 | |
2929 | |
2930 | |
2931 +======================================================================*/
2932 FUNCTION build_implementations
2933 (
2934 x_write_proc_implementations OUT NOCOPY CLOB
2935 ,x_read_proc_implementations OUT NOCOPY CLOB
2936 ,x_reset_interface_proc_stmts OUT NOCOPY CLOB
2937 )
2938 RETURN BOOLEAN
2939 IS
2940 l_return_value BOOLEAN;
2941 l_write_proc_impl CLOB;
2942 l_read_proc_impl CLOB;
2943 l_reset_interface_proc_stmt CLOB;
2944
2945 l_write_proc_implementations CLOB;
2946 l_read_proc_implementations CLOB;
2947 l_reset_interface_proc_stmts CLOB;
2948
2949 l_source_proc_param_declars CLOB;
2950 l_source_proc_param_declar CLOB;
2951
2952 l_source_rec_field_assgn CLOB;
2953 l_source_rec_field_assgns CLOB;
2954
2955 l_datatype_specific_declar VARCHAR2(30);
2956 l_datatype_generic_declar VARCHAR2(30);
2957 l_log_module VARCHAR2 (2000);
2958
2959 BEGIN
2960 IF g_log_enabled THEN
2961 l_log_module := C_DEFAULT_MODULE||'.build_implementations';
2962 END IF;
2963
2964 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2965 trace
2966 (p_module => l_log_module
2967 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_implementations'
2968 ,p_level => C_LEVEL_PROCEDURE);
2969 END IF;
2970
2971 --For each distinct object name affix
2972 FOR affix_index IN 1..g_all_object_name_affixes.COUNT
2973 LOOP
2974 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
2975 trace
2976 (p_module => l_log_module
2977 ,p_msg => 'current affix: ' ||
2978 NVL(g_all_object_name_affixes(affix_index), 'NULL')
2979 ,p_level => C_LEVEL_STATEMENT);
2980 END IF;
2981
2982 --get the various templates
2983 l_write_proc_impl := C_TMPL_TAB_WRITE_PROC_IMPL;
2984 l_read_proc_impl := C_TMPL_TAB_READ_PROC_IMPL;
2985 l_reset_interface_proc_stmt := C_TMPL_TAB_RESET_ONLINE_INT_ST;
2986
2987 --replace package name tokens
2988 l_write_proc_impl := xla_cmp_string_pkg.replace_token
2989 (
2990 l_write_proc_impl
2991 ,'$TAB_API_PACKAGE_NAME_3$'
2992 ,LOWER(g_tab_api_package_name)
2993 );
2994
2995 l_read_proc_impl := xla_cmp_string_pkg.replace_token
2996 (
2997 l_read_proc_impl
2998 ,'$TAB_API_PACKAGE_NAME_3$'
2999 ,LOWER(g_tab_api_package_name)
3000 );
3001
3002
3003 --replace object name affix tokens
3004 l_write_proc_impl := xla_cmp_string_pkg.replace_token
3005 (
3006 l_write_proc_impl
3007 ,'$OBJECT_NAME_AFFIX$'
3008 ,CASE
3009 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
3010 ELSE '_' || g_all_object_name_affixes(affix_index)
3011 END
3012 );
3013 l_read_proc_impl := xla_cmp_string_pkg.replace_token
3014 (
3015 l_read_proc_impl
3016 ,'$OBJECT_NAME_AFFIX$'
3017 ,CASE
3018 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
3019 ELSE '_' || g_all_object_name_affixes(affix_index)
3020 END
3021 );
3022
3023 l_reset_interface_proc_stmt := xla_cmp_string_pkg.replace_token
3024 (
3025 l_reset_interface_proc_stmt
3026 ,'$OBJECT_NAME_AFFIX$.'
3027 ,CASE
3028 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN '.'
3029 ELSE '_' || g_all_object_name_affixes(affix_index) || '.'
3030 END
3031 );
3032
3033 l_source_proc_param_declars := NULL;
3034 l_source_rec_field_assgns := NULL;
3035
3036 --For each distinct source
3037 FOR source_rec IN
3038 (
3039 SELECT DISTINCT xsb.source_code
3040 ,xsb.source_type_code
3041 ,xsb.enabled_flag
3042 ,xsb.datatype_code
3043 FROM xla_tab_acct_types_b xtat
3044 ,xla_tab_acct_type_srcs xtsrc
3045 ,xla_sources_b xsb
3046 WHERE xtat.application_id = g_application_info.application_id
3047 AND NVL( xtat.object_name_affix
3048 ,LPAD('A',32, 'A')
3049 )
3050 = NVL( g_all_object_name_affixes(affix_index)
3051 ,LPAD('A',32, 'A')
3052 )
3053 AND xtat.enabled_flag = 'Y'
3054 AND xtsrc.account_type_code = xtat.account_type_code
3055 AND xsb.application_id = xtsrc.source_application_id
3056 AND xsb.source_code = xtsrc.source_code
3057 AND xsb.source_type_code = xtsrc.source_type_code
3058 ORDER BY xsb.source_code
3059 )
3060 LOOP
3061 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3062 trace
3063 ( p_module => l_log_module
3064 ,p_msg => 'Source code: ' || source_rec.source_code
3065 ,p_level => C_LEVEL_STATEMENT);
3066 END IF;
3067
3068 --If not a seeded source log an error and go to the next source
3069 IF source_rec.source_type_code <> 'S'
3070 THEN
3071 l_return_value := FALSE;
3072 IF (C_LEVEL_ERROR >= g_log_level) THEN
3073 trace
3074 (p_module => l_log_module
3075 ,p_msg => 'Source ' || source_rec.source_code ||
3076 ' is not a seeded source.' ||
3077 'It will not be considered.'
3078 ,p_level => C_LEVEL_ERROR);
3079 END IF;
3080 --If source is not enabled log an error and go to the next source
3081 ELSIF source_rec.enabled_flag <> 'Y'
3082 THEN
3083 l_return_value := FALSE;
3084 IF (C_LEVEL_ERROR >= g_log_level) THEN
3085 trace
3086 (p_module => l_log_module
3087 ,p_msg => 'Source ' || source_rec.source_code ||
3088 ' is not enabled.' ||
3089 'It will not be considered.'
3090 ,p_level => C_LEVEL_ERROR);
3091 END IF;
3092 ELSE
3093 l_return_value := TRUE;
3094
3095 --get the template for the source record field declaration
3096 l_source_proc_param_declar := C_TMPL_SOURCE_PROC_PARAM_DECLA;
3097 l_source_rec_field_assgn := C_TMPL_SOURCE_REC_FIELD_ASSGN;
3098
3099 --replace the source code tokens
3100 l_source_proc_param_declar := xla_cmp_string_pkg.replace_token
3101 (
3102 l_source_proc_param_declar
3103 ,'$SOURCE_CODE$'
3104 ,RPAD( LOWER(source_rec.source_code)
3105 ,34
3106 ,' '
3107 )
3108 );
3109 l_source_rec_field_assgn := xla_cmp_string_pkg.replace_token
3110 (
3111 l_source_rec_field_assgn
3112 ,'$SOURCE_CODE_LEFT$'
3113 ,RPAD( LOWER(source_rec.source_code)
3114 ,30
3115 ,' '
3116 )
3117 );
3118 l_source_rec_field_assgn := xla_cmp_string_pkg.replace_token
3119 (
3120 l_source_rec_field_assgn
3121 ,'$SOURCE_CODE_RIGHT$'
3122 ,LOWER(source_rec.source_code)
3123 );
3124
3125 --replace the datatype
3126 CASE
3127 WHEN source_rec.datatype_code = 'I'
3128 THEN l_datatype_specific_declar := 'INTEGER';
3129 l_datatype_generic_declar := 'INTEGER';
3130 WHEN source_rec.datatype_code = 'N'
3131 THEN l_datatype_specific_declar := 'NUMBER';
3132 l_datatype_generic_declar := 'NUMBER';
3133 WHEN source_rec.datatype_code = 'C'
3134 THEN l_datatype_specific_declar := 'VARCHAR2('|| C_CHAR_SOURCE_SIZE ||')';
3135 l_datatype_generic_declar := 'VARCHAR2';
3136 WHEN source_rec.datatype_code = 'D'
3137 THEN l_datatype_specific_declar := 'DATE';
3138 l_datatype_generic_declar := 'DATE';
3139 WHEN source_rec.datatype_code = 'F'
3140 THEN l_datatype_specific_declar := 'INTEGER';
3141 l_datatype_generic_declar := 'INTEGER';
3142 ELSE
3143 l_return_value := FALSE;
3144 IF (C_LEVEL_ERROR >= g_log_level) THEN
3145 trace
3146 (p_module => l_log_module
3147 ,p_msg => 'Source ' || source_rec.source_code ||
3148 ' has an unknown datatype: ' ||
3149 source_rec.datatype_code ||'. ' ||
3150 'It will not be considered.'
3151 ,p_level => C_LEVEL_ERROR);
3152 END IF;
3153
3154 END CASE;
3155
3156 l_source_proc_param_declar := xla_cmp_string_pkg.replace_token
3157 (
3158 l_source_proc_param_declar
3159 ,'$SOURCE_GENERIC_DATATYPE$'
3160 ,RPAD( l_datatype_generic_declar
3161 ,25
3162 ,' '
3163 )
3164 );
3165
3166
3167 IF l_source_proc_param_declars IS NOT NULL
3168 THEN
3169 l_source_proc_param_declars := l_source_proc_param_declars ||
3170 g_chr_newline;
3171 END IF;
3172
3173 IF l_source_rec_field_assgns IS NOT NULL
3174 THEN
3175 l_source_rec_field_assgns := l_source_rec_field_assgns ||
3176 g_chr_newline;
3177 END IF;
3178
3179 l_source_proc_param_declars := l_source_proc_param_declars ||
3180 l_source_proc_param_declar;
3181
3182 l_source_rec_field_assgns := l_source_rec_field_assgns ||
3183 l_source_rec_field_assgn;
3184
3185 END IF;
3186 END LOOP;
3187
3188 --replace the source parameter declarations
3189 l_write_proc_impl := xla_cmp_string_pkg.replace_token
3190 (
3191 l_write_proc_impl
3192 ,'$SOURCE_PROC_PARAM_DECLARATIONS$'
3193 ,NVL(l_source_proc_param_declars, ' ')
3194 );
3195
3196 --replace the source field assignments
3197 l_write_proc_impl := xla_cmp_string_pkg.replace_token
3198 (
3199 l_write_proc_impl
3200 ,'$SOURCE_REC_FIELD_ASSIGNMENTS$'
3201 ,NVL(l_source_rec_field_assgns, ' ')
3202 );
3203 --replace the affixes
3204 l_write_proc_impl := xla_cmp_string_pkg.replace_token
3205 (
3206 l_write_proc_impl
3207 ,'$OBJECT_NAME_AFFIX$'
3208 ,CASE
3209 WHEN g_all_object_name_affixes(affix_index) IS NULL THEN ' '
3210 ELSE '_' || g_all_object_name_affixes(affix_index)
3211 END
3212 );
3213
3214 --Concatenate the partial results
3215 IF l_write_proc_implementations IS NOT NULL
3216 THEN
3217 l_write_proc_implementations := l_write_proc_implementations ||
3218 g_chr_newline;
3219 END IF;
3220 IF l_read_proc_implementations IS NOT NULL
3221 THEN
3222 l_read_proc_implementations := l_read_proc_implementations ||
3223 g_chr_newline;
3224 END IF;
3225
3226 l_write_proc_implementations := l_write_proc_implementations ||
3227 l_write_proc_impl;
3228
3229 l_read_proc_implementations := l_read_proc_implementations ||
3230 l_read_proc_impl;
3231
3232 l_reset_interface_proc_stmts := l_reset_interface_proc_stmts ||
3233 l_reset_interface_proc_stmt;
3234
3235 END LOOP;
3236
3237 --Assign the OUT params
3238 x_write_proc_implementations := l_write_proc_implementations;
3239 x_read_proc_implementations := l_read_proc_implementations;
3240 x_reset_interface_proc_stmts := l_reset_interface_proc_stmts;
3241
3242 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3243 trace
3244 (p_module => l_log_module
3245 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_implementations'
3246 ,p_level => C_LEVEL_PROCEDURE);
3247 END IF;
3248
3249 RETURN l_return_value;
3250 EXCEPTION
3251 WHEN xla_exceptions_pkg.application_exception
3252 THEN
3253 RAISE;
3254 WHEN OTHERS
3255 THEN
3256 xla_exceptions_pkg.raise_message
3257 (p_location => 'xla_cmp_tab_pkg.build_implementations');
3258
3259 END build_implementations;
3260
3261
3262
3263 /*======================================================================+
3264 | |
3265 | Private Function |
3266 | |
3267 | create_temp_tables |
3268 | |
3269 | |
3270 | |
3271 | |
3272 +======================================================================*/
3273 FUNCTION create_temp_tables
3274 RETURN BOOLEAN
3275 IS
3276 l_return_value BOOLEAN;
3277 l_global_table_name VARCHAR2(50); --must contain the template
3278 l_table_creation_text CLOB;
3279 l_log_module VARCHAR2 (2000);
3280
3281 BEGIN
3282 IF g_log_enabled THEN
3283 l_log_module := C_DEFAULT_MODULE||'.create_temp_tables';
3284 END IF;
3285
3286 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3287 trace
3288 (p_module => l_log_module
3289 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.create_temp_tables'
3290 ,p_level => C_LEVEL_PROCEDURE);
3291 END IF;
3292
3293 l_return_value := TRUE;
3294
3295 --build the temp tables one at a time
3296 --For each distinct object name affix
3297 FOR affix_index IN 1..g_all_object_name_affixes.COUNT
3298 LOOP
3299 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3300 trace
3301 (p_module => l_log_module
3302 ,p_msg => 'current affix: ' ||
3303 NVL(g_all_object_name_affixes(affix_index), 'NULL')
3304 ,p_level => C_LEVEL_STATEMENT);
3305 END IF;
3306
3307 IF NOT build_global_temp_table
3308 (
3309 p_object_name_affix => g_all_object_name_affixes(affix_index)
3310 ,x_global_table_name => l_global_table_name
3311 ,x_table_creation_text => l_table_creation_text
3312 )
3313 THEN
3314 l_return_value := FALSE;
3315 IF (C_LEVEL_ERROR >= g_log_level) THEN
3316 trace
3317 (p_module => l_log_module
3318 ,p_msg => 'build_global_temp_table failed'
3319 ,p_level => C_LEVEL_ERROR);
3320 END IF;
3321 END IF;
3322
3323 IF NOT xla_cmp_create_pkg.push_database_object
3324 (
3325 p_object_name => l_global_table_name
3326 ,p_object_type => 'TABLE'
3327 ,p_ddl_text => l_table_creation_text
3328 ,p_apps_account => g_application_info.apps_account
3329 ,p_msg_mode => G_OA_MESSAGE
3330 ,p_object_owner => g_application_info.oracle_username
3331 )
3332 THEN
3333 l_return_value := FALSE;
3334 IF (C_LEVEL_ERROR >= g_log_level) THEN
3335 trace
3336 (p_module => l_log_module
3337 ,p_msg => 'push_database_object failed'
3338 ,p_level => C_LEVEL_ERROR);
3339 END IF;
3340 END IF;
3341
3342 END LOOP;
3343
3344 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3345 trace
3346 (p_module => l_log_module
3347 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.create_temp_tables'
3348 ,p_level => C_LEVEL_PROCEDURE);
3349 END IF;
3350
3351 RETURN l_return_value;
3352 EXCEPTION
3353 WHEN xla_exceptions_pkg.application_exception
3354 THEN
3355 RAISE;
3356 WHEN OTHERS
3357 THEN
3358 xla_exceptions_pkg.raise_message
3359 (p_location => 'xla_cmp_tab_pkg.create_temp_tables');
3360
3361 END create_temp_tables;
3362
3363
3364 /*======================================================================+
3365 | |
3366 | Private Function |
3367 | |
3368 | get_interface_object_names |
3369 | |
3370 | |
3371 | |
3372 | |
3373 +======================================================================*/
3374 FUNCTION get_interface_object_names
3375 (
3376 p_object_name_affix IN VARCHAR2
3377 ,x_global_table_name OUT NOCOPY VARCHAR2
3378 ,x_plsql_table_name OUT NOCOPY VARCHAR2
3379 )
3380 RETURN BOOLEAN
3381 IS
3382 l_return_value BOOLEAN;
3383
3384 l_global_table_name VARCHAR2(100);
3385 l_plsql_table_name VARCHAR2(100);
3386 l_log_module VARCHAR2 (2000);
3387
3388 BEGIN
3389 IF g_log_enabled THEN
3390 l_log_module := C_DEFAULT_MODULE||'.get_interface_object_names';
3391 END IF;
3392
3393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3394 trace
3395 (p_module => l_log_module
3396 ,p_msg => 'BEGIN ' || l_log_module
3397 ,p_level => C_LEVEL_PROCEDURE);
3398 END IF;
3399
3400 --build the global temporary table name
3401 --get the template for the table name
3402 l_global_table_name := C_TMPL_TAB_GLOBAL_TABLE_NAME;
3403 --replace the product abbreviation
3404 l_global_table_name := xla_cmp_string_pkg.replace_token
3405 (
3406 l_global_table_name
3407 ,'$PRODUCT_ABBR$'
3408 ,g_application_info.product_abbreviation
3409 );
3410 --replace the object_name_affix
3411 l_global_table_name := xla_cmp_string_pkg.replace_token
3412 (
3413 l_global_table_name
3414 ,'$OBJECT_NAME_AFFIX$'
3415 ,CASE
3416 WHEN p_object_name_affix IS NULL THEN '_'
3417 ELSE '_' || p_object_name_affix || '_'
3418 END
3419 );
3420
3421 --build the plsql table name
3422 --get the template for the table name
3423 l_plsql_table_name := C_TMPL_TAB_PLSQL_TABLE_NAME;
3424 --replace the product abbreviation
3425 l_plsql_table_name := xla_cmp_string_pkg.replace_token
3426 (
3427 l_plsql_table_name
3428 ,'$PRODUCT_ABBR$'
3429 ,g_application_info.product_abbreviation
3430 );
3431 --replace the object_name_affix
3432 l_plsql_table_name := xla_cmp_string_pkg.replace_token
3433 (
3434 l_plsql_table_name
3435 ,'$OBJECT_NAME_AFFIX$'
3436 ,CASE
3437 WHEN p_object_name_affix IS NULL THEN ' '
3438 ELSE '_' || p_object_name_affix
3439 END
3440 );
3441
3442 --Assign the out parameters
3443 x_global_table_name := l_global_table_name;
3444 x_plsql_table_name := l_plsql_table_name;
3445
3446 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3447 trace
3448 (p_module => l_log_module
3449 ,p_msg => 'END ' || l_log_module
3450 ,p_level => C_LEVEL_PROCEDURE);
3451 END IF;
3452
3453 RETURN l_return_value;
3454 EXCEPTION
3455 WHEN xla_exceptions_pkg.application_exception
3456 THEN
3457 RAISE;
3458 WHEN OTHERS
3459 THEN
3460 xla_exceptions_pkg.raise_message
3461 (p_location => 'xla_cmp_tab_pkg.get_interface_object_names');
3462
3463 END get_interface_object_names;
3464
3465
3466
3467 /*======================================================================+
3468 | |
3469 | Private Function |
3470 | |
3471 | get_interface_object_names |
3472 | |
3473 | |
3474 | |
3475 | |
3476 +======================================================================*/
3477 FUNCTION get_interface_object_names
3478 (
3479 p_application_id IN VARCHAR2
3480 ,p_object_name_affix IN VARCHAR2
3481 ,x_global_table_name OUT NOCOPY VARCHAR2
3482 ,x_plsql_table_name OUT NOCOPY VARCHAR2
3483 )
3484 RETURN BOOLEAN
3485 IS
3486 l_return_value BOOLEAN;
3487
3488 l_global_table_name VARCHAR2(30);
3489 l_plsql_table_name VARCHAR2(30);
3490 l_log_module VARCHAR2(2000);
3491
3492 BEGIN
3493 IF g_log_enabled THEN
3494 l_log_module := C_DEFAULT_MODULE||'.get_interface_object_names';
3495 END IF;
3496
3497 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3498 trace
3499 (p_module => l_log_module
3500 ,p_msg => 'BEGIN ' || l_log_module
3501 ,p_level => C_LEVEL_PROCEDURE);
3502 END IF;
3503
3504 --If the function is called from an external procedure
3505 IF g_application_info.application_id IS NULL
3506 OR g_application_info.application_id <> p_application_id
3507 THEN
3508 --Initialize global variables
3509 IF NOT init_global_variables
3510 (
3511 p_application_id => p_application_id
3512 )
3513 THEN
3514 --If global vars cannot be set we cannot continue
3515 IF (C_LEVEL_ERROR >= g_log_level) THEN
3516 trace
3517 (p_module => l_log_module
3518 ,p_msg => 'init_global_variables failed'
3519 ,p_level => C_LEVEL_ERROR);
3520 END IF;
3521 l_return_value := FALSE;
3522 RAISE le_fatal_error;
3523 END IF;
3524 END IF;
3525
3526 IF NOT get_interface_object_names
3527 (
3528 p_object_name_affix => p_object_name_affix
3529 ,x_global_table_name => l_global_table_name
3530 ,x_plsql_table_name => l_plsql_table_name
3531 )
3532 THEN
3533 --If global vars cannot be set we cannot continue
3534 IF (C_LEVEL_ERROR >= g_log_level) THEN
3535 trace
3536 ( p_module => l_log_module
3537 ,p_msg => 'get_interface_object_names'
3538 ,p_level => C_LEVEL_ERROR
3539 );
3540 END IF;
3541 l_return_value := FALSE;
3542 RAISE le_fatal_error;
3543 END IF;
3544
3545 --Assign the out parameters
3546 x_global_table_name := l_global_table_name;
3547 x_plsql_table_name := l_plsql_table_name;
3548
3549 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3550 trace
3551 (p_module => l_log_module
3552 ,p_msg => 'END ' || l_log_module
3553 ,p_level => C_LEVEL_PROCEDURE);
3554 END IF;
3555
3556 RETURN l_return_value;
3557 EXCEPTION
3558 WHEN xla_exceptions_pkg.application_exception
3559 THEN
3560 RAISE;
3561 WHEN OTHERS
3562 THEN
3563 xla_exceptions_pkg.raise_message
3564 (p_location => 'xla_cmp_tab_pkg.get_interface_object_names');
3565
3566 END get_interface_object_names;
3567
3568
3569
3570
3571
3572 /*======================================================================+
3573 | |
3574 | Private Function |
3575 | |
3576 | get_interface_sources |
3577 | |
3578 | |
3579 | |
3580 | |
3581 +======================================================================*/
3582 FUNCTION get_interface_sources
3583 (
3584 p_application_id IN VARCHAR2
3585 ,p_object_name_affix IN VARCHAR2
3586 ,x_table_of_sources OUT NOCOPY gt_table_of_varchar2_30
3587 ,x_table_of_source_datatypes OUT NOCOPY gt_table_of_varchar2_1
3588 )
3589 RETURN BOOLEAN
3590 IS
3591 l_return_value BOOLEAN;
3592
3593 l_table_of_sources gt_table_of_varchar2_30;
3594 l_table_of_source_datatypes gt_table_of_varchar2_1;
3595
3596 l_log_module VARCHAR2(2000);
3597
3598 BEGIN
3599 IF g_log_enabled THEN
3600 l_log_module := C_DEFAULT_MODULE||'.get_interface_sources';
3601 END IF;
3602
3603 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3604 trace
3605 (p_module => l_log_module
3606 ,p_msg => 'BEGIN ' || l_log_module
3607 ,p_level => C_LEVEL_PROCEDURE);
3608 END IF;
3609
3610 --If the function is called from an external procedure
3611 IF g_application_info.application_id IS NULL
3612 OR g_application_info.application_id <> p_application_id
3613 THEN
3614 --Initialize global variables
3615 IF NOT init_global_variables
3616 (
3617 p_application_id => p_application_id
3618 )
3619 THEN
3620 --If global vars cannot be set we cannot continue
3621 IF (C_LEVEL_ERROR >= g_log_level) THEN
3622 trace
3623 (p_module => l_log_module
3624 ,p_msg => 'init_global_variables failed'
3625 ,p_level => C_LEVEL_ERROR);
3626 END IF;
3627 l_return_value := FALSE;
3628 RAISE le_fatal_error;
3629 END IF;
3630 END IF;
3631
3632 --For each distinct source
3633 SELECT DISTINCT xsb.source_code
3634 ,xsb.datatype_code
3635 BULK COLLECT
3636 INTO l_table_of_sources
3637 ,l_table_of_source_datatypes
3638 FROM xla_tab_acct_types_b xtat
3639 ,xla_tab_acct_type_srcs xtsrc
3640 ,xla_sources_b xsb
3641 WHERE xtat.application_id = g_application_info.application_id
3642 AND NVL( xtat.object_name_affix
3643 ,LPAD('A',32, 'A')
3644 )
3645 = NVL( p_object_name_affix
3646 ,LPAD('A',32, 'A')
3647 )
3648 AND xtat.enabled_flag = 'Y'
3649 AND xtat.compile_status_code =
3650 xla_cmp_common_pkg.G_COMPILE_STATUS_CODE_COMPILED
3651 AND xtsrc.account_type_code = xtat.account_type_code
3652 AND xsb.application_id = xtsrc.source_application_id
3653 AND xsb.source_code = xtsrc.source_code
3654 AND xsb.source_type_code = xtsrc.source_type_code
3655 AND xsb.source_type_code = 'S' --only seeded sources
3656 ORDER BY xsb.source_code;
3657
3658 IF l_table_of_sources IS NULL
3659 THEN
3660 RAISE le_fatal_error;
3661
3662 END IF;
3663
3664 --Assign the out parameters
3665 x_table_of_sources := l_table_of_sources;
3666 x_table_of_source_datatypes := l_table_of_source_datatypes;
3667
3668 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3669 trace
3670 (p_module => l_log_module
3671 ,p_msg => 'END ' || l_log_module
3672 ,p_level => C_LEVEL_PROCEDURE);
3673 END IF;
3674
3675 RETURN l_return_value;
3676 EXCEPTION
3677 WHEN le_fatal_error
3678 THEN
3679 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3680 trace
3681 (p_module => l_log_module
3682 ,p_msg => 'Fatal error'
3683 ,p_level => C_LEVEL_ERROR);
3684 END IF;
3685 RETURN FALSE;
3686 WHEN xla_exceptions_pkg.application_exception
3687 THEN
3688 RAISE;
3689 WHEN OTHERS
3690 THEN
3691 xla_exceptions_pkg.raise_message
3692 (p_location => 'xla_cmp_tab_pkg.get_interface_sources');
3693
3694 END get_interface_sources;
3695
3696
3697
3698
3699
3700 /*======================================================================+
3701 | |
3702 | Private Function |
3703 | |
3704 | build_global_temp_table |
3705 | |
3706 | |
3707 | |
3708 | |
3709 +======================================================================*/
3710 FUNCTION build_global_temp_table
3711 (
3712 p_object_name_affix IN VARCHAR2
3713 ,x_global_table_name OUT NOCOPY VARCHAR2
3714 ,x_table_creation_text OUT NOCOPY CLOB
3715 )
3716 RETURN BOOLEAN
3717 IS
3718 l_return_value BOOLEAN;
3719
3720 l_source_table_field_declars CLOB;
3721 l_source_table_field_declar CLOB;
3722
3723 l_global_table_name VARCHAR2(30);
3724 l_plsql_table_name VARCHAR2(30);
3725 l_table_creation_text CLOB;
3726
3727 l_datatype_specific_declar VARCHAR2(30);
3728
3729 l_fatal_error_message VARCHAR2(50);
3730 l_log_module VARCHAR2 (2000);
3731
3732 BEGIN
3733 IF g_log_enabled THEN
3734 l_log_module := C_DEFAULT_MODULE||'.build_global_temp_table';
3735 END IF;
3736
3737 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3738 trace
3739 (p_module => l_log_module
3740 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.build_global_temp_table'
3741 ,p_level => C_LEVEL_PROCEDURE);
3742 END IF;
3743
3744 --build the table name
3745 IF NOT get_interface_object_names
3746 (
3747 p_object_name_affix => p_object_name_affix
3748 ,x_global_table_name => l_global_table_name
3749 ,x_plsql_table_name => l_plsql_table_name
3750 )
3751 THEN
3752 l_fatal_error_message := 'No enabled Transaction Account Type found';
3753 RAISE le_fatal_error;
3754 END IF;
3755
3756 --get the table creation template
3757 l_table_creation_text := C_TMPL_TAB_GLOBAL_TEMP_TABLE;
3758 --replace the oracle user name
3759 l_table_creation_text := xla_cmp_string_pkg.replace_token
3760 (
3761 l_table_creation_text
3762 ,'$ORACLE_USER_NAME$'
3763 ,g_application_info.oracle_username
3764 );
3765 --replace the global table name
3766 l_table_creation_text := xla_cmp_string_pkg.replace_token
3767 (
3768 l_table_creation_text
3769 ,'$GLOBAL_TABLE_NAME$'
3770 ,l_global_table_name
3771 );
3772
3773 --build the dynamic field declarations
3774 l_source_table_field_declars := NULL;
3775 --For each distinct source
3776 FOR source_rec IN
3777 (
3778 SELECT DISTINCT xsb.source_code
3779 ,xsb.source_type_code
3780 ,xsb.enabled_flag
3781 ,xsb.datatype_code
3782 FROM xla_tab_acct_types_b xtat
3783 ,xla_tab_acct_type_srcs xtsrc
3784 ,xla_sources_b xsb
3785 WHERE xtat.application_id = g_application_info.application_id
3786 AND NVL( xtat.object_name_affix
3787 ,LPAD('A',32, 'A')
3788 )
3789 = NVL( p_object_name_affix
3790 ,LPAD('A',32, 'A')
3791 )
3792 AND xtat.enabled_flag = 'Y'
3793 AND xtsrc.account_type_code = xtat.account_type_code
3794 AND xsb.application_id = xtsrc.source_application_id
3795 AND xsb.source_code = xtsrc.source_code
3796 AND xsb.source_type_code = xtsrc.source_type_code
3797 ORDER BY xsb.source_code
3798 )
3799 LOOP
3800 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3801 trace
3802 ( p_module => l_log_module
3803 ,p_msg => 'Source code: ' || source_rec.source_code
3804 ,p_level => C_LEVEL_STATEMENT);
3805 END IF;
3806
3807 --If not a seeded source log an error and go to the next source
3808 IF source_rec.source_type_code <> 'S'
3809 THEN
3810 l_return_value := FALSE;
3811 IF (C_LEVEL_ERROR >= g_log_level) THEN
3812 trace
3813 ( p_module => l_log_module
3814 ,p_msg => 'Source ' || source_rec.source_code ||
3815 ' is not a seeded source.' ||
3816 'It will not be considered.'
3817 ,p_level => C_LEVEL_ERROR);
3818 END IF;
3819 --If source is not enabled log an error and go to the next source
3820 ELSIF source_rec.enabled_flag <> 'Y'
3821 THEN
3822 l_return_value := FALSE;
3823 IF (C_LEVEL_ERROR >= g_log_level) THEN
3824 trace
3825 (p_module => l_log_module
3826 ,p_msg => 'Source ' || source_rec.source_code ||
3827 ' is not enabled.' ||
3828 'It will not be considered.'
3829 ,p_level => C_LEVEL_ERROR);
3830 END IF;
3831 ELSE
3832 l_return_value := TRUE;
3833
3834 --get the template for the source record field declaration
3835 l_source_table_field_declar := C_TMPL_SOURCE_TABLE_FIELD_DECL;
3836
3837 --replace the source code
3838 l_source_table_field_declar := xla_cmp_string_pkg.replace_token
3839 (
3840 l_source_table_field_declar
3841 ,'$SOURCE_CODE$'
3842 ,RPAD( source_rec.source_code
3843 ,30
3844 ,' '
3845 )
3846 );
3847
3848 --replace the datatype
3849 CASE
3850 WHEN source_rec.datatype_code = 'I'
3851 THEN l_datatype_specific_declar := 'INTEGER';
3852 WHEN source_rec.datatype_code = 'N'
3853 THEN l_datatype_specific_declar := 'NUMBER';
3854 WHEN source_rec.datatype_code = 'C'
3855 THEN l_datatype_specific_declar := 'VARCHAR2('|| C_CHAR_SOURCE_SIZE ||')';
3856 WHEN source_rec.datatype_code = 'D'
3857 THEN l_datatype_specific_declar := 'DATE';
3858 WHEN source_rec.datatype_code = 'F'
3859 THEN l_datatype_specific_declar := 'INTEGER';
3860 ELSE
3861 l_return_value := FALSE;
3862 IF (C_LEVEL_ERROR >= g_log_level) THEN
3863 trace
3864 (p_module => l_log_module
3865 ,p_msg => 'Source ' || source_rec.source_code ||
3866 ' has an unknown datatype: ' ||
3867 source_rec.datatype_code ||'. ' ||
3868 'It will not be considered.'
3869 ,p_level => C_LEVEL_ERROR);
3870 END IF;
3871
3872 END CASE;
3873
3874 l_source_table_field_declar := xla_cmp_string_pkg.replace_token
3875 (
3876 l_source_table_field_declar
3877 ,'$SOURCE_SPECIFIC_DATATYPE$'
3878 ,RPAD( l_datatype_specific_declar
3879 ,25
3880 ,' '
3881 )
3882 );
3883
3884
3885 IF l_source_table_field_declar IS NOT NULL
3886 THEN
3887 l_source_table_field_declar := l_source_table_field_declar ||
3888 g_chr_newline;
3889 END IF;
3890
3891 l_source_table_field_declars := l_source_table_field_declars ||
3892 l_source_table_field_declar;
3893
3894 END IF;
3895 END LOOP;
3896
3897 --replace the source field declarations token
3898 l_table_creation_text := xla_cmp_string_pkg.replace_token
3899 (
3900 l_table_creation_text
3901 ,'$SOURCE_TABLE_FIELD_DECLARATIONS$'
3902 ,NVL(l_source_table_field_declars, ' ')
3903 );
3904
3905 --Assign the out parameters
3906 x_global_table_name := l_global_table_name;
3907 x_table_creation_text := l_table_creation_text;
3908
3909 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3910 trace
3911 (p_module => l_log_module
3912 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.build_global_temp_table'
3913 ,p_level => C_LEVEL_PROCEDURE);
3914 END IF;
3915
3916 RETURN l_return_value;
3917 EXCEPTION
3918 WHEN le_fatal_error
3919 THEN
3920 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3921 trace
3922 ( p_module => l_log_module
3923 ,p_msg => 'EXCEPTION:'
3924 ,p_level => C_LEVEL_EXCEPTION
3925 );
3926 trace
3927 ( p_module => l_log_module
3928 ,p_msg => l_fatal_error_message
3929 ,p_level => C_LEVEL_EXCEPTION
3930 );
3931 END IF;
3932 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3933 trace
3934 (p_module => l_log_module
3935 ,p_msg => 'END ' || l_log_module
3936 ,p_level => C_LEVEL_PROCEDURE);
3937 END IF;
3938 RETURN FALSE;
3939 WHEN xla_exceptions_pkg.application_exception
3940 THEN
3941 RAISE;
3942 WHEN OTHERS
3943 THEN
3944 xla_exceptions_pkg.raise_message
3945 (p_location => 'xla_cmp_tab_pkg.build_global_temp_table');
3946
3947 END build_global_temp_table;
3948
3949
3950
3951 /*======================================================================+
3952 | |
3953 | Private Function |
3954 | |
3955 | It builds the TAB API package name |
3956 | <PROD_ABBR>_XLA_TAB_PKG |
3957 | |
3958 | |
3959 | |
3960 +======================================================================*/
3961 FUNCTION get_tab_api_package_name
3962 (
3963 p_tab_api_package_name OUT NOCOPY VARCHAR2
3964 )
3965 RETURN BOOLEAN
3966 IS
3967 l_return_value BOOLEAN;
3968 C_TAB_API_PKG_NAME_SUFFIX CONSTANT VARCHAR2(26) := '_XLA_TAB_PKG';
3969 l_log_module VARCHAR2 (2000);
3970 BEGIN
3971 IF g_log_enabled THEN
3972 l_log_module := C_DEFAULT_MODULE||'.get_tab_api_package_name';
3973 END IF;
3974
3975 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3976 trace
3977 (p_module => l_log_module
3978 ,p_msg => 'BEGIN ' || C_DEFAULT_MODULE||'.get_tab_api_package_name'
3979 ,p_level => C_LEVEL_PROCEDURE);
3980 END IF;
3981
3982 p_tab_api_package_name := g_application_info.product_abbreviation
3983 || C_TAB_API_PKG_NAME_SUFFIX;
3984
3985 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3986 trace
3987 (p_module => l_log_module
3988 ,p_msg => 'l_return_value: ' || p_tab_api_package_name
3989 ,p_level => C_LEVEL_STATEMENT);
3990 END IF;
3991
3992 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3993 trace
3994 (p_module => l_log_module
3995 ,p_msg => 'END ' || C_DEFAULT_MODULE||'.get_tab_api_package_name'
3996 ,p_level => C_LEVEL_PROCEDURE);
3997 END IF;
3998
3999 RETURN TRUE;
4000
4001 EXCEPTION
4002 WHEN xla_exceptions_pkg.application_exception
4003 THEN
4004 RAISE;
4005 WHEN OTHERS
4006 THEN
4007 xla_exceptions_pkg.raise_message
4008 (p_location => 'xla_cmp_tab_pkg.get_tab_api_package_name');
4009
4010 END get_tab_api_package_name;
4011
4012
4013
4014 FUNCTION get_tab_api_package_name
4015 (
4016 p_application_id IN VARCHAR2
4017 ,x_tab_api_package_name OUT NOCOPY VARCHAR2
4018 )
4019 RETURN BOOLEAN
4020 IS
4021 l_return_value BOOLEAN;
4022 l_tab_api_package_name VARCHAR2(30);
4023 l_log_module VARCHAR2(2000);
4024
4025 BEGIN
4026 IF g_log_enabled THEN
4027 l_log_module := C_DEFAULT_MODULE||'.get_tab_api_package_name';
4028 END IF;
4029
4030 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4031 trace
4032 (p_module => l_log_module
4033 ,p_msg => 'BEGIN ' || l_log_module
4034 ,p_level => C_LEVEL_PROCEDURE);
4035 END IF;
4036
4037 l_return_value := TRUE;
4038
4039 --If the function is called from an external procedure
4040 IF g_application_info.application_id IS NULL
4041 OR g_application_info.application_id <> p_application_id
4042 THEN
4043 --Initialize global variables
4044 IF NOT init_global_variables
4045 (
4046 p_application_id => p_application_id
4047 )
4048 THEN
4049 --If global vars cannot be set we cannot continue
4050 IF (C_LEVEL_ERROR >= g_log_level) THEN
4051 trace
4052 (p_module => l_log_module
4053 ,p_msg => 'init_global_variables failed'
4054 ,p_level => C_LEVEL_ERROR);
4055 END IF;
4056 l_return_value := FALSE;
4057 RAISE le_fatal_error;
4058 END IF;
4059 END IF;
4060
4061 IF NOT get_tab_api_package_name
4062 (
4063 p_tab_api_package_name => l_tab_api_package_name
4064 )
4065 THEN
4066 --If global vars cannot be set we cannot continue
4067 IF (C_LEVEL_ERROR >= g_log_level) THEN
4068 trace
4069 ( p_module => l_log_module
4070 ,p_msg => 'get_tab_api_package_name'
4071 ,p_level => C_LEVEL_ERROR
4072 );
4073 END IF;
4074 l_return_value := FALSE;
4075 RAISE le_fatal_error;
4076 END IF;
4077
4078 --Assign the out parameters
4079 x_tab_api_package_name := l_tab_api_package_name;
4080
4081 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4082 trace
4083 (p_module => l_log_module
4084 ,p_msg => 'END ' || l_log_module
4085 ,p_level => C_LEVEL_PROCEDURE);
4086 END IF;
4087
4088 RETURN l_return_value;
4089 EXCEPTION
4090 WHEN xla_exceptions_pkg.application_exception
4091 THEN
4092 RAISE;
4093 WHEN OTHERS
4094 THEN
4095 xla_exceptions_pkg.raise_message
4096 (p_location => 'xla_cmp_tab_pkg.get_tab_api_package_name');
4097
4098 END get_tab_api_package_name;
4099
4100 /*======================================================================+
4101 | |
4102 | Private Function |
4103 | |
4104 | read_distinct_affixes |
4105 | |
4106 | |
4107 | Returns false if no affixes are found |
4108 | |
4109 +======================================================================*/
4110 FUNCTION read_distinct_affixes
4111 ( p_application_id IN NUMBER
4112 )
4113 RETURN BOOLEAN
4114 IS
4115 l_return_value BOOLEAN;
4116 l_log_module VARCHAR2 (2000);
4117 BEGIN
4118 IF g_log_enabled THEN
4119 l_log_module := C_DEFAULT_MODULE||'.read_distinct_affixes';
4120 END IF;
4121
4122 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4123 trace
4124 (p_module => l_log_module
4125 ,p_msg => 'BEGIN ' || l_log_module
4126 ,p_level => C_LEVEL_PROCEDURE);
4127 END IF;
4128
4129 --If the function is called from an external procedure
4130 IF g_application_info.application_id IS NULL
4131 OR g_application_info.application_id <> p_application_id
4132 THEN
4133 --Initialize global variables
4134 IF NOT init_global_variables
4135 (
4136 p_application_id => p_application_id
4137 )
4138 THEN
4139 --If global vars cannot be set we cannot continue
4140 IF (C_LEVEL_ERROR >= g_log_level) THEN
4141 trace
4142 (p_module => l_log_module
4143 ,p_msg => 'init_global_variables failed'
4144 ,p_level => C_LEVEL_ERROR);
4145 END IF;
4146 l_return_value := FALSE;
4147 RAISE le_fatal_error;
4148 END IF;
4149 END IF;
4150
4151 l_return_value := TRUE;
4152
4153 --retrieve all the distinct object name affixes for enabled TATs
4154 SELECT DISTINCT xtat.object_name_affix
4155 BULK COLLECT
4156 INTO g_all_object_name_affixes
4157 FROM xla_tab_acct_types_b xtat
4158 WHERE xtat.application_id = g_application_info.application_id
4159 AND xtat.enabled_flag = 'Y'
4160 ORDER BY NVL(xtat.object_name_affix, ' ');
4161
4162 --If there are no distinct affixes we must return a failure
4163 IF SQL%ROWCOUNT = 0
4164 THEN
4165 IF (C_LEVEL_ERROR >= g_log_level) THEN
4166 trace
4167 ( p_module => l_log_module
4168 ,p_msg => 'ERROR: No enabled Transaction Account Type found'
4169 ,p_level => C_LEVEL_ERROR
4170 );
4171 END IF;
4172 RAISE le_fatal_error;
4173 END IF;
4174
4175 --Dump the affixes that have been retrieved
4176 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4177 trace
4178 (p_module => l_log_module
4179 ,p_msg => 'Object name affixes retrieved: '
4180 || g_all_object_name_affixes.COUNT
4181 ,p_level => C_LEVEL_STATEMENT);
4182 FOR i IN 1..g_all_object_name_affixes.COUNT
4183 LOOP
4184 trace
4185 (p_module => l_log_module
4186 ,p_msg => i || ': ' || NVL(g_all_object_name_affixes(i), 'NULL')
4187 ,p_level => C_LEVEL_STATEMENT);
4188 END LOOP;
4189 END IF;
4190
4191 --Retrieve the compiled distinct object name affixes for enabled TATs
4192 SELECT DISTINCT xtat.object_name_affix
4193 BULK COLLECT
4194 INTO g_compiled_object_name_affixes
4195 FROM xla_tab_acct_types_b xtat
4196 WHERE xtat.application_id = g_application_info.application_id
4197 AND xtat.compile_status_code
4198 = xla_cmp_common_pkg.G_COMPILE_STATUS_CODE_COMPILED
4199 ORDER BY NVL(xtat.object_name_affix, ' ');
4200
4201 --Dump the affixes that have been retrieved
4202 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4203 trace
4204 (p_module => l_log_module
4205 ,p_msg => 'Compiled object name affixes retrieved: '
4206 || g_all_object_name_affixes.COUNT
4207 ,p_level => C_LEVEL_STATEMENT);
4208 FOR i IN 1..g_compiled_object_name_affixes.COUNT
4209 LOOP
4210 trace
4211 (p_module => l_log_module
4212 ,p_msg => i || ': ' || NVL(g_compiled_object_name_affixes(i), 'NULL')
4213 ,p_level => C_LEVEL_STATEMENT);
4214 END LOOP;
4215 END IF;
4216
4217 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4218 trace
4219 (p_module => l_log_module
4220 ,p_msg => 'END ' || l_log_module
4221 ,p_level => C_LEVEL_PROCEDURE);
4222 END IF;
4223
4224 RETURN l_return_value;
4225
4226 EXCEPTION
4227 WHEN le_fatal_error
4228 THEN
4229 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4230 trace
4231 (p_module => l_log_module
4232 ,p_msg => 'END ' || l_log_module
4233 ,p_level => C_LEVEL_PROCEDURE);
4234 END IF;
4235 RETURN FALSE;
4236 WHEN xla_exceptions_pkg.application_exception
4237 THEN
4238 RAISE;
4239 WHEN OTHERS
4240 THEN
4241 xla_exceptions_pkg.raise_message
4242 (p_location => 'xla_cmp_tab_pkg.read_distinct_affixes');
4243
4244 END read_distinct_affixes;
4245
4246
4247 FUNCTION remove_deleted_tats
4248 (
4249 p_application_id IN NUMBER
4250 )
4251 RETURN BOOLEAN
4252 IS
4253
4254 l_return_value BOOLEAN;
4255 l_log_module VARCHAR2 (2000);
4256 BEGIN
4257 IF g_log_enabled THEN
4258 l_log_module := C_DEFAULT_MODULE||'.remove_deleted_tats';
4259 END IF;
4260
4261 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4262 trace
4263 (p_module => l_log_module
4264 ,p_msg => 'BEGIN ' || l_log_module
4265 ,p_level => C_LEVEL_PROCEDURE);
4266 END IF;
4267
4268 --Remove Transaction Account Definitions deleted in the UI
4269 --for this application
4270 DELETE
4271 FROM xla_tab_acct_types_b xtat
4272 WHERE xtat.application_id = p_application_id
4273 AND xtat.compile_status_code =
4274 xla_cmp_common_pkg.G_COMPILE_STATUS_CODE_DELETE;
4275
4276
4277 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4278 trace
4279 (p_module => l_log_module
4280 ,p_msg => SQL%ROWCOUNT
4281 || ' row(s) deleted from xla_tab_acct_types_b'
4282 ,p_level => C_LEVEL_STATEMENT);
4283 END IF;
4284
4285 l_return_value := TRUE;
4286
4287 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4288 trace
4289 (p_module => l_log_module
4290 ,p_msg => 'END ' || l_log_module
4291 ,p_level => C_LEVEL_PROCEDURE);
4292 END IF;
4293
4294 RETURN l_return_value;
4295
4296 EXCEPTION
4297 WHEN xla_exceptions_pkg.application_exception
4298 THEN
4299 RAISE;
4300 WHEN OTHERS
4301 THEN
4302 xla_exceptions_pkg.raise_message
4303 (p_location => 'xla_cmp_tab_pkg.remove_deleted_tats');
4304
4305 END remove_deleted_tats;
4306
4307 FUNCTION get_tab_api_info_for_tat
4308 (
4309 p_application_id IN VARCHAR2
4310 ,p_account_type_code IN VARCHAR2
4311 ,x_object_name_affix OUT NOCOPY VARCHAR2
4312 ,x_tab_api_package_name OUT NOCOPY VARCHAR2
4313 ,x_global_table_name OUT NOCOPY VARCHAR2
4314 ,x_plsql_table_name OUT NOCOPY VARCHAR2
4315 ,x_write_proc_name OUT NOCOPY VARCHAR2
4316 ,x_read_proc_name OUT NOCOPY VARCHAR2
4317 ,x_table_of_sources OUT NOCOPY FND_TABLE_OF_VARCHAR2_30
4318 ,x_table_of_source_datatypes OUT NOCOPY FND_TABLE_OF_VARCHAR2_1
4319 )
4320 RETURN BOOLEAN
4321 IS
4322 l_return_value BOOLEAN;
4323
4324 l_object_name_affix VARCHAR2(50);
4325 l_tab_api_package_name VARCHAR2(50);
4326 l_global_table_name VARCHAR2(50);
4327 l_plsql_table_name VARCHAR2(50);
4328 l_write_proc_name VARCHAR2(50);
4329 l_read_proc_name VARCHAR2(50);
4330 l_table_of_sources gt_table_of_varchar2_30;
4331 l_table_of_source_datatypes gt_table_of_varchar2_1;
4332 l_fatal_error_message VARCHAR2(255);
4333 l_log_module VARCHAR2 (2000);
4334 BEGIN
4335 IF g_log_enabled THEN
4336 l_log_module := C_DEFAULT_MODULE||'.get_tab_api_info_for_tat';
4337 END IF;
4338
4339 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4340 trace
4341 (p_module => l_log_module
4342 ,p_msg => 'BEGIN ' || l_log_module
4343 ,p_level => C_LEVEL_PROCEDURE);
4344 END IF;
4345
4346 --If the function is called from an external procedure
4347 IF g_application_info.application_id IS NULL
4348 OR g_application_info.application_id <> p_application_id
4349 THEN
4350 --Initialize global variables
4351 IF NOT init_global_variables
4352 (
4353 p_application_id => p_application_id
4354 )
4355 THEN
4356 --If global vars cannot be set we cannot continue
4357 IF (C_LEVEL_ERROR >= g_log_level) THEN
4358 trace
4359 (p_module => l_log_module
4360 ,p_msg => 'init_global_variables failed'
4361 ,p_level => C_LEVEL_ERROR);
4362 END IF;
4363 l_return_value := FALSE;
4364 RAISE le_fatal_error;
4365 END IF;
4366 END IF;
4367
4368 --Get the object name affix for the specified TAT
4369 SELECT xtat.object_name_affix
4370 INTO l_object_name_affix
4371 FROM xla_tab_acct_types_b xtat
4372 WHERE xtat.application_id = g_application_info.application_id
4373 AND xtat.account_type_code = p_account_type_code
4374 AND xtat.enabled_flag = 'Y'
4375 ORDER BY NVL(xtat.object_name_affix, ' ');
4376
4377 --Get the name of the interface tables
4378 IF NOT get_interface_object_names
4379 (
4380 p_application_id => p_application_id
4381 ,p_object_name_affix => l_object_name_affix
4382 ,x_global_table_name => l_global_table_name
4383 ,x_plsql_table_name => l_plsql_table_name
4384 )
4385 THEN
4386 l_fatal_error_message := 'get_interface_object_names failed';
4387 RAISE le_fatal_error;
4388 END IF;
4389
4390 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4391 trace
4392 (p_module => l_log_module
4393 ,p_msg => 'END ' || l_log_module
4394 ,p_level => C_LEVEL_PROCEDURE);
4395 END IF;
4396
4397 --Get the TAB API package name
4398 IF NOT get_tab_api_package_name
4399 (
4400 p_tab_api_package_name => l_tab_api_package_name
4401 )
4402 THEN
4403 l_fatal_error_message := 'get_tab_api_package_name failed';
4404 RAISE le_fatal_error;
4405 END IF;
4406
4407 --Build the proc names
4408 l_write_proc_name := xla_cmp_string_pkg.replace_token
4409 (
4410 C_TMPL_TAB_WRITE_PROC_NAME
4411 ,'$OBJECT_NAME_AFFIX$'
4412 ,CASE
4413 WHEN l_object_name_affix IS NULL THEN ' '
4414 ELSE '_' || l_object_name_affix
4415 END
4416 );
4417
4418 l_read_proc_name := xla_cmp_string_pkg.replace_token
4419 (
4420 C_TMPL_TAB_READ_PROC_NAME
4421 ,'$OBJECT_NAME_AFFIX$'
4422 ,CASE
4423 WHEN l_object_name_affix IS NULL THEN ' '
4424 ELSE '_' || l_object_name_affix
4425 END
4426 );
4427
4428
4429 --Get the ordered list of sources of the write and read procedures
4430 IF NOT get_interface_sources
4431 (
4432 p_application_id => p_application_id
4433 ,p_object_name_affix => l_object_name_affix
4434 ,x_table_of_sources => l_table_of_sources
4435 ,x_table_of_source_datatypes => l_table_of_source_datatypes
4436 )
4437 THEN
4438 l_fatal_error_message := 'get_interface_sources failed';
4439 RAISE le_fatal_error;
4440 END IF;
4441
4442 --Assign OUT parameters
4443 x_table_of_sources := FND_TABLE_OF_VARCHAR2_30();
4444 x_table_of_source_datatypes := FND_TABLE_OF_VARCHAR2_1();
4445 IF l_table_of_sources IS NOT NULL
4446 AND l_table_of_sources.COUNT > 0
4447 THEN
4448 x_table_of_sources.EXTEND(l_table_of_sources.COUNT);
4449 x_table_of_source_datatypes.EXTEND(l_table_of_sources.COUNT);
4450 FOR i IN 1..l_table_of_sources.COUNT
4451 LOOP
4452 x_table_of_sources(i) := l_table_of_sources(i);
4453 x_table_of_source_datatypes(i) := l_table_of_source_datatypes(i);
4454 END LOOP;
4455 END IF;
4456
4457 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4458 trace
4459 (p_module => l_log_module
4460 ,p_msg => 'END ' || l_log_module
4461 ,p_level => C_LEVEL_PROCEDURE);
4462 END IF;
4463 x_object_name_affix := l_object_name_affix;
4464 x_tab_api_package_name := l_tab_api_package_name;
4465 x_global_table_name := l_global_table_name;
4466 x_plsql_table_name := l_plsql_table_name;
4467 x_write_proc_name := l_write_proc_name;
4468 x_read_proc_name := l_read_proc_name;
4469
4470 l_return_value := TRUE;
4471 RETURN l_return_value;
4472
4473 EXCEPTION
4474 WHEN le_fatal_error
4475 THEN
4476 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4477 trace
4478 (p_module => l_log_module
4479 ,p_msg => l_fatal_error_message
4480 ,p_level => C_LEVEL_EXCEPTION);
4481 END IF;
4482
4483 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4484 trace
4485 (p_module => l_log_module
4486 ,p_msg => 'END ' || l_log_module
4487 ,p_level => C_LEVEL_PROCEDURE);
4488 END IF;
4489 RETURN FALSE;
4490 WHEN xla_exceptions_pkg.application_exception
4491 THEN
4492 RAISE;
4493 WHEN OTHERS
4494 THEN
4495 xla_exceptions_pkg.raise_message
4496 (p_location => 'xla_cmp_tab_pkg.get_tab_api_info_for_tat');
4497 END;
4498
4499 FUNCTION get_ccid_additional_info
4500 (
4501 p_chart_of_accounts_id IN NUMBER
4502 ,p_ccid IN NUMBER
4503 ,x_concatenated_descriptions OUT NOCOPY VARCHAR2
4504 )
4505 RETURN BOOLEAN
4506 IS
4507 l_return_value BOOLEAN;
4508
4509 l_fatal_error_message VARCHAR2(255);
4510 l_log_module VARCHAR2(2000);
4511 BEGIN
4512 IF g_log_enabled THEN
4513 l_log_module := C_DEFAULT_MODULE||'.get_ccid_additional_info';
4514 END IF;
4515
4516 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4517 trace
4518 (p_module => l_log_module
4519 ,p_msg => 'BEGIN ' || l_log_module
4520 ,p_level => C_LEVEL_PROCEDURE);
4521 END IF;
4522
4523 IF NOT FND_FLEX_KEYVAL.validate_ccid
4524 (
4525 appl_short_name => 'SQLGL'
4526 ,key_flex_code => 'GL#'
4527 ,structure_number => p_chart_of_accounts_id
4528 ,combination_id => p_ccid
4529 ,displayable => 'ALL'
4530 ,data_set => NULL
4531 ,vrule => NULL
4532 ,security => 'IGNORE'
4533 ,get_columns => NULL
4534 ,resp_appl_id => NULL
4535 ,resp_id => NULL
4536 ,user_id => NULL
4537 ,select_comb_from_view => NULL
4538 )
4539 THEN
4540 l_fatal_error_message := 'FND_FLEX_KEYVAL.validate_ccid failed';
4541 RAISE le_fatal_error;
4542 END IF;
4543
4544 x_concatenated_descriptions := FND_FLEX_KEYVAL.concatenated_descriptions;
4545
4546 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4547 trace
4548 (p_module => l_log_module
4549 ,p_msg => 'END ' || l_log_module
4550 ,p_level => C_LEVEL_PROCEDURE);
4551 END IF;
4552
4553 l_return_value := TRUE;
4554 RETURN l_return_value;
4555
4556 EXCEPTION
4557 WHEN le_fatal_error
4558 THEN
4559 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4560 trace
4561 (p_module => l_log_module
4562 ,p_msg => l_fatal_error_message
4563 ,p_level => C_LEVEL_EXCEPTION);
4564 END IF;
4565
4566 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4567 trace
4568 (p_module => l_log_module
4569 ,p_msg => 'END ' || l_log_module
4570 ,p_level => C_LEVEL_PROCEDURE);
4571 END IF;
4572 RETURN FALSE;
4573 WHEN xla_exceptions_pkg.application_exception
4574 THEN
4575 RAISE;
4576 WHEN OTHERS
4577 THEN
4578 xla_exceptions_pkg.raise_message
4579 (p_location => 'xla_cmp_tab_pkg.get_ccid_additional_info');
4580 END;
4581
4582
4583
4584
4585 --Trace initialization
4586 BEGIN
4587 g_log_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
4588 g_log_enabled := fnd_log.test
4589 (log_level => g_log_level
4590 ,module => C_DEFAULT_MODULE);
4591
4592 IF NOT g_log_enabled THEN
4593 g_log_level := C_LEVEL_LOG_DISABLED;
4594 END IF;
4595
4596 END xla_cmp_tab_pkg;