Building Trial Balance Report. Please help

Hello guys,
I have a trial balance report which reports over more than one period (say between jan and march).
I have registered functions to get the opening and closing balance. Then included total debits and credits for each period. I'd like to think I've done this successfully and to the best of my knowledge.
However for some code combinations I see an opening balance (say 1,000,000) , total credits 0, total debits 5,000 and closing balance 400,000. What I mean basically is, the figures do not seem to tally. When I analyze the account from GL inquiry the total debits and total credits are exactly as shown in my report. Can anyone help me with this or maybe anyone with a better query. I am doing this project on 11i.
Many Thanks.
Here are my functions:
create or replace function get_open_balance
(p_code_combination_id in number,
p_set_of_books_id in number,
p_period_name in varchar2)
return number
is
v_open_balance number := 0;
begin
          SELECT
nvl(sum(bal.begin_balance_dr - bal.begin_balance_cr),0)
INTO v_open_balance
          FROM gl_code_combinations_kfv cc
          ,gl_balances bal
          WHERE
          cc.code_combination_id = bal.code_combination_id
          AND cc.code_combination_id = p_code_combination_id
          AND bal.period_name = p_period_name
          AND bal.set_of_books_id = p_set_of_books_id
          ORDER by
          cc.concatenated_segments;
return v_open_balance;
exception
when no_data_found then
return 0;
when others then
return 0;
end get_open_balance;
create or replace function get_close_balance
(p_code_combination_id in number,
p_set_of_books_id in number,
p_period_name in varchar2)
return number
is
v_close_balance number := 0;
begin
          SELECT
nvl(sum(bal.begin_balance_dr - bal.begin_balance_cr +
bal.period_net_dr - bal.period_net_cr),0)
INTO v_close_balance
          FROM gl_code_combinations_kfv cc
          ,gl_balances bal
          WHERE
          cc.code_combination_id = bal.code_combination_id
          AND cc.code_combination_id = p_code_combination_id
          AND bal.period_name = p_period_name
          AND bal.set_of_books_id = p_set_of_books_id
          ORDER by
          cc.concatenated_segments;
return v_close_balance;
exception
when no_data_found then
return 0;
when others then
return 0;
end get_close_balance;
Then here is my query:
select
gcc.code_combination_id,
gcc.concatenated_segments,
gsob.currency_code,
gsob.name sob_name,
gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,
4, gcc.segment4) account_description,
get_open_balance(gcc.code_combination_id, gsob.set_of_books_id, :p_period_from) opening_balance,
nvl((select sum(entered_cr)
from gl_je_lines gjl
where gjl.code_combination_id = gcc.code_combination_id
and gjl.status = 'P'
and gjl.effective_date between to_date('01-' || :p_period_from)
and last_day(to_date('01-' || :p_period_to))),0) credit,
nvl((select sum(entered_dr)
from gl_je_lines gjl
where gjl.code_combination_id = gcc.code_combination_id
and gjl.status = 'P'
and gjl.effective_date between to_date('01-' || :p_period_from)
and last_day(to_date('01-' || :p_period_to))),0) debit,
get_close_balance(gcc.code_combination_id, gsob.set_of_books_id, :p_period_to) closing_balance
from gl_code_combinations_kfv gcc, gl_sets_of_books gsob
where gsob.chart_of_accounts_id = gcc.chart_of_accounts_id
and gsob.set_of_books_id = nvl(:p_set_of_books_id, gsob.set_of_books_id)

Excellent!
Thank you very much.
Here is the update (this is for R12. In 11i just replace bal.ledger_id in the get_open_balance and get_close_balance functions with bal.set_of_books_id):
create or replace
function get_open_balance
(p_company in varchar2,
p_code_combination_id in number,
p_set_of_books_id in number,
p_period_name in varchar2)
return number
is
v_open_balance number := 0;
v_currency_code varchar2(500);
begin
-- get currency code for the set of books
begin
select currency_code
into v_currency_code
from gl_sets_of_books
where set_of_books_id = p_set_of_books_id;
exception
when others then
null;
end;
-- get sum
SELECT
nvl(sum(bal.begin_balance_dr - bal.begin_balance_cr),0)
INTO v_open_balance
FROM gl_code_combinations_kfv cc
,gl_balances bal
WHERE
cc.code_combination_id = bal.code_combination_id
AND cc.code_combination_id = p_code_combination_id
AND bal.period_name = p_period_name
AND bal.actual_flag = 'A'
AND bal.translated_flag is null
AND cc.segment1 = p_company
AND bal.currency_code = v_currency_code
AND bal.ledger_id = p_set_of_books_id
ORDER by
cc.concatenated_segments;
return v_open_balance;
exception
when no_data_found then
return 0;
when others then
return 0;
end get_open_balance;
create or replace
function get_close_balance
(p_company in varchar2,
p_code_combination_id in number,
p_set_of_books_id in number,
p_period_name in varchar2)
return number
is
v_close_balance number := 0;
v_currency_code varchar2(500);
begin
-- get currency code for the set of books
begin
select currency_code
into v_currency_code
from gl_sets_of_books
where set_of_books_id = p_set_of_books_id;
exception
when others then
null;
end;
-- get sum
SELECT
nvl(sum(bal.begin_balance_dr - bal.begin_balance_cr +
bal.period_net_dr - bal.period_net_cr),0)
INTO v_close_balance
FROM gl_code_combinations_kfv cc
,gl_balances bal
WHERE
cc.code_combination_id = bal.code_combination_id
AND cc.code_combination_id = p_code_combination_id
AND bal.period_name = p_period_name
AND bal.actual_flag = 'A'
AND bal.translated_flag is null
AND cc.segment1 = p_company
AND bal.currency_code = v_currency_code
AND bal.ledger_id = p_set_of_books_id
ORDER by
cc.concatenated_segments;
return v_close_balance;
exception
when no_data_found then
return 0;
when others then
return 0;
end get_close_balance;
select
gcc.code_combination_id,
gcc.concatenated_segments,
gsob.currency_code,
gsob.name sob_name,
gcc.segment3 account_code,
gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,
3, gcc.segment3) account_description,
get_open_balance(gcc.segment1, gcc.code_combination_id, gsob.set_of_books_id, :p_period_from) opening_balance,
nvl((select sum(decode(gjh.currency_code, gsob.currency_code, entered_cr, accounted_cr))
from gl_je_lines gjl, gl_je_headers gjh
where gjl.code_combination_id = gcc.code_combination_id
and gjh.actual_flag = 'A'
and gjh.je_header_id = gjl.je_header_id
and gjh.status = 'P'
and gjh.ledger_id = gjl.ledger_id
and gjl.status = 'P'
and gjl.effective_date between to_date('01-' || :p_period_from)
and last_day(to_date('01-' || :p_period_to))),0) credit,
nvl((select sum(decode(gjh.currency_code, gsob.currency_code, entered_dr, accounted_dr))
from gl_je_lines gjl, gl_je_headers gjh
where gjl.code_combination_id = gcc.code_combination_id
and gjh.actual_flag = 'A'
and gjh.je_header_id = gjl.je_header_id
and gjh.status = 'P'
and gjl.status = 'P'
and gjh.ledger_id = gjl.ledger_id
and gjl.effective_date between to_date('01-' || :p_period_from)
and last_day(to_date('01-' || :p_period_to))),0) debit,
get_close_balance(gcc.segment1, gcc.code_combination_id, gsob.set_of_books_id, :p_period_to) closing_balance
from gl_code_combinations_kfv gcc, gl_sets_of_books gsob
where gsob.chart_of_accounts_id = gcc.chart_of_accounts_id
and gcc.segment1 = :p_company
and gsob.set_of_books_id = nvl(:p_set_of_books_id, gsob.set_of_books_id)
Edited by: igwe on Jul 16, 2012 4:21 AM

