Wednesday 24 September 2014

SQL for Material Transaction/Inventory to General Ledger cia SLA Journal check


select gjh.name,xah.EVENT_TYPE_CODE,xdl.SOURCE_DISTRIBUTION_TYPE,xdl.SOURCE_DISTRIBUTION_ID_NUM_1,xdl.ACCOUNTING_LINE_CODE,mmt.transaction_date,msib.segment1
  ,gcc.concatenated_segments gl_line_acct
  ,gcc_mta.concatenated_segments mtl_txn_acct
from gl_je_headers gjh,
     gl_je_lines gjl,
     xla_ae_lines xal,
     xla_ae_headers xah,
     apps.xla_distribution_links xdl,
     gl_code_combinations_kfv gcc,
     mtl_transaction_accounts mta,
     gl_code_combinations_kfv gcc_mta,
     apps.mtl_material_transactions mmt,
     apps.mtl_system_items_b msib
where gjh.je_header_id = gjl.je_header_id
AND gjh.ledger_id = gjl.ledger_id
and gjl.gl_sl_link_id = xal.gl_sl_link_id
and xal.ae_header_id = xah.ae_header_id
and xdl.ae_header_id = xal.ae_header_id
and xdl.ae_line_num = xal.ae_line_num
and gcc.code_combination_id = gjl.code_combination_id
 and xdl.source_distribution_id_num_1 = mta.inv_sub_ledger_id
and mta.REFERENCE_ACCOUNT = gcc_mta.code_combination_id
and mta.transaction_id = mmt.transaction_id
and msib.inventory_item_id = mmt.inventory_item_id
and msib.organization_id = mmt.organization_id
and gjh.name = ‘’

The above SQL gives details of material transactions and corresponding Journals created for them

No comments:

Post a Comment