29: | Added sla_ledger_id in ledger cache |
30: | 07-MAI-2003 K.Boussema Changed the call to cache API, bug 2945359 |
31: | 13-MAI-2003 K.Boussema Renamed temporary tables xla_je_lines_gt by |
32: | xla_ae_lines_gt, xla_je_headers_gt by |
33: | xla_ae_headers_gt |
34: | Renamed in xla_distribution_links the column |
35: | base_amount by ledger_amount |
36: | 14-MAI-2003 K.Boussema Removed the SELECT of application_name |
37: | 20-MAI-2003 K.Boussema Added a Token to XLA_AP_CANNOT_INSERT_JE |
115: | Multiple changes. For details please see DLD |
116: | 14-Mar-2005 K.Boussema Changed for ADR-enhancements. |
117: | 20-Apr-2005 W. Shen replace column document_rounding_amount by |
118: | doc_rounding_acctd_amt |
119: | 27-Apr-2005 W. Shen Performance change. Insert into xla_ae_headers |
120: | with zero_amount_flag always = 'N'. will |
121: | update it to 'Y' later in validation package |
122: | 26-May-2005 W. Shen change for Unrounded_entered_amount |
123: | 26-May-2005 A. Wan 4262811 MPA project |
1774: -- Populate the parent_ae_line_num by the real ae_line_num
1775: ----------------------------------------------------------
1776: /* PROBLEM: incorrectly sets parent_ae_line_num to NULL
1777: forall i in 1..l_array_rowid.count
1778: update xla_ae_headers_gt h
1779: set parent_ae_line_num =
1780: (select l_array_ae_line_num(i)
1781: from xla_ae_lines_gt l
1782: where h.parent_header_id = l.event_id -- awan l.ae_header_id no rows
1787: and l.rowid = l_array_rowid(i))
1788: where parent_ae_line_num IS NOT NULL;
1789: */
1790: -- IF l_array_rowid.count > 0 THEN commented IF for 7230462
1791: UPDATE xla_ae_headers_gt h
1792: SET parent_ae_line_num =
1793: (SELECT ae_line_num
1794: FROM xla_ae_lines_gt l
1795: WHERE h.parent_header_id = l.event_id -- awan l.ae_header_id no rows
10761: SELECT parent_header_id
10762: ,parent_ae_line_num
10763: ,MIN(ae_header_id)
10764: ,MAX(ae_header_id)
10765: FROM xla_ae_headers_gt
10766: WHERE parent_header_id IS NOT NULL
10767: AND parent_ae_line_num IS NOT NULL
10768: AND balance_type_code = 'A' -- added for bug:7377888
10769: AND NVL(accrual_reversal_flag,'N') = 'N'
10858: BULK COLLECT INTO
10859: l_array_mpa_header_idx
10860: ,l_array_mpa_line_idx
10861: FROM xla_ae_lines xel2
10862: ,xla_ae_headers xeh
10863: WHERE xel2.ae_header_id = xeh.ae_header_id
10864: AND xel2.application_id = p_application_id
10865: AND xel2.ae_header_id <> l_array_max_hdr_idx(i)
10866: AND xeh.application_id = p_application_id
10932: ,DECODE(MIN(unrounded_entered_dr), NULL,NULL, l_array_unround_entered_amt(i) - SUM(unrounded_entered_dr))
10933: ,DECODE(MIN(unrounded_accounted_cr), NULL,NULL, l_array_unround_accted_amt(i) - SUM(unrounded_accounted_cr))
10934: ,DECODE(MIN(unrounded_accounted_dr), NULL,NULL, l_array_unround_accted_amt(i) - SUM(unrounded_accounted_dr))
10935: FROM xla_ae_lines xel2
10936: ,xla_ae_headers xeh
10937: WHERE xel2.ae_header_id = xeh.ae_header_id
10938: AND xel2.ae_line_num = xel.ae_line_num
10939: AND xel2.application_id = p_application_id -- 4585874
10940: AND xel2.ae_header_id <> l_array_max_hdr_idx(i)
11014: ,xdl1.ae_header_id
11015: ,xdl1.ref_event_id
11016: ,xeh1.ledger_id
11017: FROM xla_distribution_links xdl1
11018: ,xla_ae_headers xeh1
11019: ,xla_ae_headers_gt xehg
11020: WHERE xdl1.application_id = p_application_id
11021: AND xeh1.application_id = p_application_id
11022: AND xdl1.ae_header_id = xehg.ae_header_id
11015: ,xdl1.ref_event_id
11016: ,xeh1.ledger_id
11017: FROM xla_distribution_links xdl1
11018: ,xla_ae_headers xeh1
11019: ,xla_ae_headers_gt xehg
11020: WHERE xdl1.application_id = p_application_id
11021: AND xeh1.application_id = p_application_id
11022: AND xdl1.ae_header_id = xehg.ae_header_id
11023: AND xdl1.ae_header_id = xeh1.ae_header_id
11022: AND xdl1.ae_header_id = xehg.ae_header_id
11023: AND xdl1.ae_header_id = xeh1.ae_header_id
11024: AND xdl1.temp_line_num = xdl1.ref_temp_line_num*-1 -- is a reversal
11025: AND EXISTS (SELECT 1
11026: FROM xla_ae_headers
11027: WHERE application_id = p_application_id
11028: AND parent_ae_header_id = xdl1.ref_ae_header_id
11029: AND parent_ae_line_num IS NOT NULL) -- MPA only, not for Accrual Reversal
11030: GROUP BY xdl1.ref_ae_header_id, xdl1.ref_event_id, xdl1.application_id, xeh1.ledger_id, xdl1.ae_header_id
11033: AND xdl2.ae_header_id = xdl1.ae_header_id
11034: AND xdl2.temp_line_num = xdl2.ref_temp_line_num*-1
11035: AND xdl2.ref_ae_header_id <> xdl1.ref_ae_header_id
11036: AND xdl2.ref_event_id = xdl1.ref_event_id ) =
11037: (SELECT COUNT(*) FROM xla_distribution_links xdl3,xla_ae_headers xeh -- count of original lines
11038: WHERE xdl3.application_id = p_application_id
11039: AND xeh.application_id = p_application_id
11040: AND xdl3.ae_header_id = xeh.ae_header_id
11041: AND xdl3.event_id = xdl1.ref_event_id
11042: AND xdl3.ref_temp_line_num IS NULL
11043: AND xeh.parent_ae_header_id = xdl1.ref_ae_header_id
11044: AND xeh.parent_ae_line_num IS NOT NULL)
11045: ORDER BY xeh1.ledger_id, xdl1.ref_event_id;
11046: --(SELECT COUNT(*) FROM xla_ae_lines xel,xla_ae_headers xeh -- count of original lines
11047: -- WHERE xeh.application_id = p_application_id
11048: -- AND xel.ae_header_id = xeh.ae_header_id
11049: -- AND xeh.parent_ae_header_id = xdl1.ref_ae_header_id
11050: -- AND xeh.parent_ae_line_num IS NOT NULL)
11157:
11158: SELECT MAX(xdl1.ref_ae_header_id) -- last recognition header
11159: INTO l_max_hdr_id
11160: FROM xla_distribution_links xdl1
11161: ,xla_ae_headers xeh1
11162: WHERE xdl1.application_id = p_application_id
11163: AND xdl1.ae_header_id = l_array_ae_header_id(i)
11164: AND xdl1.temp_line_num = xdl1.ref_temp_line_num*-1
11165: AND xdl1.ref_ae_header_id <> l_array_parent_hdr_idx(i)
11201: ,DECODE((l_last_mpa.unrounded_accounted_cr), NULL,NULL, l_array_unround_accted_amt(i) - SUM(xel2.unrounded_accounted_cr))
11202: ,DECODE((l_last_mpa.unrounded_accounted_dr), NULL,NULL, l_array_unround_accted_amt(i) - SUM(xel2.unrounded_accounted_dr))
11203: FROM xla_ae_lines xel2
11204: ,xla_distribution_links xdl1
11205: ,xla_ae_headers xeh1
11206: WHERE xel2.application_id = p_application_id
11207: AND xel2.ae_header_id = xdl1.ae_header_id
11208: AND xel2.ae_line_num = xdl1.ae_line_num
11209: AND xdl1.application_id = p_application_id
11610: SELECT pr.name, ec.name, et.name
11611: FROM xla_product_rules_tl pr
11612: ,xla_event_classes_tl ec
11613: ,xla_event_types_tl et
11614: ,xla_ae_headers_gt h
11615: WHERE pr.amb_context_code(+) = h.amb_context_code
11616: AND pr.application_id(+) = p_application_id
11617: AND pr.product_rule_type_code(+) = h.product_rule_type_code
11618: AND pr.product_rule_code(+) = h.product_rule_code
11645:
11646: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
11647:
11648: trace
11649: (p_msg => 'SQL - Insert into xla_ae_headers'
11650: ,p_level => C_LEVEL_STATEMENT
11651: ,p_module => l_log_module);
11652:
11653: END IF;
11657: -- 4262811
11658: --------------------------------------------------------
11659: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN --4752807
11660: FORALL i IN 1..g_array_ae_header_id.COUNT
11661: UPDATE /*+ index(XLA_AE_HEADERS_GT, XLA_AE_HEADERS_GT_N1) */ --4918497
11662: xla_ae_headers_gt
11663: SET parent_header_id = g_array_ae_header_id(i)
11664: WHERE parent_header_id = g_array_event_id(i) -- instead of ae_header_id
11665: AND ledger_id = g_array_ledger_id(i)
11658: --------------------------------------------------------
11659: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN --4752807
11660: FORALL i IN 1..g_array_ae_header_id.COUNT
11661: UPDATE /*+ index(XLA_AE_HEADERS_GT, XLA_AE_HEADERS_GT_N1) */ --4918497
11662: xla_ae_headers_gt
11663: SET parent_header_id = g_array_ae_header_id(i)
11664: WHERE parent_header_id = g_array_event_id(i) -- instead of ae_header_id
11665: AND ledger_id = g_array_ledger_id(i)
11666: AND balance_type_code = g_array_balance_type(i)
11681: -- end if
11682: --------------------------------------------------------
11683:
11684: IF xla_accounting_pkg.g_array_group_id.COUNT = 0 THEN
11685: INSERT INTO xla_ae_headers
11686: (
11687: ae_header_id
11688: , application_id
11689: , ledger_id
11782: , hed.parent_header_id -- 4262811
11783: , hed.parent_ae_line_num -- 4262811
11784: , hed.accrual_reversal_flag -- 4262811
11785: , NULL -- group_id
11786: FROM xla_ae_headers_gt hed
11787: where hed.balance_type_code <> 'X';
11788: ELSE -- xla_accounting_pkg.g_array_group_id.COUNT > 0
11789: FORALL i IN 1..xla_accounting_pkg.g_array_group_id.COUNT
11790: INSERT INTO xla_ae_headers
11786: FROM xla_ae_headers_gt hed
11787: where hed.balance_type_code <> 'X';
11788: ELSE -- xla_accounting_pkg.g_array_group_id.COUNT > 0
11789: FORALL i IN 1..xla_accounting_pkg.g_array_group_id.COUNT
11790: INSERT INTO xla_ae_headers
11791: (
11792: ae_header_id
11793: , application_id
11794: , ledger_id
11891: xla_accounting_pkg.g_array_group_id(i)
11892: ELSE NULL
11893: END
11894: ,NULL)
11895: FROM xla_ae_headers_gt hed
11896: where hed.balance_type_code <> 'X'
11897: and hed.ledger_id = xla_accounting_pkg.g_array_ledger_id(i);
11898: END IF;
11899:
11900: l_rowcount := SQL%ROWCOUNT;
11901:
11902: IF (C_LEVEL_EVENT >= g_log_level) THEN
11903: trace
11904: (p_msg => '# journal entry headers inserted into xla_ae_headers = '||l_rowcount
11905: ,p_level => C_LEVEL_EVENT
11906: ,p_module => l_log_module);
11907: END IF;
11908:
12535: , anc_id_7
12536: , anc_id_8
12537: , anc_id_9
12538: , anc_id_10
12539: FROM xla_ae_headers_gt
12540: WHERE ae_header_id is not null;
12541:
12542: --
12543: IF (C_LEVEL_EVENT >= g_log_level) THEN
14686: , anc_id_47
14687: , anc_id_48
14688: , anc_id_49
14689: , anc_id_50
14690: FROM xla_ae_headers_gt
14691: WHERE ae_header_id is not null;
14692:
14693: --
14694: IF (C_LEVEL_EVENT >= g_log_level) THEN
18886: , anc_id_97
18887: , anc_id_98
18888: , anc_id_99
18889: , anc_id_100
18890: FROM xla_ae_headers_gt
18891: WHERE ae_header_id is not null;
18892:
18893: --
18894: IF (C_LEVEL_EVENT >= g_log_level) THEN