Similar Messages

  • Cancelled invoices still appearing in AP Trial Balance report

    Hi,
    The invoice was cancelled during 2007 but it is still showing in the AP Trial balance and GL Trial Balance report.
    May I know why? The current fix is to go the JE and fix it to zero, but this involves lot of manual work.
    Please guide me to find the exact root cause.
    Regards,
    Muthulakshmi T.

    Hi,
    Please check this thread it should help you.
    https://forums.oracle.com/thread/1002139
    Regards,
    Yuvaraj

  • G/L Account & Profit Centre Wise  Trial Balance Report

    Im working on a Client which is in 5 version and does not have the new GL account and document split.
    They require a  report where they could get the trial balance report (Gl accoun & profit centre).Standard report F.48 provides only Gl Account wise.
    Please suggest me on how i can start this develpomnet.As per my view i need to update a Z table with profit centre and Gl account Amounts and then in turn fetch the values to my report.
    Can the SDN experts help me on this,i would be very gratfull.

    hi,
    you can use these tables for trial balances g/l account wise.
    TABLES : glt0 ,
                   skat ,
                   t001 .

  • R12(Payments)--Accounts Payable Trial Balance Report, Need Info.

    Hi All,
    We are trying to use the report Accounts Payable Trial Balance Report.
    This is an XML Report in R12 now and has 4 different RTF Templates.
    Can you please explain me how this report can be used in R12 and how does it selects the RTF template( from 4 different templates present) at run time.?
    Thanks,

    Hi,
    In 11i we use to have a parameter to give the report in Summary or Detail
    In R12 we have 4 options in templates to have Summary by Account, Summary by Supplier, Detail by Account and Detail by Supplier.
    Report will not select the template automatically. The user needs to select the template before submitting the report.
    Hope it helps
    Regards,
    Sridhar

  • TRIAL BALANCE REPORT(RFBILA00)

    Hi,
    I am working on Trial Balnce report. I copied the standard program RFBILA00 to the custom program. The report is displaying correctly. But in the Accumulated Other Comprehensive Income I need to add the amount that displays in the comprehensinve Income.
    I have Accumulated other comprehensive Income as 1,500,000.00-
    Comprehensive Income as 253,951.18-
    When the report displays these two incomes should be added and display at Accumulated Other Comprehensive Income.
    Please help me with this.This is a very urgent requirement.
    Helpul answers are rewarded.
    Thanks,
    Ramdeep

    Hi,
    Trial Balance Report is a report which contains the summary of all the account balances at a given date.
    It  is a financial summary,prepared primarily to test the accuracy of statements or results.
    Program for Trial Balance:
    <b>RFGLKR00</b>
    Tables Used in Trail Balance Report :
    <b>SKA1 - G/L Account Master (Chart of Accounts) </b>
    Regards,
    Padmam.

  • Trial balance report in Mutilple currencies

    Hi,
    we are working in oracle applications 11i
    How can the gl super user generate different versions of trial balance report. each in a different currency, euro, etc
    We have the MRC installed for USD.
    Please correct me if I'm wrong, I' ll need to create a new reporting set of book, a new reporting responsibilty, etc.
    But, is there any way that we can get from the system sucha report without the above setup?
    need help urgent please
    Edited by: AHS on Jan 6, 2011 12:40 AM

    Hello.
    Translate your balances to the desired foreign currencies.
    Octavio

  • Accu. Debit and Accu. Credit in Standard Trial Balance Report

    Hi experts,
    I would like to ask for help about the definition of the column Accu. Debit and Accu. Credit in the standard trial balance report.
    Previously, I thought it were columns to display the total debit and total credit start from the system go-live to the end period I selected in the report selection criteria. However, in my testing, it seems only included the transaction of the fiscal year of the end of period I selected in the report selection criteria. e.g. If I selected 01.Jan.2009 - 31.Dec.2010, Accu. Debit and Accu. Credit will only display the sum of transaction made in 2010.
    In the selection criteria, I selected "Account Balance" and "Annual Report", and unchecked all other selection criteria.
    Environment: 8.81 PL06
    Please help. Thanks so much.
    James
    Edited by: JaWang on Jan 10, 2012 3:47 AM
    Edited by: JaWang on Jan 10, 2012 4:07 AM

    Hi James,
    The Accu. Debit and Accu. Credit in Standard Trial Balance Report can only be calculated through the current report. They have no relation with your initial balance in previous period.
    Thanks,
    Gordon

  • Hyperion Financial Reporting: Trial Balance Report

    Hi All,
    I am a beginner in Hyperion Financial Reporting. I am trying to create a report for Trial Balance accounts.
    The report should have the all the accounts in the rows and two columns with DEBIT and CREDIT without any other dimensions in the columns.
    I could not setup this grid because we need to have a dimension in the column. It is fine for me to have Period dimension or something like that. But the point is, I dont know how to retrieve the Debit / Credit in two columns.
    I thought a lot to see if we can do this with sign of the data or the type of the accounts. But could not get an idea.
    Does this require any customization in FR? Is there anyway to achieve this?
                                       Debit     Credit
    Account 1                    1000
    Account 2                                   1000
    Account 3                    1000
    Account 4                                   1000
    Variance                         0               0

    Hi,
    Let me understand your issue here. You have Trial balance report which has 2 column: Debit and Credit. What connection do you have ? Is it Planning, HFM or other sources ? Normally, when you are using dimension, you should have another dimension, apart from Account that consist of Debit and Credit, which you can call during reporting design. The only requirement when you build a standard reporting with FR or Smartview is you need to place 1 dimension in row and 1 dimension in column. If you are using Hyperion, such as Planning and HFM, you should have more than 1 dimension.
    If you don't store any Debit/Credit data, then you won't be able to get that. As far as I know, this Debit/Credit exist in Trial balance report, which is an extraction from GL. When FDM or other ETL tool pushes this data as a base data for HFM, the Debit/Credit data will be translated as plus/minus data in HFM. Say, Cash in TB closing should be in Credit. In HFM, this cash displays in positive value. Otherwise, if Cash in TB closing is in Debit, then in HFM, this should be negative. But this rules will apply differently to other accounts.
    I hope this help.
    Regards,
    Anna

  • AP Trial Balance Report Issue

    Hi gurus- I run the AP Trial Balance report and have an issue that I cannot reconcile with my raw data because when I export into excel, the invoice number is cut off after 20 characters.  This client has long invoice numbers.  Is there any way to get the SQL for this report and run it separately so I may see the invoice numbers and reconcile?  Thanks a lot.

    Hi,
    Please check note:553484.1, there are some queries provided to check the TB data like queries to compare XLA and GL data.
    Hope it helps

  • AP Trial Balance Report Query

    Hi - We use the AP Trial Balance Report as a supporting schedule to reconcile our General Ledger AP Creditor Control Account against.
    Ordinarily we would use the total remaining amount at the end of the report (which has historically balanced to the GL).
    The value in the remaining amount column has always equalled the value in the amount column.
    However, during P12 when we have generated the report we have identified several transactions that have an amount appearing in the 'remaining amount' column but no corresponding entry in the 'amount' column.
    We're not sure what the 2 column represent and why this would be the case.
    Consequently by using the 'Remaining Amount' total and comparing it to the GL balance we are out by the amounts that are only appearing on one side of the AP Trial Balance.
    I've looked at the accounting postings on the AP for some of the particualr records and can see that there is a debit and credit posting to expenditure that net off and and also a debit and credit posting to the AP Creditor Control Account that also net off
    Can anyone provide us with an explantion please?

    Hi,
    Please check note:553484.1, there are some queries provided to check the TB data like queries to compare XLA and GL data.
    Hope it helps

  • Accounts Payable Trial Balance Report does not include a Credit Memo amount

    Hello Experts,
                        We are having an issue with Ap Trial Balance report not displaying a credit memo amount whereas Gl Balance shows that amount. The Credit Memo has a August invoice date and September pay date but it’s not showing up in the trial balance for August. The acconting date on the Creditmemo is in august.
    Thanks in advance for any help.

    Hi,
    We also faced the same problem and approached Oracle support.
    They provided us with a patch and datafix. Better raise an SR and get specific support.
    Regards,
    Sridhar

  • Start Date for AP trial balance report

    Hello
    Am working on generating the Trial balance report in the Payables. I am running the "Accounts Payables Trial Balance report. For this report, in the parameters, there is "As of Date" parameter, but I do not have the "Start Date" parameter. I wanted to get a trial balance report for a given analysis period, like between Jan 03 and Dec 03.
    Can any one please let me know about this.
    Thank you
    Bob

    Hi Bob.
    I'm affraid such report is not available.
    You may get something similar by running the RX-only: Payables Invoice Register by Detail. You also have the option to change the way data appears on the report on it is an RX report.
    Octavio

  • Customize AP Trial Balance Report in R12.1.3

    Hi
    I have to customize AP Trial Balance Report in R12 Version 12.1.3.
    Can any one please provide some pointers how do we do it?
    Here is some background for AP Trial Balance Report:
    Its an XML Publisher Report with XDODTEXE Executable. XLAAPRPT.xml is the file uploaded to data definition(Code: APTBRPT) for Accounts Payable Trial Balance . XML template XDODTEXE calls oracle’ s seeded XML template “XLAAPRPT.xml ", this template further calls package XLA_TB_AP_REPORT_PVT for Trial balance.
    Our customiztion has to populate trial balance data in to our custom table instead of global temp table . XLA_TB_AP_REPORT_PVT package has a private procedure populate_trial_balance_gt which populates trial balance data into xla_trial_balances_GT.
    Please provide some ideas for customization of standard XML publisher reports in R12.1.3.
    Any ideas are appreciated.
    Thanks
    Theja R

    Hi Vamsi,
    I've recreated the standard oracle Trial balance package & XML file . Now i'm able to populate the data into custom table as well as standard table . But the report out doesn't show data in it . it just shows report title, columns bUT NO DATA. the xml file itself doesnt contain data. The custom report completes in 2 mins. But standard report completes in 7 mins
    Steps
    1. Create custom package similar to oracle standard package & added new insert statement to populate trial balance data into custom table.
    2. created new datadefinition with new datatemplate(refering custom package) similar to oracle standard datatemplate.
    3. create template same as standard template.
    4. copy of standard conc program with custom application
    5. Ran the report ...able to populate data into custom table .....but unable to see data in the report.
    Please let me know if i'm missing anythng.

  • GL Trial Balance Report with Effective Dates as Parameters

    We have a requirement to show the GL Trial Balance report with Effective dates as Parameters.
    Current Analysis:
    The Journals get updated with corresponding CCID in GL_BALANCES table when the Journal is posted. GL_BALANCE is SOB specific, if the SOB has month as period then the balances in GL_BALANCES would get updated against the month(period).
    To overcome the period problem, we explored the option of using a View based on GL_JE_HEADERS and GL_JE_LINES for 'Posted' Journal Batches of a SOB. We are checking whether the GL_JE_HEADERS.default_effective_date lies between the :p_from_date and :p_to_date which is sent to the Report as a parameter. The above idea does not return expected data when the custom Trial Balance Report is run.
    Following is the Query being used:
    SELECT cc.segment4 ACCOUNT, bal.code_combination_id,
    bal.begin_balance_dr
    + SUM (NVL (gljel.accounted_dr, 0)) opening_bal_dr,
    bal.begin_balance_cr
    + SUM (NVL (gljel.accounted_cr, 0)) opening_bal_cr,
    ffv.description,
    (SELECT SUM (NVL (gljel.accounted_dr, 0))
    FROM gl_je_headers gljeh,
    gl_je_lines gljel,
    gl_code_combinations gcc
    WHERE gljeh.default_effective_date BETWEEN :p_from_date
    AND :p_to_date
    AND gljeh.je_header_id = gljel.je_header_id
    AND gljel.code_combination_id = gcc.code_combination_id
    AND gljel.period_name = gljeh.period_name
    AND gljel.set_of_books_id = :p_set_of_books_id
    AND gljeh.status = 'P'
    AND gljel.status = 'P'
    AND gljeh.actual_flag = 'A'
    --AND gljel.code_combination_id =
    -- bal.code_combination_id
    AND gcc.segment4 = cc.segment4
    GROUP BY gcc.segment4) c_dr,
    (SELECT SUM (NVL (gljel.accounted_cr, 0))
    FROM gl_je_headers gljeh,
    gl_je_lines gljel,
    gl_code_combinations gcc
    WHERE gljeh.default_effective_date BETWEEN :p_from_date
    AND :p_to_date
    AND gljeh.je_header_id = gljel.je_header_id
    AND gljel.period_name = gljeh.period_name
    AND gljel.code_combination_id = gcc.code_combination_id
    AND gljel.set_of_books_id = :p_set_of_books_id
    AND gljeh.status = 'P'
    AND gljel.status = 'P'
    AND gljeh.actual_flag = 'A'
    AND gcc.segment4 = cc.segment4
    GROUP BY gcc.segment4) c_cr
    FROM gl_period_statuses per,
    gl_code_combinations cc,
    gl_balances bal,
    gl_je_headers gljeh,
    gl_je_lines gljel,
    fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE cc.chart_of_accounts_id = :p_chart_of_accts_id
    AND bal.currency_code = :p_currency
    AND bal.actual_flag = 'A'
    AND bal.period_name = per.period_name
    AND cc.template_id IS NULL
    AND cc.code_combination_id = bal.code_combination_id
    AND per.set_of_books_id = :p_set_of_books_id
    AND per.application_id = 101
    AND :p_from_date BETWEEN per.start_date AND per.end_date
    AND gljeh.period_name = per.period_name
    AND gljeh.default_effective_date <= :p_from_date
    AND gljeh.je_header_id = gljel.je_header_id
    AND gljel.period_name = gljeh.period_name
    AND gljel.set_of_books_id = :p_set_of_books_id
    AND ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name = 'JSWEL_ACCOUNT'
    AND gljeh.status = 'P'
    AND gljel.status = 'P'
    AND cc.summary_flag = ffv.summary_flag
    AND cc.segment4 = ffv.flex_value
    AND gljeh.actual_flag = 'A'
    AND gljel.code_combination_id = bal.code_combination_id
    GROUP BY bal.begin_balance_dr,
    bal.begin_balance_cr,
    cc.segment4,
    ffv.description,
    bal.code_combination_id
    Kindly suggest if I am missing anything. I am sure that the great guns here can help me out.
    Thanks
    Sumit

    suggest to create customize TB report.

  • GL Trial Balance Report with Source Field

    Hi All,
    How can we add Source Column to Trial Balance Report. As this Oracle's Seeded report is developed based on GL_BALANCES Table, how can we add source column to this report? Can anyone suggest on this to add source column to this report? If not possible to add the column then, is there any possibility to create new report ? If yes, then please suggest us to do that way
    Sources are like Receivables, Payables, Manual, Spreadsheet, etc.
    Regards,
    Bharat

    suggest to create customize TB report.

