Query to get item on hand by org wise

Sunday, June 5, 2022

Query to get Assets SLA TO GL Entries in Fusion

 The below query provides you the details about asset journal entires of SLA with GL


SELECT GJH.description                                     DESCRIPTION,
       GJH.name                                            Journal_NAME,
       GJH.je_source,
       GJH.period_name,
       GCC.segment1,
       GCC.segment2,
       GCC.segment3,
       GCC.segment4,
       GCC.segment5,
       GCC.segment6,
       GCC.segment7,
       ( xal.entered_cr )                                  Credit,
       ( xal.entered_dr )                                  Debit,
       Nvl(xal.accounted_dr, 0) - Nvl(xal.accounted_cr, 0) Net,
       To_char(gjl.effective_date, 'mm/dd/yyyy')           GL_DATE,
       Nvl(fa.asset_number, (SELECT FAV.asset_number
                             FROM   fa_additions_vl FAV
                             WHERE  FAV.asset_id = XTE.source_id_int_1
                                    AND ROWNUM = 1))
       INVOICE_RECEIPT_PAYMENT_NUMBER_ref,
       gl.name                                             ledger_name,
       gjh.je_category
FROM   gl_je_headers GJH,
       gl_je_lines GJL,
       gl_code_combinations GCC,
       gl_import_references GIR,
       xla_ae_lines XAL,
       xla_ae_headers XAH,
       xla_events xe,
       xla_transaction_entities xte,
       gl_ledgers gl,
       fa_transaction_headers FTH,
       fa_additions_vl fa
WHERE  1 = 1
       AND GJH.je_header_id = GJL.je_header_id
       AND GJL.code_combination_id = GCC.code_combination_id
       AND GJH.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 GIR.gl_sl_link_table = XAL.gl_sl_link_table
       AND XAL.ae_header_id = XAH.ae_header_id
       AND xah.application_id = xe.application_id
       AND xah.application_id = xe.application_id
       AND xah.event_id = xe.event_id
       AND xe.application_id = xte.application_id
       AND xe.entity_id = xte.entity_id
       -- AND xte.entity_code = 'ADJUSTMENTS'
       -- AND xte.source_id_int_1 = aaa.adjustment_id
       AND GJL.status = 'P'
       AND GJH.je_source = 'Assets'
       AND XTE.source_id_int_1 = FTH.transaction_header_id(+)
       AND FTH.asset_id = fa.asset_id(+)
       AND gl.name = Nvl(:p_le, gl.name)
       AND gjh.period_name = Nvl(:P_PERIOD, gjh.period_name)