74: CCDL table which can result into the same cdl_line_num for a given expenditure_item_id */
75:
76:
77: INSERT WHEN cdl_line_type in ('R', 'D', 'BL', 'PC')
78: THEN INTO PA_XLA_UPG_LINES_GT
79: (legal_entity_id,
80: ledger_id,
81: org_id,
82: expenditure_item_id,
123: DR_REFERENCE_2,
124: DR_REFERENCE_3
125: )
126: WHEN cdl_line_type in ('R', 'C', 'BL', 'PC')
127: THEN INTO PA_XLA_UPG_LINES_GT
128: (legal_entity_id,
129: ledger_id,
130: org_id,
131: expenditure_item_id,
408: ledger_id,
409: legal_entity_id,
410: expenditure_item_id,
411: org_id
412: FROM PA_XLA_UPG_LINES_GT lines_gt
413: WHERE order_line_num = 1
414: AND ((p_mode = 'D') OR
415: (p_mode = 'R' AND
416: NOT EXISTS (SELECT null
547: grouped_line_type,
548: gl_date,
549: xla_ae_headers_s.nextval
550: )
551: SELECT /*+ USE_NL(ent_gt lines_gt) INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
552: lines_gt.expenditure_item_id,
553: ent_gt.entity_id,
554: lines_gt.grouped_line_type,
555: lines_gt.gl_date,
557: lines_gt.ledger_id,
558: lines_gt.legal_entity_id,
559: lines_gt.je_category,
560: lines_gt.event_type_code
561: FROM PA_XLA_UPG_LINES_GT lines_gt,
562: PA_XLA_UPG_ENTITIES_GT ent_gt
563: WHERE lines_gt.expenditure_item_id = ent_gt.expenditure_item_id
564: GROUP BY lines_gt.expenditure_item_id,
565: ent_gt.entity_id,
705: gl_date AS gl_date,
706: RANK() OVER (PARTITION BY header_id
707: ORDER BY expenditure_item_id, cdl_line_num, position) AS ae_line_num
708: FROM
709: (select /*+ USE_NL (event_gt lines_gt imp) INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1)
710: INDEX(imp, GL_IMPORT_REFERENCES_N3) */
711: lines_gt.position,
712: event_gt.header_id header_id,
713: event_gt.event_id event_id,
744: lines_gt.reference_2,
745: lines_gt.reference_3,
746: lines_gt.ledger_id,
747: lines_gt.gl_date
748: from PA_XLA_UPG_LINES_GT lines_gt,
749: PA_XLA_UPG_EVENTS_GT event_gt
750: where event_gt.expenditure_item_id = lines_gt.expenditure_item_id
751: and event_gt.event_date = lines_gt.gl_date
752: and event_gt.grouped_line_type = lines_gt.grouped_line_type
766: and rownum = 1)
767: WHERE cdl.expenditure_item_id between l_start_eiid and l_end_eiid
768: and cdl.line_type in ( 'R','C','D')
769: and cdl.acct_event_id is null
770: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
771: 1
772: from PA_XLA_UPG_LINES_GT lines_gt
773: where lines_gt.expenditure_item_id = cdl.expenditure_item_id
774: and lines_gt.cdl_line_num = cdl.line_num);
768: and cdl.line_type in ( 'R','C','D')
769: and cdl.acct_event_id is null
770: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
771: 1
772: from PA_XLA_UPG_LINES_GT lines_gt
773: where lines_gt.expenditure_item_id = cdl.expenditure_item_id
774: and lines_gt.cdl_line_num = cdl.line_num);
775:
776:
785: and rownum = 1)
786: WHERE cdl.expenditure_item_id between l_start_eiid and l_end_eiid
787: and cdl.line_type in ('BL','PC')
788: and cdl.acct_event_id is null
789: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
790: 1
791: from PA_XLA_UPG_LINES_GT lines_gt
792: where lines_gt.expenditure_item_id = cdl.expenditure_item_id
793: and lines_gt.cdl_line_num = cdl.line_num);
787: and cdl.line_type in ('BL','PC')
788: and cdl.acct_event_id is null
789: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
790: 1
791: from PA_XLA_UPG_LINES_GT lines_gt
792: where lines_gt.expenditure_item_id = cdl.expenditure_item_id
793: and lines_gt.cdl_line_num = cdl.line_num);
794:
795:
916: l_rows_processed := 0;
917:
918:
919: INSERT WHEN cdl_line_type in ('R', 'D', 'BL', 'PC')
920: THEN INTO PA_XLA_UPG_LINES_GT
921: (legal_entity_id,
922: ledger_id,
923: org_id,
924: expenditure_item_id,
973: DR_REFERENCE_2,
974: DR_REFERENCE_3
975: )
976: WHEN cdl_line_type in ('R', 'C', 'BL', 'PC')
977: THEN INTO PA_XLA_UPG_LINES_GT
978: (legal_entity_id,
979: ledger_id,
980: org_id,
981: expenditure_item_id,
1250: lines_gt.gl_period_name ,
1251: lines_gt.legal_entity_id,
1252: lines_gt.je_category,
1253: lines_gt.event_type_code
1254: from PA_XLA_UPG_LINES_GT lines_gt
1255: group by lines_gt.event_id,
1256: lines_gt.ledger_id,
1257: lines_gt.expenditure_item_id,
1258: lines_gt.entity_id,
1399: RANK() OVER (PARTITION BY header_id
1400: ORDER BY expenditure_item_id, cdl_line_num, position) AS ae_line_num
1401: FROM
1402: (select /*+ USE_NL (event_gt lines_gt imp)
1403: INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) INDEX(imp, GL_IMPORT_REFERENCES_N3) */
1404: lines_gt.position,
1405: event_gt.header_id,
1406: event_gt.event_id,
1407: lines_gt.code_combination_id,
1440: lines_gt.reference_2,
1441: lines_gt.reference_3,
1442: lines_gt.ledger_id,
1443: lines_gt.gl_date
1444: from PA_XLA_UPG_LINES_GT lines_gt,
1445: PA_XLA_UPG_EVENTS_GT event_gt
1446: where event_gt.expenditure_item_id = lines_gt.expenditure_item_id
1447: and event_gt.event_date = lines_gt.gl_date
1448: and event_gt.ledger_id = lines_gt.ledger_id /* Added for bug 4919145 */
1454: pa_mc_cost_dist_lines_all mc
1455: SET mc.xla_migrated_flag = 'Y'
1456: WHERE mc.expenditure_item_id between l_start_eiid and l_end_eiid
1457: and mc.line_type in ('R','C','D')
1458: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
1459: 1
1460: from PA_XLA_UPG_LINES_GT lines_gt
1461: where lines_gt.expenditure_item_id = mc.expenditure_item_id
1462: and lines_gt.cdl_line_num = mc.line_num);
1456: WHERE mc.expenditure_item_id between l_start_eiid and l_end_eiid
1457: and mc.line_type in ('R','C','D')
1458: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
1459: 1
1460: from PA_XLA_UPG_LINES_GT lines_gt
1461: where lines_gt.expenditure_item_id = mc.expenditure_item_id
1462: and lines_gt.cdl_line_num = mc.line_num);
1463:
1464:
1466: pa_mc_cc_dist_lines_all mc
1467: SET mc.xla_migrated_flag = 'Y'
1468: WHERE mc.expenditure_item_id between l_start_eiid and l_end_eiid
1469: and mc.line_type in ('BL','PC')
1470: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
1471: 1
1472: from PA_XLA_UPG_LINES_GT lines_gt
1473: where lines_gt.expenditure_item_id = mc.expenditure_item_id
1474: and lines_gt.cdl_line_num = mc.line_num);
1468: WHERE mc.expenditure_item_id between l_start_eiid and l_end_eiid
1469: and mc.line_type in ('BL','PC')
1470: and exists ( select /*+ INDEX(lines_gt, PA_XLA_UPG_LINES_GT_N1) */
1471: 1
1472: from PA_XLA_UPG_LINES_GT lines_gt
1473: where lines_gt.expenditure_item_id = mc.expenditure_item_id
1474: and lines_gt.cdl_line_num = mc.line_num);
1475:
1476: