YTD Cumulative Balance Calculation

Hi All,
I need to calculate YTD Cumulative Balance.
User will provide fiscal year/period in run time.
Cumulative balance should be calculated from fiscal year/period 0000 to user provided fiscal year / period.
ex. if user entered value is march, 2010 then cumulative balance should be calculated as
00 2010 + 01 2010 + 02 2010 + 03 2010.
Please help me in acheiving this.
Thanks,
Sri Arun Prian

Hi Sri,
I hope this may be this is better version of code for your problem, esp. with Cust. Exits for months in YTD
WHEN 'VAR_TEST_SOMETHING'.
    IF I_STEP = '2'.
      DATA : V_INPUT_PER TYPE /BI0/OIFISCPER.
      READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE WITH KEY VNAM = 'WHATEVER_TABLE'.
      IF SY-SUBRC = 0.
        V_INPUT_PER = LOC_VAR_RANGE-LOW.
        IF V_INPUT_PER+4(3) = '001' OR  V_INPUT_PER+4(3) = '002' OR   V_INPUT_PER+4(3) = '003'.
          CONCATENATE V_INPUT_PER(4) '001' INTO L_S_RANGE-LOW.
          L_S_RANGE-OPT = 'EQ'.
          L_S_RANGE-SIGN = 'I'.
          APPEND L_S_RANGE TO E_T_RANGE.
          CONCATENATE V_INPUT_PER(4) '002' INTO L_S_RANGE-LOW.
          L_S_RANGE-OPT = 'EQ'.
          L_S_RANGE-SIGN = 'I'.
          APPEND L_S_RANGE TO E_T_RANGE.
          CONCATENATE V_INPUT_PER(4) '003' INTO L_S_RANGE-LOW.
          L_S_RANGE-OPT = 'EQ'.
          L_S_RANGE-SIGN = 'I'.
          APPEND L_S_RANGE TO E_T_RANGE.
        ELSEIF V_INPUT_PER+4(3) = '004' OR
               V_INPUT_PER+4(3) = '005' OR
               V_INPUT_PER+4(3) = '006'.
         Similiarly for rest of the months....
        ENDIF.
      ENDIF.
    ENDIF.
Just for reference.
Thanks
Arun Bala
Edited by: Arun Bala G on Feb 26, 2010 6:46 AM

