[Home] [Help]
23: | 03-APR-2003 K.Boussema Included Analytical criteria feature |
24: | 19-APR-2003 K.Boussema Included Error messages |
25: | 06-MAI-2003 K.Boussema Modified to fix bug 2936066(Unbalanced JE) |
26: | 13-MAI-2003 K.Boussema Renamed temporary tables xla_je_lines_gt by |
27: | xla_ae_lines_gt, xla_je_headers_gt by |
28: | xla_ae_headers_gt |
29: | Renamed in xla_distribution_links the column |
30: | base_amount by ledger_amount |
31: | 20-MAI-2003 K.Boussema Added a Token to XLA_AP_CANNOT_INSERT_JE |
61: | and LineReversal_2. |
62: | Merged procedures TransactionReversal and |
63: | TransactionReversal_2. |
64: | 05-DEC-2003 K.Boussema Changed the code to fix bug3289875 |
65: | 12-DEC-2003 K.Boussema Renamed target_coa_id in xla_ae_lines_gt |
66: | by ccid_coa_id |
67: | 18-DEC-2003 K.Boussema Changed to fix bug 3042840,3307761,3268940 |
68: | 3310291 and 3320689 |
69: | 07-JAN-2003 K.Boussema Changed to populate switch_side_flag column |
176: | ae_lines_gt detail for bflow entries|
177: | for MPA and Accrual Reversal lines. |
178: | 10-Feb-2006 A.Wan 5019460 - could not reverse prior entries. |
179: | 13-Feb-2006 V.Kumar 4955764 Populating Accounting_date in |
180: | xla_ae_lines_gt |
181: | 14-Feb-2006 A.Wan 4967526 - copy following for Third Party info |
182: | in BusinessFlowPriorEntries: |
183: | - merge_code_combination_id |
184: | - merge_party_id |
223: | if there are no MPA in this run. |
224: | 26-jan-2007 A.Wan 5845547 - upgrade fail for not upgraded bflow |
225: | and reversal transactions. Add |
226: | upgrade party attributes. |
227: | 14-Dec-2007 V.Swapna 6648062 - Populate xla_ae_lines_gt with |
228: | the values passed in override acctd |
229: | amts accounting attribute and use |
230: | it in business flow procedure |
231: | 31-Dec-2007 V. Swapna 5339999 - Changes to BusinessFlowPriorEntries |
1571: g_rec_lines := g_null_lines;
1572:
1573: ELSIF g_LineNumber = C_BULK_LIMIT THEN
1574: --
1575: -- insert headers into xla_ae_lines_gt table
1576: --
1577: l_result := xla_ae_lines_pkg.InsertLines;
1578: g_LineNumber := 0;
1579: g_rec_lines := g_null_lines;
3001: l_result :=TRUE;
3002:
3003: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3004: trace
3005: (p_msg => '# temporary journal lines to insert into GT xla_ae_lines_gt = '||g_rec_lines.array_line_num.COUNT
3006: ,p_level => C_LEVEL_STATEMENT
3007: ,p_module => l_log_module);
3008: END IF;
3009:
3040: END IF;
3041:
3042: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
3043: trace
3044: (p_msg => 'SQL - Insert into xla_ae_lines_gt'
3045: ,p_level => C_LEVEL_STATEMENT
3046: ,p_module => l_log_module);
3047: END IF;
3048:
3048:
3049: ------------------------------------------------------------------------------------------------------
3050:
3051: FORALL Idx IN g_rec_lines.array_line_num.FIRST .. g_rec_lines.array_line_num.LAST SAVE EXCEPTIONS --7453943
3052: INSERT INTO xla_ae_lines_gt
3053: ( ae_header_id
3054: , temp_line_num
3055: , extract_line_num
3056: , event_id
3722: l_result := ( l_rowcount> 0);
3723:
3724: IF (C_LEVEL_EVENT >= g_log_level) THEN
3725: trace
3726: (p_msg => '# temporary journal lines inserted into GT xla_ae_lines_gt = '||TO_CHAR(l_rowcount)
3727: ,p_level => C_LEVEL_EVENT
3728: ,p_module => l_log_module);
3729: END IF;
3730:
4238: --***************************************************************************************************************
4239: --***************************************************************************************************************
4240:
4241: --
4242: -- selecting all the dummy lines from xla_ae_lines_gt that are due to
4243: -- line level reversal option
4244: --
4245: SELECT event_id
4246: ,ledger_id
4304: ,l_array_gl_date -- 5189664
4305: ,l_array_tax_line_ref -- 7159711
4306: ,l_array_tax_summary_line_ref -- 7159711
4307: ,l_array_tax_rec_nrec_dist_ref -- 7159711
4308: FROM xla_ae_lines_gt
4309: WHERE reversal_code = 'DUMMY_LR'
4310: ORDER by entity_id, event_number;
4311:
4312: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
4320: -- 4669308 Delete the MPA/Accrual Line Reversal (still in GT ables, not in distribution links yet)
4321: --=======================================================================================================
4322: --
4323: ---------------------------------------------------------------------------------------------------------
4324: -- 4669308 Delete the MPA/Accrual Line Reversal in xla_ae_lines_gt (not in distribution links yet)
4325: ---------------------------------------------------------------------------------------------------------
4326: --
4327: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 5412560
4328: -- Modify for performance bug 5086984
4326: --
4327: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 5412560
4328: -- Modify for performance bug 5086984
4329: FOR i IN 1..l_array_entity_id.count LOOP
4330: SELECT /*+ Leading(HGT) cardinality(hgt 1) index(lgt XLA_AE_LINES_GT_U1) */
4331: lgt.ledger_id
4332: ,lgt.event_id
4333: ,lgt.ref_ae_header_id
4334: ,lgt.temp_line_num
4342: ,l_array_mpa_acc_temp_line_num
4343: ,l_array_mpa_acc_ae_header_id
4344: ,l_array_mpa_acc_header_num
4345: ,l_array_mpa_acc_balance_type
4346: FROM xla_ae_lines_gt lgt
4347: ,xla_ae_headers_gt hgt
4348: WHERE l_array_ledger_id(i) = lgt.ledger_id
4349: AND l_array_rev_dist_type(i) = lgt.source_distribution_type
4350: AND nvl(l_array_rev_dist_id_num_1(i),-99) = nvl(lgt.source_distribution_id_num_1,-99)
4369: AND hgt.event_number < l_array_event_number(i);
4370: /* 5412560 replaced
4371: AND NOT EXISTS ( -- the lines already reversed are not reversed again
4372: SELECT 1
4373: FROM xla_ae_lines_gt
4374: WHERE ledger_id = lgt.ledger_id
4375: AND ref_ae_header_id = lgt.ref_ae_header_id
4376: AND temp_line_num = lgt.temp_line_num * -1)
4377: AND NVL(lgt.header_num,0) > 0
4400: end loop;
4401: END IF;
4402:
4403: ---------------------------------------------------------------------------------------------------------
4404: -- 4669308 Delete the MPA/Accrual Line Reversal in xla_ae_lines_gt (not in distribution links yet)
4405: ---------------------------------------------------------------------------------------------------------
4406: FORALL j IN 1..l_array_mpa_acc_ae_header_id.count
4407: DELETE xla_ae_lines_gt
4408: WHERE ledger_id = l_array_mpa_acc_ledger_id(j)
4403: ---------------------------------------------------------------------------------------------------------
4404: -- 4669308 Delete the MPA/Accrual Line Reversal in xla_ae_lines_gt (not in distribution links yet)
4405: ---------------------------------------------------------------------------------------------------------
4406: FORALL j IN 1..l_array_mpa_acc_ae_header_id.count
4407: DELETE xla_ae_lines_gt
4408: WHERE ledger_id = l_array_mpa_acc_ledger_id(j)
4409: AND ref_ae_header_id = l_array_mpa_acc_ref_ae_header(j)
4410: AND temp_line_num = l_array_mpa_acc_temp_line_num(j)
4411: AND ae_header_id = l_array_mpa_acc_ae_header_id(j)
4427: END IF; -- xla_accounting_pkg.g_mpa_accrual_exists = 'Y'
4428: -------------------------------------------------------------------------------------------------------------------------
4429:
4430: --
4431: -- reverse the lines in xla_ae_lines_gt table (not in distribution links yet)
4432: --
4433: INSERT INTO xla_ae_lines_gt
4434: (ae_header_id
4435: ,temp_line_num
4429:
4430: --
4431: -- reverse the lines in xla_ae_lines_gt table (not in distribution links yet)
4432: --
4433: INSERT INTO xla_ae_lines_gt
4434: (ae_header_id
4435: ,temp_line_num
4436: ,event_id
4437: ,ref_ae_header_id
5418: , lgt2.anc_id_98
5419: , lgt2.anc_id_99
5420: , lgt2.anc_id_100
5421: FROM
5422: xla_ae_lines_gt lgt1
5423: ,xla_ae_lines_gt lgt2
5424: ,xla_ae_headers_gt hgt
5425: WHERE lgt1.reversal_code = 'DUMMY_LR'
5426: AND lgt2.ledger_id = lgt1.ledger_id
5419: , lgt2.anc_id_99
5420: , lgt2.anc_id_100
5421: FROM
5422: xla_ae_lines_gt lgt1
5423: ,xla_ae_lines_gt lgt2
5424: ,xla_ae_headers_gt hgt
5425: WHERE lgt1.reversal_code = 'DUMMY_LR'
5426: AND lgt2.ledger_id = lgt1.ledger_id
5427: AND lgt2.source_distribution_type = lgt1.reverse_distribution_type
5440: AND hgt.balance_type_code = lgt2.balance_type_code
5441: AND hgt.entity_id = lgt1.entity_id
5442: -- lines for events with event number > current event number are not reversed.
5443: AND hgt.event_number < lgt1.event_number
5444: AND hgt.header_num = lgt2.header_num-- 4262811c Line Reversal (xla_ae_lines_gt_u1 error)
5445: AND hgt.ae_header_id = lgt2.ae_header_id
5446: )
5447: WHERE rn = 1
5448: );
5449:
5450:
5451: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
5452: trace
5453: (p_msg => 'Line Reversal - Reversal lines created from xla_ae_lines_gt = '||SQL%ROWCOUNT
5454: ,p_level => C_LEVEL_STATEMENT
5455: ,p_module => l_log_module);
5456: END IF;
5457:
5468: g_incomplete_mpa_acc_LR.l_array_ae_header_id
5469: ,g_incomplete_mpa_acc_LR.l_array_ae_line_num
5470: ,g_incomplete_mpa_acc_LR.l_array_parent_ae_header
5471: FROM
5472: xla_ae_lines_gt lgt
5473: ,xla_ae_lines ael
5474: ,xla_ae_headers aeh
5475: ,xla_distribution_links xdl
5476: WHERE xdl.application_id = l_application_id
5522: -- Also, since the redundant lines will affect ROUNDING calculation.
5523: -- Need to create reversal in Draft mode also (so can be viewed).
5524: ---------------------------------------------------------------------------------------------------------
5525: --
5526: INSERT INTO xla_ae_lines_gt
5527: (ae_header_id
5528: ,temp_line_num
5529: ,event_id
5530: ,ref_ae_header_id
5913: ,decode(ael.analytical_balance_flag, 'Y','P',
5914: 'P','Y',
5915: null) analytical_balance_flag -- Bug 7382288
5916: FROM
5917: xla_ae_lines_gt lgt
5918: ,xla_distribution_links xdl
5919: ,xla_ae_lines ael
5920: ,xla_ae_headers aeh
5921: ,fnd_currencies fcu
6041:
6042:
6043: SELECT min(xla_ae_headers.accounting_date)
6044: INTO l_min_ref_event_date
6045: FROM xla_ae_lines_gt gt1, xla_ae_headers
6046: WHERE gt1.reversal_code = 'REVERSAL'
6047: AND gt1.ref_event_id = xla_ae_headers.event_id;
6048:
6049:
6075:
6076:
6077: FOR c_not_reversed_entries IN
6078: (SELECT DISTINCT gt1.event_id, gt1.ledger_id
6079: FROM xla_ae_lines_gt gt1, gl_ledgers gll
6080: WHERE gt1.reversal_code = 'DUMMY_LR'
6081: AND gll.ledger_id = gt1.ledger_id
6082: AND gll.ledger_category_code <> 'PRIMARY'
6083: AND NOT EXISTS (SELECT 1
6080: WHERE gt1.reversal_code = 'DUMMY_LR'
6081: AND gll.ledger_id = gt1.ledger_id
6082: AND gll.ledger_category_code <> 'PRIMARY'
6083: AND NOT EXISTS (SELECT 1
6084: FROM xla_ae_lines_gt gt2
6085: WHERE gt2.reversal_code = 'REVERSAL'
6086: AND gt1.event_id = gt2.event_id
6087: AND gt1.ledger_id = gt2.ledger_id)
6088: AND EXISTS (SELECT 1
6085: WHERE gt2.reversal_code = 'REVERSAL'
6086: AND gt1.event_id = gt2.event_id
6087: AND gt1.ledger_id = gt2.ledger_id)
6088: AND EXISTS (SELECT 1
6089: FROM xla_ae_lines_gt gt3
6090: WHERE gt3.reversal_code = 'REVERSAL'
6091: AND gt1.event_id = gt3.event_id))
6092:
6093: LOOP
6133: --***************************************************************************************************************
6134: --***************************************************************************************************************
6135:
6136: --
6137: -- selecting all the dummy lines from xla_ae_lines_gt that are due to
6138: -- transaction level reversal option
6139: --
6140: SELECT event_id
6141: ,ledger_id
6177: ,l_array_gl_date -- 5189664
6178: ,l_array_tax_line_ref -- 7226263
6179: ,l_array_tax_summary_line_ref -- 7226263
6180: ,l_array_tax_rec_nrec_dist_ref -- 7226263
6181: FROM xla_ae_lines_gt
6182: WHERE reversal_code = 'DUMMY_TR'
6183: ORDER by entity_id, event_number;
6184:
6185: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
6193: -- 4669308 Delete the MPA/Accrual Transaction Reversal (still in GT tables, not in distribution links yet)
6194: --=======================================================================================================
6195: --
6196: ---------------------------------------------------------------------------------------------------------
6197: -- 4669308 Delete the MPA/Accrual Transaction Reversal in xla_ae_lines_gt (not in distribution links yet)
6198: ---------------------------------------------------------------------------------------------------------
6199: --
6200: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 5412560
6201: FORALL i IN 1..l_array_entity_id.count
6198: ---------------------------------------------------------------------------------------------------------
6199: --
6200: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 5412560
6201: FORALL i IN 1..l_array_entity_id.count
6202: DELETE xla_ae_lines_gt lgt
6203: WHERE l_array_ledger_id(i) = lgt.ledger_id
6204: AND lgt.reversal_code IS NULL -- the lines created from reversal are not reversed again
6205: AND NOT EXISTS ( -- the lines already reversed are not reversed again
6206: SELECT 1
6203: WHERE l_array_ledger_id(i) = lgt.ledger_id
6204: AND lgt.reversal_code IS NULL -- the lines created from reversal are not reversed again
6205: AND NOT EXISTS ( -- the lines already reversed are not reversed again
6206: SELECT 1
6207: FROM xla_ae_lines_gt
6208: WHERE ledger_id = lgt.ledger_id
6209: AND ref_ae_header_id = lgt.ae_header_id -- 5499367 lgt.ref_ae_header_id
6210: AND temp_line_num = lgt.temp_line_num * -1
6211: )
6237: ---------------------------------------------------------------------------------------------------------
6238:
6239:
6240: --
6241: -- reverse the lines in xla_ae_lines_gt table (not in distribution links yet)
6242: --
6243: FORALL i IN 1..l_array_event_id.count
6244: INSERT INTO xla_ae_lines_gt
6245: (ae_header_id
6240: --
6241: -- reverse the lines in xla_ae_lines_gt table (not in distribution links yet)
6242: --
6243: FORALL i IN 1..l_array_event_id.count
6244: INSERT INTO xla_ae_lines_gt
6245: (ae_header_id
6246: ,temp_line_num
6247: ,event_id
6248: ,ref_ae_header_id
6764: , lgt.alloc_to_dist_id_num_2 alloc_to_dist_id_num_2
6765: , lgt.alloc_to_dist_id_num_3 alloc_to_dist_id_num_3
6766: , lgt.alloc_to_dist_id_num_4 alloc_to_dist_id_num_4
6767: , lgt.alloc_to_dist_id_num_5 alloc_to_dist_id_num_5
6768: FROM xla_ae_lines_gt lgt
6769: ,xla_ae_headers_gt hgt
6770: WHERE hgt.entity_id = l_array_entity_id(i)
6771: AND hgt.ledger_id = l_array_ledger_id(i)
6772: AND hgt.event_number < l_array_event_number(i)
6777: AND lgt.reversal_code IS NULL
6778: -- lines that are reversed earlier are not reversed again
6779: AND NOT EXISTS (
6780: SELECT 1
6781: FROM xla_ae_lines_gt
6782: WHERE ledger_id = lgt.ledger_id
6783: AND ref_ae_header_id = lgt.ae_header_id -- 5499367 lgt.ref_ae_header_id
6784: AND temp_line_num = lgt.temp_line_num * -1
6785: )
6787: ;
6788:
6789: IF (C_LEVEL_STATEMENT >= g_log_level) THEN
6790: trace
6791: (p_msg => 'Transaction Reversal - Reversal lines created from xla_ae_lines_gt = '||SQL%ROWCOUNT
6792: ,p_level => C_LEVEL_STATEMENT
6793: ,p_module => l_log_module);
6794: END IF;
6795:
6807: g_incomplete_mpa_acc_TR.l_array_ae_header_id
6808: ,g_incomplete_mpa_acc_TR.l_array_ae_line_num
6809: ,g_incomplete_mpa_acc_TR.l_array_parent_ae_header
6810: FROM
6811: xla_ae_lines_gt lgt
6812: ,xla_ae_lines ael
6813: ,xla_ae_headers aeh
6814: ,xla_events xet -- 5262950
6815: WHERE aeh.application_id = l_application_id
6866: -- Need to create reversal in Draft mode also (so can be viewed).
6867: ---------------------------------------------------------------------------------------------------------
6868: --
6869: FORALL i IN 1..l_array_event_id.count
6870: INSERT INTO xla_ae_lines_gt
6871: (ae_header_id
6872: ,temp_line_num
6873: ,event_id
6874: ,ref_ae_header_id
7172: AND application_id = xdl.application_id
7173: )
7174: AND NOT EXISTS (
7175: SELECT /*+ no_unnest */ 1
7176: FROM xla_ae_lines_gt
7177: WHERE ref_ae_header_id = xdl.ae_header_id
7178: AND temp_line_num = xdl.temp_line_num * -1
7179: AND ledger_id = l_array_ledger_id(i)
7180: )
7306: IF l_upgrade_check = 1 THEN
7307:
7308: SELECT min(xla_ae_headers.accounting_date)
7309: INTO l_min_ref_event_date
7310: FROM xla_ae_lines_gt gt1, xla_ae_headers
7311: WHERE gt1.reversal_code = 'REVERSAL'
7312: AND gt1.ref_event_id = xla_ae_headers.event_id;
7313:
7314: l_error_count := 0;
7323:
7324:
7325: FOR c_not_reversed_entries IN
7326: (SELECT DISTINCT gt1.event_id, gt1.ledger_id
7327: FROM xla_ae_lines_gt gt1, gl_ledgers gll
7328: WHERE gt1.reversal_code = 'DUMMY_TR'
7329: AND gll.ledger_id = gt1.ledger_id
7330: AND gll.ledger_category_code <> 'PRIMARY'
7331: AND NOT EXISTS (SELECT 1
7328: WHERE gt1.reversal_code = 'DUMMY_TR'
7329: AND gll.ledger_id = gt1.ledger_id
7330: AND gll.ledger_category_code <> 'PRIMARY'
7331: AND NOT EXISTS (SELECT 1
7332: FROM xla_ae_lines_gt gt2
7333: WHERE gt2.reversal_code = 'REVERSAL'
7334: AND gt1.event_id = gt2.event_id
7335: AND gt1.ledger_id = gt2.ledger_id)
7336: AND EXISTS (SELECT 1
7333: WHERE gt2.reversal_code = 'REVERSAL'
7334: AND gt1.event_id = gt2.event_id
7335: AND gt1.ledger_id = gt2.ledger_id)
7336: AND EXISTS (SELECT 1
7337: FROM xla_ae_lines_gt gt3
7338: WHERE gt3.reversal_code = 'REVERSAL'
7339: AND gt1.event_id = gt3.event_id))
7340:
7341: LOOP
7378: ,l_array_ledger_id
7379: ,l_array_balance_type_code
7380: ,l_array_entry_status_code
7381: ,l_array_header_num -- 4262811c missing mpa reversal lines
7382: FROM xla_ae_lines_gt lgt
7383: WHERE reversal_code = 'REVERSAL'
7384: AND NOT EXISTS
7385: (SELECT 1
7386: FROM xla_ae_headers_gt
7485:
7486:
7487: FOR c_not_reversed_entries IN
7488: (SELECT DISTINCT gt1.event_id, gt1.ledger_id
7489: FROM xla_ae_lines_gt gt1
7490: WHERE gt1.reversal_code IN ('DUMMY_LR', 'DUMMY_TR')
7491: AND NOT EXISTS (SELECT 1
7492: FROM xla_ae_lines_gt gt2
7493: WHERE gt2.reversal_code = 'REVERSAL'
7488: (SELECT DISTINCT gt1.event_id, gt1.ledger_id
7489: FROM xla_ae_lines_gt gt1
7490: WHERE gt1.reversal_code IN ('DUMMY_LR', 'DUMMY_TR')
7491: AND NOT EXISTS (SELECT 1
7492: FROM xla_ae_lines_gt gt2
7493: WHERE gt2.reversal_code = 'REVERSAL'
7494: AND gt1.event_id = gt2.event_id
7495: AND gt1.ledger_id = gt2.ledger_id))
7496:
9666: trunc(fc1.derive_effective)), -1, 'OTHER', 'EMU'), 'OTHER' ) to_type
9667: ,decode( fc2.derive_type, 'EURO', 'EURO', 'EMU',
9668: decode( sign( trunc(nvl(xal.currency_conversion_date, xeg.transaction_date)) -
9669: trunc(fc2.derive_effective)), -1, 'OTHER', 'EMU'), 'OTHER' ) primary_type
9670: FROM xla_ae_lines_gt xal
9671: ,gl_ledgers gl
9672: ,fnd_currencies fc
9673: ,fnd_currencies fc1
9674: ,fnd_currencies fc2
10006: */
10007:
10008: END IF;
10009: FORALL i in 1..l_array_conversion_type.COUNT
10010: UPDATE xla_ae_lines_gt xal
10011: SET currency_conversion_rate = l_array_new_rate(i)
10012: ,currency_conversion_type = l_array_new_type(i)
10013: ,currency_conversion_date = l_array_conversion_date(i)
10014: ,unrounded_accounted_cr = unrounded_entered_cr * l_array_new_rate(i)
10057: END IF;
10058:
10059: /*
10060: FORALL i in 1..l_max_ledger_index
10061: UPDATE xla_ae_lines_gt xal
10062: SET (xal.unrounded_accounted_dr
10063: ,xal.unrounded_accounted_cr
10064: ,xal.currency_conversion_rate
10065: )
10581: */
10582: /*
10583:
10584: FORALL i in 1..l_max_ledger_index
10585: UPDATE xla_ae_lines_gt xal
10586: SET (xal.unrounded_accounted_dr
10587: ,xal.unrounded_accounted_cr
10588: ,xal.currency_conversion_rate
10589: )
10757:
10758: CURSOR csr_gain_loss_amts IS
10759: SELECT ledger_id
10760: ,ae_header_id
10761: FROM XLA_AE_LINES_GT xal2
10762: WHERE nvl(xal2.gain_or_loss_flag, 'N') = 'Y'
10763: AND xal2.balance_type_code <> 'X'
10764: AND xal2.calculate_g_l_amts_flag = 'Y'
10765: AND xal2.reversal_code IS NULL
10774: ,ae_header_id
10775: ,balance_type_code
10776: ,gain_or_loss_ref
10777: ,event_id
10778: FROM XLA_AE_LINES_GT xal2
10779: WHERE nvl(xal2.gain_or_loss_flag, 'N') = 'N'
10780: AND xal2.balance_type_code <> 'X'
10781: AND xal2.reversal_code is NULL
10782: HAVING nvl(sum(xal2.unrounded_accounted_dr), 0) <> nvl(sum(xal2.unrounded_accounted_cr), 0) -- 5745199
10819: EXIT;
10820: END IF;
10821:
10822: FORALL Idx IN 1 .. l_array_ae_header_id.COUNT
10823: UPDATE /*+ index(xal XLA_AE_LINES_GT_N3)*/ xla_ae_lines_gt xal -- 6658161
10824: SET (xal.unrounded_accounted_cr
10825: , xal.unrounded_entered_cr
10826: , xal.unrounded_accounted_dr
10827: , xal.unrounded_entered_dr
10827: , xal.unrounded_entered_dr
10828: ,xal.currency_code
10829: ,xal.balance_type_code
10830: ) =
10831: (SELECT /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ -- 6658161,6727907
10832: case sign(nvl(sum(xal2.unrounded_accounted_dr), 0)
10833: - nvl(sum(xal2.unrounded_accounted_cr), 0))
10834: when -1 then null
10835: else nvl(sum(xal2.unrounded_accounted_dr), 0)
10867: then xal.balance_type_code
10868: else 'X'
10869: END
10870: END
10871: FROM xla_ae_lines_gt xal2
10872: WHERE xal2.ae_header_id = xal.ae_header_id
10873: AND xal2.balance_type_code = xal.balance_type_code
10874: AND xal2.gain_or_loss_ref = xal.gain_or_loss_ref
10875: AND xal2.ledger_id = xal.ledger_id
10884: AND xal.ae_header_id = l_array_ae_header_id(Idx)
10885: AND xal.ledger_id = l_array_ledger_id(Idx);
10886:
10887: /* old code
10888: UPDATE xla_ae_lines_gt xal
10889: SET xal.unrounded_accounted_cr =
10890: CASE sign(l_res_array_accounted_amount(Idx))
10891: WHEN -1 THEN NULL
10892: ELSE l_res_array_accounted_amount(Idx)
10931: END LOOP;
10932: CLOSE csr_gain_loss_amts;
10933:
10934: IF (g_num_bflow_prior_entries > 0) THEN
10935: UPDATE /*+ index(xal2 XLA_AE_LINES_GT_N3)*/ xla_ae_lines_gt xal
10936: SET xal.currency_code =
10937: (SELECT /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ max(currency_code)
10938: FROM xla_ae_lines_gt xal2
10939: WHERE xal2.ae_header_id = xal.ae_header_id
10933:
10934: IF (g_num_bflow_prior_entries > 0) THEN
10935: UPDATE /*+ index(xal2 XLA_AE_LINES_GT_N3)*/ xla_ae_lines_gt xal
10936: SET xal.currency_code =
10937: (SELECT /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ max(currency_code)
10938: FROM xla_ae_lines_gt xal2
10939: WHERE xal2.ae_header_id = xal.ae_header_id
10940: AND xal2.balance_type_code <> 'X'
10941: AND xal2.gain_or_loss_ref = xal.gain_or_loss_ref
10934: IF (g_num_bflow_prior_entries > 0) THEN
10935: UPDATE /*+ index(xal2 XLA_AE_LINES_GT_N3)*/ xla_ae_lines_gt xal
10936: SET xal.currency_code =
10937: (SELECT /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ max(currency_code)
10938: FROM xla_ae_lines_gt xal2
10939: WHERE xal2.ae_header_id = xal.ae_header_id
10940: AND xal2.balance_type_code <> 'X'
10941: AND xal2.gain_or_loss_ref = xal.gain_or_loss_ref
10942: AND xal2.ledger_id = xal.ledger_id
10948: AND xal.calculate_g_l_amts_flag = 'Y'
10949: AND xal.reversal_code is NULL
10950: and (xal.ae_header_id, balance_type_code, gain_or_loss_ref, ledger_id, event_id)
10951: in
10952: (select /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ ae_header_id, balance_type_code, gain_or_loss_ref, ledger_id, event_id
10953: from xla_ae_lines_gt xal3
10954: where xal3.ae_header_id = xal.ae_header_id
10955: AND xal3.balance_type_code <> 'X'
10956: AND xal3.gain_or_loss_ref = xal.gain_or_loss_ref
10949: AND xal.reversal_code is NULL
10950: and (xal.ae_header_id, balance_type_code, gain_or_loss_ref, ledger_id, event_id)
10951: in
10952: (select /*+ index(xal2 XLA_AE_LINES_GT_N4)*/ ae_header_id, balance_type_code, gain_or_loss_ref, ledger_id, event_id
10953: from xla_ae_lines_gt xal3
10954: where xal3.ae_header_id = xal.ae_header_id
10955: AND xal3.balance_type_code <> 'X'
10956: AND xal3.gain_or_loss_ref = xal.gain_or_loss_ref
10957: AND xal3.ledger_id = xal.ledger_id
10970: ,p_level => C_LEVEL_PROCEDURE
10971: ,p_module => l_log_module);
10972: END IF;
10973:
10974: UPDATE xla_ae_lines_gt xal
10975: --SET xal.temp_line_num = 0 -- It casues XLA_AE_LINES_GT_U1 violation when
10976: -- there are 2 extract lines and g/l is on
10977: SET balance_type_code = 'X'
10978: WHERE xal.gain_or_loss_flag = 'Y'
10971: ,p_module => l_log_module);
10972: END IF;
10973:
10974: UPDATE xla_ae_lines_gt xal
10975: --SET xal.temp_line_num = 0 -- It casues XLA_AE_LINES_GT_U1 violation when
10976: -- there are 2 extract lines and g/l is on
10977: SET balance_type_code = 'X'
10978: WHERE xal.gain_or_loss_flag = 'Y'
10979: AND nvl(xal.unrounded_accounted_cr, 0) = 0
11196: ,(xdl.temp_line_num) ref_temp_line_num
11197: ,(DECODE(xalg.currency_code,xal.currency_code,xah.accounting_entry_status_code,
11198: DECODE(xalg.bflow_applied_to_amount, NULL, 'X', xah.accounting_entry_status_code))) bflow_prior_entry_status_code
11199: ,(xah.entity_id) applied_to_entity_id
11200: FROM xla_ae_lines_gt xalg
11201: ,xla_transaction_entities xte
11202: ,xla_ae_headers xah
11203: ,xla_distribution_links xdl
11204: ,xla_ae_lines xal
11284: event_id,
11285: ledger_id,
11286: balance_type_code,
11287: temp_line_num
11288: FROM xla_ae_lines_gt
11289: WHERE reversal_code = C_DUMMY_PRIOR
11290: AND bflow_prior_entry_status_code IS NOT NULL AND bflow_prior_entry_status_code <> 'X'; -- 5132302 if applied to amt is null
11291: --AND (bflow_prior_entry_status_code IN ('F', DECODE(p_accounting_mode, 'D', 'D', 'F')));
11292:
11305: ,'N'
11306: ,gl.ledger_category_code
11307: ,glp.start_date
11308:
11309: FROM xla_ae_lines_gt xal,
11310: fnd_application_vl fav,
11311: gl_ledgers gl,
11312: gl_period_statuses glp
11313: WHERE ((reversal_code = C_DUMMY_PRIOR
11441: ,p_level => C_LEVEL_EVENT
11442: ,p_module => l_log_module);
11443: END LOOP;
11444:
11445: FOR l IN (SELECT * FROM xla_ae_lines_gt WHERE reversal_code = C_DUMMY_PRIOR) LOOP
11446: trace(p_msg => 'event_id='||l.event_id||
11447: ' ae_header_id='||l.ae_header_id
11448: ,p_level => C_LEVEL_STATEMENT
11449: ,p_module => l_log_module);
11525: EXIT;
11526: END IF;
11527:
11528: FORALL i IN 1..l_array_row_id.LAST
11529: UPDATE xla_ae_lines_gt
11530: SET code_combination_id = l_array_ccid (i)
11531: ,description = l_array_description (i)
11532: ,temp_currency_code = l_array_currency_code (i) -- upstream currency code
11533: ,currency_conversion_rate = l_array_curr_conversion_rate (i)
11553: ----------------------------------------------------------------
11554:
11555: ----------------------------------------------------------------
11556: /* performance bug 5357406
11557: UPDATE xla_ae_lines_gt xalg
11558: SET (code_combination_id
11559: ,description
11560: ,temp_currency_code -- upstream currency code
11561: ,currency_conversion_rate
11763: END IF;
11764:
11765: IF (l_array_balance_type_code.COUNT > 0) THEN
11766: FORALL i IN 1..l_array_balance_type_code.COUNT
11767: UPDATE /*+ index(xalg xla_ae_lines_gt_n4) */ xla_ae_lines_gt xalg -- 6990256
11768: SET ref_ae_header_id = temp_ref_ae_header_id,
11769: currency_code = temp_currency_code,
11770: reversal_code = null, -- 5499367
11771: (unrounded_entered_cr -- 5132302
11941: -------------------------------------------------------------------------------------------------------------------------
11942: -- 4655713b Update MPA and Accrual Reversal lines with Prior Entry
11943: -------------------------------------------------------------------------------------------------------------------------
11944: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 5666366
11945: SELECT /*+ Leading (xal1,xah1,xal2) index(xah1 XLA_AE_HEADERS_GT_U1) index(xal2 XLA_AE_LINES_GT_N2) no_expand */ -- 5666366
11946: xal2.segment1, xal2.segment2, xal2.segment3, xal2.segment4, xal2.segment5
11947: ,xal2.segment6, xal2.segment7, xal2.segment8, xal2.segment9, xal2.segment10
11948: ,xal2.segment11, xal2.segment12, xal2.segment13, xal2.segment14, xal2.segment15
11949: ,xal2.segment16, xal2.segment17, xal2.segment18, xal2.segment19, xal2.segment20
12012: ,l_array_mpa_temp_line_num
12013: ,l_array_mpa_ae_header_id
12014: ,l_array_mpa_header_num
12015: ,l_array_acc_rev_flag
12016: FROM xla_ae_lines_gt xal2 -- original downstream line
12017: ,xla_ae_headers_gt xah1 -- original downstream header
12018: ,xla_ae_lines_gt xal1 -- recognition lines
12019: ,xla_ae_lines xal3 -- upstream line
12020: WHERE xal2.source_distribution_type = xal1.source_distribution_type
12014: ,l_array_mpa_header_num
12015: ,l_array_acc_rev_flag
12016: FROM xla_ae_lines_gt xal2 -- original downstream line
12017: ,xla_ae_headers_gt xah1 -- original downstream header
12018: ,xla_ae_lines_gt xal1 -- recognition lines
12019: ,xla_ae_lines xal3 -- upstream line
12020: WHERE xal2.source_distribution_type = xal1.source_distribution_type
12021: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal1.source_distribution_id_num_1,C_NUM)
12022: AND NVL(xal2.source_distribution_id_num_2,C_NUM) = NVL(xal1.source_distribution_id_num_2,C_NUM)
12074: ,p_level => C_LEVEL_STATEMENT
12075: ,p_module => l_log_module);
12076: END LOOP;
12077:
12078: FOR i IN (select * from xla_ae_Lines_gt where reversal_code=C_MPA_PRIOR_ENTRY) LOOP
12079: trace
12080: (p_msg => 'ae_lines_gt PE dist ledger='||i.ledger_id||' ref_ae_header='||i.ref_ae_header_id||
12081: ' temp_line='||i.temp_line_num||' ae_header='||i.ae_header_id||' header_num='||i.header_num||
12082: ' bflow='||i.business_method_code||
12094: ,p_level => C_LEVEL_STATEMENT
12095: ,p_module => l_log_module);
12096: END LOOP;
12097:
12098: FOR i IN (select * from xla_ae_Lines_gt where reversal_code=C_MPA_PRIOR_ENTRY) LOOP
12099: trace
12100: (p_msg => ' seg s1='||i.segment1||' s2='||i.segment2|| ' s3='||i.segment3||' s4='||i.segment4||
12101: ' s5='||i.segment5||' s6='||i.segment6|| ' s7='||i.segment7||' s8='||i.segment8||
12102: ' s9='||i.segment9||' s10='||i.segment10|| ' s11='||i.segment11||' s12='||i.segment12||
12115: -- Updates only the Accrual-Reversal or MPA-Accrual line which is a PRIOR_ENTRY.
12116: -- NOTE: for Accrual-Reversal, one line may be Prior Entry and the rest may not, so update only Prior Entry line.
12117: ---------------------------------------------------------------------------------------------------------------
12118: FORALL i in 1..l_array_mpa_ledger_id.COUNT
12119: UPDATE xla_ae_lines_gt xal
12120: SET segment1 = l_array_mpa_segment1(i)
12121: , segment2 = l_array_mpa_segment2(i)
12122: , segment3 = l_array_mpa_segment3(i)
12123: , segment4 = l_array_mpa_segment4(i)
12190: --
12191: -- NOTE: some columns are set to NULL during Business_Flow_Validation
12192: ---------------------------------------------------------------------------------------------------------------
12193: FORALL i in 1..l_array_mpa_ledger_id.COUNT
12194: UPDATE xla_ae_lines_gt xal
12195: SET currency_code = DECODE(l_array_acc_rev_flag(i),'N',l_array_mpa_currency_code(i)
12196: ,currency_code)
12197: , currency_conversion_rate = DECODE(l_array_acc_rev_flag(i),'N',l_array_mpa_curr_conv_rate(i)
12198: ,currency_conversion_rate)
12353:
12354:
12355:
12356: --
12357: -- Bug 5339999 Delete the problematic lines from xla_ae_lines_gt.
12358: --
12359: FORALL i IN 1..l_array_balance_type_code.COUNT
12360: DELETE FROM XLA_AE_LINES_GT
12361: WHERE ae_header_id = l_array_ae_header_id(i)
12356: --
12357: -- Bug 5339999 Delete the problematic lines from xla_ae_lines_gt.
12358: --
12359: FORALL i IN 1..l_array_balance_type_code.COUNT
12360: DELETE FROM XLA_AE_LINES_GT
12361: WHERE ae_header_id = l_array_ae_header_id(i)
12362: AND event_id = l_array_event_id(i)
12363: AND ledger_id = l_array_ledger_id(i)
12364: AND 'Y' = l_array_bflow_historic (i);
12396: -- Update JE line for invalid entries
12397: -------------------------------------------------------------------------
12398:
12399: FORALL i IN 1..l_array_balance_type_code.COUNT
12400: UPDATE /*+ index(xalg xla_ae_lines_gt_n2) */ xla_ae_lines_gt xalg
12401: SET xalg.code_combination_status_code = C_INVALID
12402: , xalg.code_combination_id = -1
12403: WHERE xalg.balance_type_code = l_array_balance_type_code(i)
12404: AND xalg.ae_header_id = l_array_ae_header_id(i)
12470: ,'N')
12471: ,'N')
12472: ,'N')
12473: ,'N') -- 5443083
12474: FROM xla_ae_lines_gt l
12475: ,xla_ae_headers_gt h
12476: ,xla_gl_ledgers_v xlr
12477: WHERE (reversal_code = C_DUMMY_SAME
12478: OR reversal_code = C_MPA_SAME_ENTRY) -- 4655713b
12743: , l_array_join_ref_ae_header_id
12744: , l_array_join_temp_line_num
12745: , l_array_join_ae_header_id
12746: , l_array_join_header_num
12747: FROM xla_ae_lines_gt xal2
12748: , xla_ae_lines_gt xal
12749: , gl_code_combinations gcc
12750: WHERE xal2.source_distribution_type = xal.source_distribution_type
12751: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal.source_distribution_id_num_1,C_NUM)
12744: , l_array_join_temp_line_num
12745: , l_array_join_ae_header_id
12746: , l_array_join_header_num
12747: FROM xla_ae_lines_gt xal2
12748: , xla_ae_lines_gt xal
12749: , gl_code_combinations gcc
12750: WHERE xal2.source_distribution_type = xal.source_distribution_type
12751: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal.source_distribution_id_num_1,C_NUM)
12752: AND NVL(xal2.source_distribution_id_num_2,C_NUM) = NVL(xal.source_distribution_id_num_2,C_NUM)
12806: ,p_level => C_LEVEL_STATEMENT
12807: ,p_module => l_log_module);
12808: END LOOP;
12809:
12810: FOR i IN (select * from xla_ae_Lines_gt where reversal_code=C_DUMMY_SAME) LOOP
12811: trace
12812: (p_msg => 'ae_lines_gt SE dist ledger='||i.ledger_id||' ref_ae_header='||i.ref_ae_header_id||
12813: ' temp_line='||i.temp_line_num||' ae_header='||i.ae_header_id||' header_num='||i.header_num||
12814: ' bflow='||i.business_method_code||
12823: ,p_level => C_LEVEL_STATEMENT
12824: ,p_module => l_log_module);
12825: END LOOP;
12826:
12827: FOR i IN (select * from xla_ae_Lines_gt where reversal_code=C_DUMMY_SAME) LOOP
12828: trace
12829: (p_msg => ' seg s1='||i.segment1||' s2='||i.segment2|| ' s3='||i.segment3||' s4='||i.segment4||
12830: ' s5='||i.segment5||' s6='||i.segment6|| ' s7='||i.segment7||' s8='||i.segment8||
12831: ' s9='||i.segment9||' s10='||i.segment10|| ' s11='||i.segment11||' s12='||i.segment12||
12840:
12841: END IF;
12842:
12843: FORALL i IN 1..l_array_join_ledger_id.COUNT
12844: UPDATE xla_ae_lines_gt xal
12845: SET segment1 = l_array_same_segment1(i)
12846: , segment2 = l_array_same_segment2(i)
12847: , segment3 = l_array_same_segment3(i)
12848: , segment4 = l_array_same_segment4(i)
12893: -------------------------------------------------------------------------------------------------------------------------
12894: -- 4655713b Updates MPA-Accrual (not MPA-Recognition) and Accrual Reversal lines with Same Entry
12895: -------------------------------------------------------------------------------------------------------------------------
12896: IF xla_accounting_pkg.g_mpa_accrual_exists = 'Y' THEN -- 7128871
12897: SELECT /*+ Leading (xal1,xah1,xal2) index(xah1 XLA_AE_HEADERS_GT_U1) index(xal2 XLA_AE_LINES_GT_N2) no_expand */ -- 7128871
12898: xal2.segment1, xal2.segment2, xal2.segment3, xal2.segment4, xal2.segment5
12899: ,xal2.segment6, xal2.segment7, xal2.segment8, xal2.segment9, xal2.segment10
12900: ,xal2.segment11, xal2.segment12, xal2.segment13, xal2.segment14, xal2.segment15
12901: ,xal2.segment16, xal2.segment17, xal2.segment18, xal2.segment19, xal2.segment20
12925: ,l_array_mpa_ref_ae_header_id
12926: ,l_array_mpa_temp_line_num
12927: ,l_array_mpa_ae_header_id
12928: ,l_array_mpa_header_num
12929: FROM xla_ae_lines_gt xal2 -- Original line
12930: ,xla_ae_headers_gt xah1
12931: ,xla_ae_lines_gt xal1 -- MPA line
12932: WHERE xal2.source_distribution_type = xal1.source_distribution_type
12933: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal1.source_distribution_id_num_1,C_NUM)
12927: ,l_array_mpa_ae_header_id
12928: ,l_array_mpa_header_num
12929: FROM xla_ae_lines_gt xal2 -- Original line
12930: ,xla_ae_headers_gt xah1
12931: ,xla_ae_lines_gt xal1 -- MPA line
12932: WHERE xal2.source_distribution_type = xal1.source_distribution_type
12933: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal1.source_distribution_id_num_1,C_NUM)
12934: AND NVL(xal2.source_distribution_id_num_2,C_NUM) = NVL(xal1.source_distribution_id_num_2,C_NUM)
12935: AND NVL(xal2.source_distribution_id_num_3,C_NUM) = NVL(xal1.source_distribution_id_num_3,C_NUM)
12980: END LOOP;
12981: END IF;
12982:
12983: FORALL i in 1..l_array_mpa_ledger_id.COUNT
12984: UPDATE xla_ae_lines_gt xal
12985: SET segment1 = l_array_mpa_segment1(i)
12986: , segment2 = l_array_mpa_segment2(i)
12987: , segment3 = l_array_mpa_segment3(i)
12988: , segment4 = l_array_mpa_segment4(i)
13027:
13028: /*-------------------------------------------------------------------------------------------------------------------
13029: -- Replaced for performance fix above
13030: ---------------------------------------------------------------------------------------------------------------------
13031: UPDATE xla_ae_lines_gt xal
13032: SET (segment1, segment2, segment3, segment4, segment5, segment6, segment7, segment8, segment9, segment10
13033: ,segment11, segment12, segment13, segment14, segment15, segment16, segment17, segment18, segment19, segment20
13034: ,segment21, segment22, segment23, segment24, segment25, segment26, segment27, segment28, segment29, segment30
13035: ,code_combination_id
13131: , CASE WHEN count(*) = 1
13132: THEN MIN(DECODE(xal.inherit_desc_flag, 'Y', xal2.description, xal.description)) ELSE NULL END
13133: , CASE WHEN count(*) = 1
13134: THEN NULL ELSE xal.reversal_code END
13135: FROM xla_ae_lines_gt xal2
13136: , gl_code_combinations gcc -- bug4384869
13137: WHERE xal2.source_distribution_type = xal.source_distribution_type
13138: AND NVL(xal2.source_distribution_id_num_1,C_NUM) = NVL(xal.source_distribution_id_num_1,C_NUM)
13139: AND NVL(xal2.source_distribution_id_num_2,C_NUM) = NVL(xal.source_distribution_id_num_2,C_NUM)
13220: ,p_level => C_LEVEL_STATEMENT
13221: );
13222: END IF;
13223:
13224: DELETE xla_ae_lines_gt
13225: WHERE ledger_id = l_array_ledger_id(i)
13226: AND ref_ae_header_id = l_array_ref_ae_header_id(i)
13227: AND temp_line_num = l_array_temp_line_num(i)
13228: AND ae_header_id = l_array_ae_header_id(i)
13240: WHERE ledger_id = l_array_ledger_id(i)
13241: AND ae_header_id = l_array_ae_header_id(i)
13242: AND balance_type_code = l_array_balance_type_code(i)
13243: AND header_num = l_array_header_num(i)
13244: AND NOT EXISTS (SELECT /*+ index(lgt XLA_AE_LINES_GT_N2) */ 1
13245: FROM xla_ae_lines_gt lgt
13246: WHERE lgt.ledger_id = hgt.ledger_id
13247: AND lgt.ae_header_id = hgt.ae_header_id
13248: AND lgt.header_num = hgt.header_num
13241: AND ae_header_id = l_array_ae_header_id(i)
13242: AND balance_type_code = l_array_balance_type_code(i)
13243: AND header_num = l_array_header_num(i)
13244: AND NOT EXISTS (SELECT /*+ index(lgt XLA_AE_LINES_GT_N2) */ 1
13245: FROM xla_ae_lines_gt lgt
13246: WHERE lgt.ledger_id = hgt.ledger_id
13247: AND lgt.ae_header_id = hgt.ae_header_id
13248: AND lgt.header_num = hgt.header_num
13249: AND lgt.balance_type_code = hgt.balance_type_code);
13270: --
13271: -- Update JE lines for those that encountered error
13272: --
13273: FORALL i IN 1..l_array_balance_type_code.COUNT
13274: UPDATE xla_ae_lines_gt
13275: SET description = DECODE(description, C_CHAR, NULL, description)
13276: , code_combination_id = DECODE(code_combination_id, C_NUM, -1, code_combination_id)
13277: , code_combination_status_code = C_INVALID -- 4655713
13278: , segment1 = DECODE(segment1, C_CHAR, NULL, segment1)
13324: AND event_id = l_array_event_id(i)
13325: AND ledger_id = l_array_ledger_id(i)
13326: AND header_num = l_array_header_num(i) -- 5443083
13327: AND balance_type_code = l_array_balance_type_code(i)
13328: AND EXISTS (SELECT /*+ index(lgt XLA_AE_LINES_GT_N2) */ 1 - 5443083
13329: FROM xla_ae_lines_gt lgt
13330: WHERE lgt.ledger_id = hgt.ledger_id
13331: AND lgt.ae_header_id = hgt.ae_header_id
13332: AND lgt.header_num = hgt.header_num
13325: AND ledger_id = l_array_ledger_id(i)
13326: AND header_num = l_array_header_num(i) -- 5443083
13327: AND balance_type_code = l_array_balance_type_code(i)
13328: AND EXISTS (SELECT /*+ index(lgt XLA_AE_LINES_GT_N2) */ 1 - 5443083
13329: FROM xla_ae_lines_gt lgt
13330: WHERE lgt.ledger_id = hgt.ledger_id
13331: AND lgt.ae_header_id = hgt.ae_header_id
13332: AND lgt.header_num = hgt.header_num
13333: AND lgt.balance_type_code = hgt.balance_type_code