Tuesday, 25 June 2013

Trail Balance query in gl

  SELECT   gb.LEDGER_ID,
           glcc.SEGMENT1,
           glcc.SEGMENT3 GL_ACCT,
           FFV.DESCRIPTION,
           gb.PERIOD_NAME,
           NVL (gb.PERIOD_NET_DR, 0) - NVL (gb.PERIOD_NET_CR, 0) PTD,
           (NVL (gb.BEGIN_BALANCE_DR, 0) - NVL (gb.BEGIN_BALANCE_CR, 0))
           + (NVL (gb.PERIOD_NET_DR, 0) - NVL (gb.PERIOD_NET_CR, 0))
              YTD
    FROM   gl_balances gb,
           gl_code_combinations_kfv glcc,
           APPS.FND_FLEX_VALUES_VL FFV
   WHERE       gb.code_combination_id = glcc.code_combination_id
           AND gb.LEDGER_ID = :LEDGER_ID
           AND GLCC.SEGMENT3 = FFV.FLEX_VALUE
           AND gb.period_name = :PERIOD_NAME
ORDER BY   gb.LEDGER_ID, glcc.SEGMENT1

No comments:

Post a Comment