Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

/* Formatted on 2021/06/19 18:42 (Formatter Plus v4.8.

8) */
SELECT gjh.je_source, gjh.je_category, aa.period_year, aa.period_num,
aa.period_name, msib.segment1, msib.description,
NVL (xal.accounted_dr, 0) accounted_dr,
NVL (xal.accounted_cr, 0) accounted_cr, gir.gl_sl_link_id,
gir.reference_5, gir.reference_6, gir.reference_7, xte.source_id_int_1,
TO_CHAR (mmt.transaction_id), ood.organization_code,
ood.organization_name
FROM gl_periods aa,
gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations cc,
gl_import_references gir,
xla_ae_lines xal,
xla.xla_transaction_entities xte,
mtl_material_transactions mmt,
org_organization_definitions ood,
xla_ae_headers xah,
mtl_system_items_b msib
WHERE aa.period_set_name = 'PRG_AC_CALENDAR'
AND aa.period_year = 2017
AND period_num > 5
AND aa.period_name = gjh.period_name
AND gjh.status = 'P' --and gjh.PERIOD_NAME = :P_PERIOD_NAME
AND gjh.je_source = 'Inventory'
AND gjh.je_category = 'Miscellaneous Transaction'
AND gjh.je_header_id = gjl.je_header_id
AND gjl.code_combination_id = cc.code_combination_id
AND cc.segment1 IN ('104', '147')
AND cc.segment6 IN ('121906', '121907')
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.event_type_code LIKE 'MISC%'
AND gir.reference_5 = xte.entity_id
AND xte.source_id_int_1 = mmt.transaction_id
AND mmt.inventory_item_id = msib.inventory_item_id
AND mmt.organization_id = msib.organization_id
AND mmt.organization_id = ood.organization_id
AND NVL (xal.accounted_dr, 0) - NVL (xal.accounted_cr, 0) <> 0
UNION ALL
SELECT gjh.je_source, gjh.je_category, aa.period_year, aa.period_num,
aa.period_name, msib.segment1, msib.description,
NVL (xal.accounted_dr, 0) accounted_dr,
NVL (xal.accounted_cr, 0) accounted_cr, gir.gl_sl_link_id,
gir.reference_5, gir.reference_6, gir.reference_7, xte.source_id_int_1,
mtrh.request_number, ood.organization_code, ood.organization_name
FROM gl_periods aa,
gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations cc,
gl_import_references gir,
xla_ae_lines xal,
xla.xla_transaction_entities xte,
mtl_material_transactions mmt,
xla_ae_headers xah,
mtl_txn_request_headers mtrh,
org_organization_definitions ood,
mtl_system_items_b msib
WHERE aa.period_set_name = 'PRG_AC_CALENDAR'
AND aa.period_year = 2017
AND period_num > 5
AND aa.period_name = gjh.period_name
AND gjh.status = 'P' --and gjh.PERIOD_NAME = :P_PERIOD_NAME
AND gjh.je_source = 'Inventory'
AND gjh.je_category = 'Miscellaneous Transaction'
AND gjh.je_header_id = gjl.je_header_id
AND gjl.code_combination_id = cc.code_combination_id
AND cc.segment1 IN ('104', '147')
AND cc.segment6 IN ('121906', '121907')
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.event_type_code NOT LIKE 'MISC%'
AND gir.reference_5 = xte.entity_id
AND xte.source_id_int_1 = mmt.transaction_id
AND mmt.transaction_source_id = mtrh.header_id
AND mmt.organization_id = ood.organization_id
AND NVL (xal.accounted_dr, 0) - NVL (xal.accounted_cr, 0) <> 0

You might also like