Maybe you are looking for

  • Lost of HP Digital TV Tuner signal, with Win Media Center, on a random weekly frequency

    I have a HP Pavilion dv9500 Notebook, (ref : dv9649em - GY429EA#ABF - CNF73912X6 ) and use a HP Digital TV tuner bought with an HP notebook Pavilion tx1000, it's an express card tuner format 34, used on the express card port 54 of the dv9500. The dv9

  • Step by step to get leopard join an AD

    I would appreciate it very much if someone could tell me how to join an imac with leopard to an active directory network. there is a part i dont understand which asks for a GUID... i dont know what to put in there. when i add the info and try to conn

  • BB MEssenger just stopped working

    HI - I have two local (Canadian) bb contacts and one British one. Have been bb messaging them all with no problem for months and suddenly the other day the british one stopped working. We've tried deleting each other and re - adding each other but to

  • Video preview very slow. Is my hardware fine? (CS4)

    I've searched around the internet and apparently this is a fairly common problem people have. Sadly, despite the commonality, I couldn't find any definitive fix or solution for these problems. My PC isnt the best ever, but it can handle itself. Graph

  • Bouton démarré / stop

    Bonjour  Je voudrais savoir comment créer un bouton de start / stop dans mon application,  je travail avec deux cartes d'acquisition PCMCIA et USB de NI. S'il vous plait ; S'il vous plait quelqu'un peut m'aider  je dois finir mon stage  Merci Pièces