Query to get account balance

Hi everyone. I wrote a query to get the balance for an internal bank account below:
select cba.bank_account_id, cba.bank_account_name, cba.bank_account_num,
cbau.bank_acct_use_id, (glb.period_net_dr - glb.period_net_cr) begin_balance,
hr_general.decode_organization(:p_org_id) company
from ce_bank_accounts cba, ce_bank_acct_uses_all cbau, gl_balances glb
where cbau.bank_account_id = cba.bank_account_id
and glb.period_name = 'SEP-10'
and cba.bank_account_id = :p_bank_account_id
and glb.code_combination_id = cba.asset_code_combination_id
The column begin _balance gives the opening balance. But if you notice, I am using period name is SEP-10. The problem is, my requirement is to get the balance between 2 dates. Say 10-JAN-2010 and 15-FEB-2010. How do I go about this?
Thanks

I do not think thats possible from the GL_BALANCES table if we do not have a period for each day as the table stores data for a period and not for a day. The same reason we do not have a daily trial balance.
Will be happy to get a work-around !
Thx / Sid

Similar Messages

  • SQL Query to get Account Balance in Oracle Apps

    Hi All,
    I have to use GL Account as a parameter in one of my concurrent programs but before that i need to ensure that the account parameter has no money in it.
    If anyone can help me with a SQL query to find the same, it would be a great help.
    Regards,
    Shruti

    Hi;
    Please follow Subject: Troubleshooting various Issues in Translation of Oracle General Ledger Doc ID: 296379.1 and also etrm site(etrm.oracle.com) for find out more details.
    Regards
    Helios

  • Query G/L Account Balances

    Can anyone help me determine which view to use in Oracle Financials to query the Actual G/L Account Balances?
    I have used "GLBV_ACTUAL_BALANCES" but my results are suspicious (I have one account that returns a balance, when there is no balance for that account when viewed inside of Oracle Financials).
    Thank you very much,
    Craig Tennant

    GL_BALANCES stores actual, budget, and encumbrance balances for detail and summary accounts.So pls try this table.
    Note that the column ACTUAL_FLAG is either ’A’, ’B’, or ’E’ for actual,budget,or encumbrance balances, respectively.

  • Query for Get trial Balance

    Hi
    i want to know that the query reunning inthe back end of trail balance reports
    advance thanks to solvers
    Regards
    Sakthivel R

    Hi,
    Try this one,
    Microsoft SQL Server  Management studio>Tools>SQL Server Profiler.
    then Run after that go to  trail balance reports.Now see in SQL Server Profiler you will get the table name.
    Regards,
    Siva

  • Query to Find Account Balances (Actual & Budgeted).

    Hi
    can any one suggest a query to list all GL (R12) Account (Segment2) Balances (Actual and Budgeted) for a given Enitity (Segment1) and Period.
    Some accounts have sub-accounts with Parent child relationship. List should include all child accounts where ever balances exist.
    or Pl. point me thread if it is already answered earlier in this forum.
    Thanks,
    T.
    Edited by: user13072694 on May 28, 2010 2:15 PM
    Edited by: user13072694 on May 28, 2010 2:19 PM
    Edited by: user13072694 on May 28, 2010 2:25 PM

    Hello.
    See if this query helps you:
    SELECT cc.segment2,
    nvl(sum(bal.begin_balance_dr + bal.period_net_dr - bal.begin_balance_cr - bal.period_net_cr),0) "Actual Balance",
    nvl(sum(balb.begin_balance_dr + balb.period_net_dr - balb.begin_balance_cr - balb.period_net_cr),0) "Budget Balance"
    FROM gl_balances bal, gl_balances balb, gl_code_combinations cc
    WHERE cc.code_combination_id = bal.code_combination_id
    AND balb.code_combination_id = cc.code_combination_id
    AND bal.set_of_books_id = <'your SOB id'>
    AND balb.set_of_books_id = <'your SOB id'>
    AND bal.period_name = <'your actual period name'>
    AND balb.period_name = <'your budget period_name'>
    AND bal.actual_flag = 'A'
    AND balb.actual_flag = 'B'
    AND bal.currency_code = <'you SOB currency code'>
    AND balb.currency_code = <'your SOB currency code'>
    GROUP by cc.segment2
    Hope this helps,
    Octavio

  • Query Account Balance Last Month

    Dear All,
    I need your help...I want to make query that show account balance AR at level 4 at end of month of last month. For example this month is March, so I want to show account balance AR at level 4 at end of month Feb.
    Thanks for your help
    Edited by: Ho  We I on Mar 3, 2009 3:47 AM

    Hi Ho,
    Try this out,
    SELECT SUM(Debit-Credit) as Balance from JDT1 WHERE RefDate <= [%0] and Account = [%1]
    Supply the first parameter with end date of the month and the second parameter with the account you want to check.
    Regardless which account you want to query (i wondered why you want to check AR balance by the account, you can get it from Customer Aging Report instead), you can use the query for any accounts
    Hope it helps.
    Cheers,
    Marini

  • How to get opening balance of a g/l account using query ?

    Dear all,
    I'm developing consolidated g/l accounts debit,credit totals month wise with opening & closing balances thru query based report,
    i'have got expected results except opening balance g/l account,
    How to get opening balance of a g/l account based on date as conditonal parameter ?
    Any one throw light on this ?
    Jeyakanthan

    Hi ,
    Please kindly help me on this.I don't know how to calculate opening bal and closing bal over a period of time by Quarter, and how to generate the reprot using crystal reports and please suggest me on this how to go ahead with this report.
    Here you can go through the reprot requirement , and also an attachment of my Report template.
    we have "Category of Investment" , "Income On Investment" ,"Gross yield" and "Net yield" are  report fields.
    1)"Category Of Investment " is Hardcoded.
    2)In this we have to get  "Investment" column from VTBFHAPO(BZBETR Field) table Database based on
    Flow type(SFHAZBA) in VTBFHAPO table ='0100' for bonds category.
    3)"Income on Investment" also we will get from DB using the following formula.
      Income On Investment= "Interest IncomeAmortizationCapitalgain"
    4)With the Date field(Making Date dimension based on date(DCRDAT) field in VTBFAHPO table.
    By Current Quarter,Year to Date,Last year)
    5)Opening bal---Investment
    Purchase--Flowtype=0100
    Meturity/Sales--Flowtype=0200
    Closing balance=Opening bal+(Investment or Purchase)-(Meturity or Sales)
                                      '0100'                 '0200'
    Here '0100' and '0200' are Flow types based on this i need to get value from the same Field.
    we need to Calculate "Gross yield" .
    The bellow are formulas  to evaluate "Gross yield "
    Ist Qtr  .Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Ist qtr. Year to date   Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Investment income=interest incomeamortisationcapital gain
    Iind Qtr.Gross yield=Investment income/(((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/3)
    Iind Qtr. Year todateGross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balanceJune closing balance)/2))((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/6
    This data should display over a period of time. based on "Current Quarter","YearToDate" and "Last year"
    The quarter starts from April,i,e FY,  I Like this i need to generate the report.
    Thanks in advance.

  • GL Account Balance Query Issue

    Hi,
      I'm trying to extract GL Balances in the following format
    Company Segment(Segment2)  ||   Account Number(Segment1) ||  Cost Center Segment4 ||  Account Descr ||  Actual Flag || Account Type || Activity || Activity in Period || Currency || Period End date || Account Balance
    Here's my query :
    SELECT     gcc.segment4  "Company Segment",
               gcc.segment1  "Account",
               gcc.segment2  "Cost Center",
               a1.description "Account Description",
             --  a2.description Company_Description,
               Decode(gcc.account_type,'A','Asset','E','Expense','L','Liability','O','Equity','R','Revenue') "Account Type",
               Decode(gcc.enabled_flag,'Y','TRUE','FALSE')  "Active Account",
               Decode(abs(bal.Period_net_dr - bal.Period_net_cr),0,'FALSE','TRUE') "Activity in Period",
               bal.actual_flag  " Actual Flag",
               bal.currency_code  "Account Currency",
               per.end_date  "Period End Date",
               SUM(( NVL(bal.PERIOD_NET_DR,0) + NVL(bal.BEGIN_BALANCE_DR,0))) - SUM(NVL(bal.PERIOD_NET_CR,0)+NVL(bal.BEGIN_BALANCE_CR,0)) -
                         SUM( NVL(bal.BEGIN_BALANCE_DR,0) - NVL(bal.BEGIN_BALANCE_CR,0))   "Account Balance"
    FROM        apps.fnd_flex_values_vl a1,      --- For Account Segment
                apps.fnd_flex_values_vl a2,              -- For Cost Center
                apps.gl_code_combinations gcc,
                apps.gl_balances bal,
                apps.gl_periods per
    WHERE       a1.flex_value = gcc.segment1 
    AND         a2.flex_value = gcc.segment2
    and         a1.flex_value_set_id = 111111        -- Value set id for Account
    ---and         a2.flex_value_set_id = 222222    -- Value set id for Cost Center
    and         gcc.code_combination_id = bal.code_combination_id
    and          bal.period_name = per.period_name
    and         gcc.segment1 in ('777777')      --- Sample Account for testing only
    --and         gcc.segment2 in (222222)
    and         per.period_set_name ='GL_CALENDAR'
    and         bal.period_name ='SEP-13'
    and         bal.actual_flag='A'
    group by    gcc.segment4,
                gcc.segment1,
                gcc.segment2,
                a1.description,
               --            Decode(gcc.account_type,'A','Asset','E','Expense','L','Liability','O','Equity','R','Revenue'),
                Decode(gcc.enabled_flag,'Y','TRUE','FALSE'),
                Decode(abs(bal.Period_net_dr - bal.Period_net_cr),0,'FALSE','TRUE'),
                bal.actual_flag,
                bal.currency_code,
                per.end_date
                order by gcc.segment1,gcc.segment2
    1) If I  comment value set id 222222(Cost Center), then I'm getting 15 Records ,If I uncomment that I'm getting 10 records?Is there anything wrong with my queryAs I'm not displaying descriptions for cost center and company do I need to join fnd_flex_values_vl again or not ? 2) To check activity in particular period in this case for SEP-13,I'm using the following clause : Decode(abs(bal.Period_net_dr - bal.Period_net_cr),0,'FALSE','TRUE') Do I need to check ABS values also ro not?

    Hi,
      You can do this with WD dynamic programming.
      You can do with domodifyview badi for accounting component /SAPSRM/WDC_UI_DO_ACC.
      You need to handle both views 'V_DO_ACCOUNTING' and  'V_DO_ACCOUNT_DETAIL' in the domodifyview badi implementation.
    I am sending the sample  code. How to attach the custom search help dynamically.
      DATA lo_nd_comp_context    TYPE REF TO if_wd_context_node.
      DATA lo_nd_acc_context     TYPE REF TO if_wd_context_node.
      DATA lo_nd_info_acc        TYPE REF TO if_wd_context_node_info.
      DATA lv_value_help_mode    TYPE i.
      DATA lv_value_help         TYPE string.
      " Read Context
      lo_nd_comp_context = wd_context->get_child_node( name = 'COMP_CONTEXT' ).
      " get node info object of accounting node
      IF lo_nd_acc_context IS BOUND.
        lo_nd_info_acc = lo_nd_acc_context->get_node_info( ).
      ENDIF.
      " continue only if node info is supplied
      IF lo_nd_info_acc IS BOUND.
        " get current search help info
        lo_nd_info_acc->get_attribute_value_help(
          EXPORTING
            name            = 'G_L_ACCT'
          IMPORTING
            value_help_mode = lv_value_help_mode
            value_help      = lv_value_help
    " Below this will add the custom search help from SRM .
             lo_nd_info_acc->set_attribute_value_help(
            EXPORTING
              name            = 'G_L_ACCT'
              value_help_mode = 'BUS2121'
              value_help      = 'Z_F4-Your search help'   " you own search help.
      endif.
    Regards,
    Devi prasad

  • How to get On Account Balance for a Customer in Accounts Receivables(AR)

    Hi,
    Pls let me know how i can get the On Account Balance and Customer Balance for a particular customer in AR.
    Pls let me if there is any SQL query or function availabe to get On Account Balance in AR.
    Is On Account Balance and Customer balance is same in AR.
    Pls let me know how i can get both the values.
    regards
    Udit

    try to join your query from these tables:
    1.Customer - RA_CUSTOMERS_ALL
    2.Customer Name - RA_CUSTOMERS_ALL
    3. Ship to /Bill to & Location - HZ_CUST_ACCT_SITES_ALL and RA_TERRITORIES
    4.Account Balance - AR_PAYMENT_SCHEDULES_ALL
    5.Current Balance - AR_PAYMENT_SCHEDULES_ALL
    if you additionally need aging try to set from here
    a)1-30 Past - AR_PAYMENT_SCHEDULES_ALL
    b)31-60 Past - AR_PAYMENT_SCHEDULES_ALL
    c)Over 90 Past - AR_PAYMENT_SCHEDULES_ALL
    This way you can achieve the outcome

  • Query Active account balance

    Hi Expert,
    Is it possible to get active account balance (by passing parameter using 'create date') thorugh Query.
    If possible post query.
    By,
    Kart

    Hi Gordon Du,
    This query may not correct, actually i need -Chart of accountwise
                                                        Balance
    such as 101010 - capital account = 200000
                 210101 - Bank account  =  100002
    SELECT T1.[AcctName],  T0.[LineMemo] Detail, T0.RefDate 'Posting Date', T0.TransId 'Transaction Number', T2.[AcctName] OffsetAccount, T0.[Debit], T0.[Credit], T0.[Ref1], T0.[Ref2], '0' Balance  FROM JDT1 T0  INNER JOIN OACT T1 ON T0.Account = T1.AcctCode INNER JOIN OACT T2 ON T0.[ContraAct] = T2.AcctCode WHERE (T1.[AcctName]  = '[%1]' or '[%1]' = '') and  (T0.[RefDate] >= '[%0]' or '[%0]' = '') and (T0.RefDate <= '[%2]' or '[%2]' = '')
    by
    kart

  • Query help on totalling 2 account balances

    Hi Experts,
    I have the following query:
    SELECT SUM(T0.[SYSDeb] - T0.[SYSCred]) AS 'Production'
    FROM JDT1 T0  INNER JOIN OJDT T1 ON T0.TransId = T1.TransId WHERE T0.[Account] = '_SYS00000000238' AND T0.[Account] = '_SYS00000000239'
    If I add the second WHERE statement the query gives me no results. I want to see the total of the 2 account balances in this query.
    Any help would be appreciated.
    Marli

    Hi Marli,
    Try this:
    SELECT SUM(T0.SYSDeb  - T0.SYSCred) AS 'Production'
    FROM JDT1 T0
    WHERE T0.Account in ('_SYS00000000238','_SYS00000000239')
    Thanks,
    Gordon

  • How do I get rid of the last $0.02 on my account balance ?

    I need to change my country and it wont let me as I have an account balance of $0.02. How do I get rid of this so I can change countries ?? HELP !!

    Try contacting iTunes Support and ask them if they can remove the balance from your account so that you can change countries : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • Please tell me a BAPI to get Closing balance of customer account based on Sales Organization?

    Hi Experts,
    A requirement has come up where I want to get Customer closing balance based on its sales organization as this particular customer is extented to 2 different sales organizations. I want to get the closing balance of individual sales organization vise.
    Please tell me a BAPI to get Closing balance of customer account based on Sales Organization?

    AFAIK there is no such BAPI, cause there is no database table with balance for customer per sales organisation. (No KNCx table for VKORG)
    First ask functionals (*) how to recover sales organisation from a FI document (I suppose for SD invoice it is easy if no merging between organisation) will be a little tricker for pure FI document like payment transactions (hope thet are quickly cleared...)  Then start from non cleared records of BSID (also BSAD if you use a past date of reference, in case you have to add the records of BSAD with clearing date greater than reference date) and cross it with SD information to break FI into sales organisation.
    Regards,
    Raymond
    (*) Ask for where do they store VKORG in FI documents

  • How to get each account balance in sapscript when using F.01

    Dear Friends,
    I had developed a sapscrit form for P/L statement ( TCODE F.01) printing Now I received a new requirement. I need to get the balance values for each account and check the credit/debit indicator in sapscript. Do anyone know how to do it?? Thanks in advance.
    BR
    Joe

    You can identify amount is credit/ debit by checking the field <b>shkzg</b> (Debit/Credit indicator).
    Reward points if useful.
    Regards,
    Sairam

  • I need to change my region on the Itunes store, but it says i cant because i have an account balance of $0.05. How do I get rid of this?

    I need to change my region on the Itunes store, but it says i cant because i have an account balance of $0.05. How do I get rid of this?

    Click here and request assistance.
    (68319)

Maybe you are looking for

  • USR05 table - used in include MV50AFZ1

    Hi All! I have to allow the Post Goods Issue for one user and one specific plant. To do this: 1. I created one parameter ID which value is the Plant where the user have to be authorized to post goods. 2. I created two roles; the first has the authori

  • Bulk Complete Error

    Hello, I am currently having an issue with the Complete Bulk stored proc call that I am executing through the Jena Adapter. The problem is when the stored proc attempts to load an invalid date, here is the exception: ERROR[2012-02-03 23:02:40,115] -

  • Parsing xml returned by web service

    I am calling a web service from flash and the web service returns xml. The xml gets urlencoded when it's put inside the soap wrapping xml and I'm not sure how to get rid of the soap wrapping and unencode the returned xml. Thanks.

  • When rebuild table and index

    Hi, how to know if for a table we should rebuild table and index ? Many thanks.

  • Panel Tabbed within dynamic region

    Hi Every body I have 3 dynamic region each region has a panel Tabbed when run the page the first region work fine when navigate between tabs (af:showDetailItem) , the second region it does't work when navigate between tabs it's like frozen just first