Similar Messages

  • Report "General Ledger from the Document File" - Cumulative balance

    Hi!
    When I start the report "General Ledger from the Document File" (transaction S_ALR_87100205), I get a list of documents with no obvious default sort order criteria (I can see at glance that document numbers and posting dates are not sort criteria). This makes the cumulative balance column completely useles.
    Since the cumulative balance is carried from one row to another, standard sorting functionality for the already produced list makes no sense.
    There should be a way to affect the sort order in program <b>before</b> cumulative balance calculation, or at least to find it out.
    Is there a way to acomplish this?
    Thanks!
    Regards,
    Igor

    In the output control section there is a button called configure. Select a variant. Select configure. Save the sort order and report definition the way you want it. Name a new variant. Now go back and run the report with your variant.
    pls assign points if helpful as a way to say thanks.

  • General Ledger: Cumulative balance question on G/L account balance.

    Hi SAP friends,
    I had a question about cumulative balance.
    If I  see ending balance of xyz account of abc company code  $5000 in 2007.
    Now this is carried forward.
    When I beginning balance in 2008 . It is different number say $100000.
    How is the system calculating that and where is it storing (what table).
    This  new balance is probably due to   adjustments, asset posting etc etc.
    But is there a table or a way the transaction is storing this change of balance from 2007 to 2008 because from bseg   the result varies.
    Thanks
    Kavita

    U would have to rerun F.16 again, and also this time look at FS10N for the account whetehr there are any balances in period 13-16. There might be some adjustments done in between these periods.
    Usually these control values per company, per period, per accounts are stored in table GLT0.

  • G/L Cumulative Balances report

    Hi All,
    Can someone explain the G/L cumulative balances report.
    Our scenario:
    we are using a standard query 0FIGL_C01_Q0002 for this, Now when i give the fiscal year as 2010 it shows the first , second, third & Fourth quarter of 2009 with alll values populated and also shows the 2010 4 quarters with data , now the enduser says the 4th quarter of 2010 shold be zero but now values are seen.
    How can i solve the issue.
    I see that both G/L Balances & G/L Cumulative Balances are similar expect that for G/L Balances the quarters value is calculated based on the Keyfigure 'Balance ' which is the difference between debit pstings & Credit Postings
    The G/L Cumulative Balances are calculated based on the key figure Cumulative Balane.
    Please can someone give me clarity on this....

    Hi cvjen76,
    Do you have any varibale on reporting period
    1. If yes give reporting month till quarter 2010(reporting month)
    I think your working on P & L report. So your getting G/L balance & G/L cumilative is same.
    G/L balance is difference b/n debit & credit(debit-credit), where as G/L cumulative balance is difference in debit & credit for the present period & previous periods of that particular fiscal year.
    hope this will help you.
    Thanks,
    Vijay.

  • Opening and Cumulated Balances of PCA

    Dear BI Gurus,
           I am using two standard (PCA) Data Sources
    <b>1. 0EC_PCA_3 and
    2. 0EC_PCA_4</b>      to Load data into my Custom Cube.I need Cumulated balance and Opening Balance of Actual Line Items for my reporting purpose.
    There is an object 0BALANCE which is not getting populated from the  0EC_PCA_3 Data Source.
    We are able to get only the Cumulated Balances of Periodic Transfer, but unable to get the Balances of all the other Accounts.
    So, can anyone please help me out in getting the Cumulated Balances and Opening Balances of the Account Numbers.
    With regards

    For Delta update
    The extract structure does not contain the BALANCE field. To get the inventory for balance sheet account, 0BALANCE can be filled in BW in den updating rules. For further information, see note 577644.
    Or you can do full load
    http://help.sap.com/saphelp_nw04/helpdata/en/5d/ac7d8082a27b438b026495593821b1/content.htm
    Hope it Helps
    Chetan
    @CP..

  • Problem with business partner cumulative balance

    Hi
    I used to used the business partner balance enqury to quickly tell customers what they were due to pay up to the start of the month. I just looked at the cumulative balance of the last transaction of the previous month and that was it. I know I could run an aged credit report but this was quicker and easier. However since upgrade to 2007A the cumulative balance does not give the amount due for a part paid invoice so this does not work any more.
    Question is has anyone writen a fast query or other report that calculates the cumulative balance based on outstanding amount?
    Thanks in advance
    Derek

    Hi!
    Run this in SAP B1 Query Manager
    SELECT     T0.CARDCODE, MIN(T0.CARDNAME) 'Customer Name', SUM(T0.DOCTOTAL - T0.PAIDTODATE) 'Last Balance'
    FROM        DBO.OINV T0
    WHERE     DOCSTATUS = 'O' AND T0.DOCTOTAL - T0.PAIDTODATE > 1 AND T0.CANCELED = 'N' AND DATEPART(month,T0.DOCDUEDATE) < DATEPART(month,getdate()) AND T0.CARDCODE = '[%1]'
    Group By T0.CARDCODE
    UNION ALL
    SELECT     T0.CARDCODE, MIN(T0.CARDNAME) 'Customer Name', -SUM(T0.DOCTOTAL - T0.PAIDTODATE) 'Last Balance'
    FROM        DBO.ORIN T0
    WHERE     DOCSTATUS = 'O' AND T0.DOCTOTAL - T0.PAIDTODATE > 1 AND T0.CANCELED = 'N' AND DATEPART(month,T0.DOCDUEDATE) < DATEPART(month,getdate())  AND T0.CARDCODE = '[%1]'
    Group By T0.CARDCODE
    ORDER BY T0.CARDCODE

  • Difference between cumulative balance and line items total in FS10N

    hi,
    when I am executing FS10n, I observed that the cumulative balance amount is not equal to line items total .  This is due to some amounts in previous years are varying from the line ltem totals in those periods of previous years.
    This is not happening with QA server only Prdn server is facing this problem.  Can anybody provide me a way to solve this..!?
    Regards,
    AJo
    I have checked the master data for the GL and the check box for line item display is selected. It has not been changed for years.
    Edited by: Anil Jonnalagadda on Oct 22, 2008 10:57 AM

    Hi Anil,
    The reason for the differences that you are viewing can be various. As the differences are found in the cummulative balance then it means that the differences might have occurred in previous fiscal years. The first stetp is to find when these differences were originated: You can run report SAPF190 (in se38) for previous fiscal years, and company code in question- This report should show the differences with message "Errors" in the log. If differences are found then you have to creeate a message and send it to SAP for further analysis and corrections.(only SAP experts can do this kind of corrections - component FI-GL-GL-X)
    Also bear in mind that if you did archiving in previous fiscal years then this would not be an error:
    If you already did archiving and secondary index deletion on this accounts with SAPF048I. So this explains why line items balance and GL summary balance differ ! There is no programm error.
    See consulting note 81489 which describes this issue:
    The balance of an account results from the balance of the open items. In
    connection with an archiving that has been carried out, the line item
    display - used with cleared items - must not therefore be interpreted as
    a balance display. For the balance display, there are separate
    correspond to the display balance of the open items from the line item
    display.
    Having archived and deleted secondary indexes ( with SAPF048I )
    for an account you can not use line item drill down as a balance
    display any more for a line item managed account.
    ( as not all line items are existing any more in table BSIS ! )
    The transactions meant to display the binding balances are  FS10N,
    FK10N and FD10N.
    They also give you the line items details, but only of those line
    items not yet deleted ( by SAPF048I ).
    kind regards,
    Oscar Diaz

  • Wrong Cumulative Balance in SBO 2007

    Dear Experts,
    I open up BP Account Balance, and notice the Cumulative Balance was accumulated with the C/D column (which is the document total for that transaction), instead of accumulating it from the Balance Due column which shows unreconciled balance due.
    I have found SAP Note describing this problem as a definition. But logically, I will think that the term BP Account Balance is suppose to mean the balance due for that BP, instead of total  of every transactions related to this BP (Which the system defines it currently). Can anyone explain to me the idea between this system definition.
    And if nothing can be changed in SAP now, is there a work around to find out the "REAL" cumulative balance due for a BP, that is how much "unreconciled" due balance do they have?
    Please help and advice. Much Thanks!
    Warmest Regards,
    Chinho

    Hi,
    As you are aware that the version 2007 had the option of partial reconciliation which was earlier not available in the 2005 version. Therefore, in 2005 Version, the cumulative balance was displayed as balance due field accumulation.
    However, in version 2007A, due to partial reconciliations being available, the balance due does not display the correct balance, hence the cumulative balance displays the total of the C\D fields.
    The same is the logic and the working which is explained in note no. : 1128828 as well.
    Hope it clarifies.
    Kind Regards,
    Jitin
    SAP Business One Product Support

  • Difference in Cumulative balance amount of ERP and BW query report

    Hi all,
    We have a report to display the Cumulative balance amount based on G/L account.
    The issue we are facing here is, when we check a May month's cumulative balance in ERP side ( using Transaction code FAGLB03 by giving G/L account number, Company code and Year as 2010) we are getting 1000 EUR, and the May month's Balance is 300 EUR.
    When we run our Qury report in BW side for the same conditions( same G/L account, Key due date as 31.05.2010 and same Company code) we are getting the Cumulative Balance as only 900 EUR. we are missing some 100 EUR in our report for our Cumulative balance. But,When I check the Cube on which our Query report runs, I could get the May month's balance as 300 EUR.
    Kindly help me to rectify this issue.
    Thanks.
    Regards,
    Jayaprakash J

    Hi,
    Check is there any restrictions are there . the data must be displayes if the data is there in infocube.
    Regards
    sivaraju

  • Difference in Cumulative balance of ERP and BW

    Hi Experts,
    We have a report to display the Cumulative balance amount based on G/L account.
    The issue we are facing here is, when we check a May month's cumulative balance in ERP side ( using Transaction code FAGLB03 by giving G/L account number, Company code and Year as 2010) we are getting 1000 EUR, and the May month's Balance is 300 EUR.
    When we run our Query report in BW side for the same conditions( same G/L account, Key due date as 31.05.2010 and same Company code) we are getting the Cumulative Balance as only 900 EUR. we are missing some 100 EUR in our report for our Cumulative balance. But,When I check the Cube on which our Query report runs, I could get the May month's balance as 300 EUR.
    Kindly help me to rectify this issue.
    Thanks.
    Regards,
    Jayaprakash J

    The cumulative balance for the GL should be stored in the key figure 0BALANCE in BW
    What is the amount when you do a list cube on this KF ?
    If you don't have the same as in FI-GL, there are several possibilities :
    1) there's a mistake in the extraction flow (transformation)
    2) you didn't update the BW infocube with the latest data

  • Difference in SC and FC cumulative balance

    Hi All,
    After running the conversion difference, there is still a difference between the SC and LC cumulative balance.
    For ex. LC = 0.33 and the SC = 0 .00 (cumulative balance) Is this correct? I can see a value of 0.05 in SC C/D but in cumulative
    balance its hows 0.
    Please let me know.
    Thanks,
    Joseph

    Issue resolved.

  • Cumulative balance - which table?

    Hi there, I am writing a fairly simple query from JDT1, but i can't find the cumulative balance column in either ODJT or JDT1. is it in a different table or is there a formula i should write?
    thanks, my example query is below:
    SELECT T1.[TransId], T1.[Account],  T1.[CreatedBy], T1.[ContraAct], T1.[LineMemo],  T1.[Credit], T1.[Debit], T1.[DebCred], FROM [dbo].[JDT1]  T1 INNER JOIN OJDT T2 ON T1.TransId = T2.TransId WHERE T1.[Account]  = '[%0]' and  T1.[RefDate] between '[%1]' and '[%2]'

    Hello Groovy,
    You can use the word SUM to sum the different values.
    E.g. this sums the values of both credit and debit side and it was used in the query generator:
    SELECT  sum(T0.[Debit]) + sum(T0.[Credit]) FROM JDT1 T0  INNER JOIN OJDT T1 ON T0.TransId = T1.TransId WHERE T1.[TransId]  = '95' group by t1.transid
    or if you want the total of the column you can use:
    select SUM (debit) from jdt1 where transid = 'XXX'
    and it will sum the total of debit for that transid.
    Please, let me know if the information helped you. If not, can you please give us more information about what you need?
    Thank you.
    Marcella Rivi
    SAP Business One Forums Team

  • Cumulative balance (FC) shows **** in GL report by Account

    Hi,
    In the General Ledger report by Account, the cumulative balance (FC) column shows **** when there
    are multiple foreign currency transactions being posted to the GL account.
    Understand that this is a standard system behaviour but is there a way or any workaround to find out how much balance for each foreign currency in the account?
    Besides Export to MS Excel from GL report, please advise any other proposed  solution.
    Thank you in advance.
    Best regards,
    Priscilla

    Hi Thanga Raj.K,
    Thank you for your response and the proposed solution.
    The GL report i am referring to is by Accounts and NOT by Business Partners. Anyway, I agreed with you to write query report to cater for the report limitation.
    Thanks
    Priscilla

  • Report with cumulative balance

    Hi!
    There is a FI report for vendor ledger based on multiple profit center where a column is there for cumulative balance in the output.
    Now when the user makes a subtotal on profit center the output generates based on multiple profit center but in that case the cumulative balance is misarranged and the output appears to be wrong.
    what should I do to generate correct cumulative balance based on profit center.
    thanx
    Amit

    Dear Feroz Dosani.,
    Since your account has been set up as FC, only FC balance can be directly controlled.  The difference between LC Cumulative Balance and the rate conversion come out of the fact: Exchange Rates are changed everyday,  all conversions would be done in posting day rate.  You have to run Exchange rate difference from time to time to reconcile LC.
    Thanks,
    Gordon

  • Cumulative balances from Normal Balances

    Hi experts,
    We have a report requirement as,
    To show vendor "Cumulative" balances fiscal period wise and business area wise. But in the data source
    0fi_ap_7 we have only Cumulative balances Company code wise. There is no business area.
    But suppose if we use 0fi_ap_4, we have business area but we get only normal balances fiscal period wise.
    How to get the cumulative balances from normal balances ?
    Regards,
    Swaroop.

    hello
    chk out these threads..may be useful.
    Accounts receivable on Business Area level
    Re: Getting Cumulative Balances from Cube 0FI_AR_3
    business area
    Regards,
    Dhanya

Maybe you are looking for