Financial Periods Helper Method

Hello,
I am looking to create a java helper method to us in my SAO layer of an applciation that I am working on and need a helper method to determine the number of financial periods that 2 dates have. For example, if my start date is 01/01/2006 and the end date is 01/07/2008, then this method should return 3 as an int data type representing the number of financial periods that fall between the start and end date. A financial year starts on 1-Jul and ends 30-Jun.
Thanking you in advance.

Here's a similar example I used for something else:
  DateFormat df1 = new SimpleDateFormat("dd/mm/yyyy");
  Date start = null;
  Date end = null;
  try {
    start = df.parse("01/01/2006");
    end = df.parse("01/07/2008");
  } catch (ParseException e) {
    e.printStackTrace();
  Calendar c = new GregorianCalendar(Locale.getDefault());
  c.setTime(start);
  int numPeriods = 0;
  while (c.getTime().getTime() <= end.getTime()) {
    c.add(Calendar.MONTH, 13);
    numPeriods++;
  }Obviously you'd need to adapt this to your problem, which is a bit more complicated in that you need to check dates in relation to the fin year start / end etc.
- Lance

Similar Messages

  • Removing the Financial Period

    Hello to all,
    This is my 3rd post on this forum for the same Problem.
    I have developed an Add-On Which will ADD/Update the Posting Period to more than 40 Companies at a time, I Know it very well that, there is no method exposed by the SAP B1 for the removal of the Posting Period, but if any undesired posting period gets Added, then it will be very tedious removing  each and every financial period from GUI.
    I.e why i want to remove the financial period any way, if i want to remove the financial period by hitting the database directly, How can i found that the corresponding financial period is being used, as the financial period should not be removed if it is used already in other place.
    *Anyone please help me!!*
    With Regards
    Bikram

    Hi Bikram,
    You can get the list of existing Posting Periods from the OFPR table.
    You can check any document's FinncPriod to check if an Posting Periods was used or not.
    SELECT T0.* FROM [dbo].[OFPR] T0 -- Posting Periods
    SELECT T0.FinncPriod FROM [dbo].[OJDT] T0 -- Journal Entries
    SELECT T0.FinncPriod FROM [dbo].[OINV] T0 -- A/R Invoices
    SELECT T0.FinncPriod FROM [dbo].[ORCT] T0 -- Payment Incoming
    Best Regards.
    Vítor Vieira

  • Updating Financial Periods

    Hello to all,
    i am developing the addon, and i have to update the financial period from my code. i have a  problem in getting the particular finance period from table OFPR and OACP.
    i have the following code, it will update the last record of OACP and OFPR Table, but my problem is that, whatever the user wants to update, he should be able to do so.
                                            SAPbobsCOM.PeriodCategoryParamsCollection oPeriodCategoryColl = null;
                                            SAPbobsCOM.PeriodCategoryParams oPerCategory = null;
                                            SAPbobsCOM.FinancePeriod oFinancePeriod = null;
                                            SAPbobsCOM.FinancePeriods oFinancePeriods = null;
                                            oPeriodCategoryColl = oCompanyService.GetPeriods();
                                                                                    int Count = oPeriodCategoryColl.Count;
                                                for (int i = 0; i < Count; i++)
                                                   if (i == Count - 1)  //this is for updating the last financial period (only for test:)
                                                        //oPerCategory = oPeriodCategoryColl.Item(i);
                                                        oPerCategory = oPeriodCategoryColl.Item(i);  //this will filter out the unique period(for Eg: 2012 (Code)) in OACP(need to find out how?)
                                                        oPeriodCategory = oCompanyService.GetPeriod(oPerCategory);
                                                        //This is for updating the OACP Table
                                                        oPeriodCategory.FinancialYear = Convert.ToInt16(FsclYr);
                                                        oPeriodCategory.BeginningofFinancialYear = Convert.ToDateTime(StartOfFsclYr);
                                                        oCompanyService.UpdatePeriod(oPeriodCategory);
                                                        //This is for updating the OFPR i.e Financial Period
                                                        oFinancePeriods = oCompanyService.GetFinancePeriods(oPerCategory);
                                                        int financeCount = oFinancePeriods.Count;
                                                        for (int j = 0; j < financeCount; j++)
                                                            if (j == oFinancePeriods.Count - 1)  //this is for updating the last financial period (only for test:)
                                                                oFinancePeriod = oFinancePeriods.Item(j);//this will filter out the unique finance period(for Eg: 2012-10(Code)) in OFPR (need to find out how?)
                                                                                    oFinancePeriod.PeriodCode = PeriodCode;
                                                                oFinancePeriod.PeriodName = PeriodName;
                                                                oFinancePeriod.PeriodIndicator = PeriodIndicator;
                                                                oCompanyService.UpdateFinancePeriod(oFinancePeriod);
    Please help me

    Based on the help the
    >Public Sub UpdatePeriod( ByVal pIPeriodCategory As PeriodCategory )
    updates a period category not the period !
    I really do not know a method for updateing periods.
    Regards,
    J.
    Ps:
    You code to locate the period named  "2010-12" .  You can also apply AbsoluteEntry instead of PeriodName  to locate the Period by Abs Entry.
    for (int j = 0; j < financeCount; j++)
        oFinancePeriod = oFinancePeriods.Item(j)
        if (oFinancePeriods.PeriodName = "2010-12") 
            oFinancePeriod.PeriodCode = PeriodCode;
            oFinancePeriod.PeriodName = PeriodName;
            oFinancePeriod.PeriodIndicator = PeriodIndicator;
            oCompanyService.UpdateFinancePeriod(oFinancePeriod);
    Edited by: János Nagy on Mar 1, 2010 4:30 PM

  • Current Financial Period

    Hi,
    I would like to be able to return the current financial period using the DI API. I can return all the periods using the example given in the help documentation but don't know how to identify the current one. Am I missing something obvious?
    Manu thanks
    Adrian North

    Adrian,
    If you're working with UI API 2005, then use
    oCompany.CurrentPeriod()
    to retrieve the currect period.
    If you're working with UI API 2007, then you cannot retrieve the current period has it doesn't apply to SAP Business One 2007A.
    {quote]
    Topic
    Current Period removed.
    Description
    In all SAP Business One versions up to 2005 A SP1, there is 'current period setting indicating the period enabled for data entry and posting. One period only can be set as current.
    From 2006 A, version on all periods will be enabled. Current period setting will be no longer used.
    Impact on Add-Ons
    When add-on will try to read out value from Company.CurrentPeriod, instead of period value, it will receive numeric value '-1'.
    Possible Solution
    Adjust the add-on to not use CurrentPeriod property.
    Object-Property/Method
    Company.CurrentPeriod.
    {quote}
    Regards,
    Vítor Vieira

  • XL-Reporter - Financial Periods specified in row and column selections

    Hello to all,
    again I have no idea how to solve an XLR problem after I tried different ways with unwanted results and after trying to find suggestions in the samples and help files.
    As a result I need a report which looks roughly like this
           2007 2006 2005 ...
    Jan.
    Feb.
    Mar.
    Dec.
    where each cell of the matrix is the total of invoices of a selected customer over the month in the specified year.
    I mainly tried to solve this in two different ways.:
    1.)
    Definition of a parameter for finacial period: name=fp, dimension, type=financial period, attribute=code
    Column selection summary for each year: PER(code=YearAll(@fp)) resp. PER(code=YearAll(@fp-12)) ...
    Row selection expansion: BPA(CardCode=@customer) ARDT(Code=Invoice) PER(PeriodInYear=1:12) Group By PER.PeriodInYear
    In each cell of the matrix the data attribute =ixGet(SO_LineTotal) is specified.
    The cell in the first colum (month) of the matrix is =ixDimGet(PER; PeriodInYear).
    2.)
    No parameter for the financial period is defined;
    Column selection summary for each year: PER(Year=2007) resp. PER(Year=2006) ...
    The rest is the same as in 1.)
    As a result I actually get a matrix with a column for each year and a row for each month, where the first column is 1, 2, ..., 12 (this is OK).
    But for all 12 month I get the same value, which is the (correct) total value for the whole year!
    Where is the failure in my intuition?
    Many thanks for your help!
    Regards,
    Frank Romeni

    I found it works if I don't set the selection to period in the Column and row.   Here are my selections
    Row
    Row 8-9  Expanding
    PER( * )  Group By PER.PeriodInYear
    Row 9 Expanding
    FACT BPA( CardCode = @BPCode ) ARDT( Code = "Invoice" )
    Column
    Column C Expanding
    FACT FIG( SO_TaxDate >= "01/01/2007" ) PER( * )  Group By PER.Year
    then I use a Column total to total the row expansion of the SO_LineTotal  with =SUM( ixRef(C9,2) ) were C9 is the expanding SO_LineTotal.  Then I hide Row 9 in excel to hide the details.
    If you post your email I can send you the IXR report definition
    Dan

  • Function Module to retrieve "Start date of Next financial Period"

    Hi,
    I am doing an accrual financial posting, I would like to know that is there any function module that I can call to retrieve "Start date of Next financial Period" ?
    Thanks.

    Hi,
    Try this below Function Modules
    MC_PERIODE_ZUM_DATUM
    MC_PERIOTAB_BT_FIRST_LASTDAY
    MC_PERIOTAB_TO_DAYTAB
    MC_PERIO_CONVERT_TO_WEEK_MONTH
    MC_PERIO_GET_FIRST_AND_LASTDAY
    Hope it wil helpful.
    Regards,
    Anki Reddy

  • Retrieve "Start date of Next financial Period" and "Current Period"

    Hi,
    T-code: cne5
    I would like to display 2 new fields in cne5 report result:-
    1) Start date of Next financial Period
    2) Current Period
    I can used
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
         EXPORTING
              I_DATE         = SY-DATUM
              I_PERIV        = 'K4'
    But what is I_PERIV ?
    How can I retrieve the above fields value? Any Function Module that I can used?
    Appreciate helps!
    THanks a lot.

    Hi,
    Yes, i_periv is Fiscal Year Variant.
    From running OB37, I can see that V3 and K4 fiscal year variant. Which one should I used when calling the function module DATE_TO_PERIOD_CONVERT?
    Thanks!

  • Option to select different financial periods in report:S_ALR_87100185

    Hi All,
    1) Is it possible to have option to select different financial periods, in report: S_ALR_87100185
    2) Excel download functionality in report : S_ALR_87100185
    Regards,
    Samir Bhadekar

    hi,
    1) all periods are already shown on standard report
    2) GO to report seting of 3CST1 & go to output type tab switch on available on  selection screen, then once you ren report select classic report option & system allow to save from classic view to rquired format
    hope this will help you..
    Reg,
    Sam L.
    Edited by: sam Lesha on Jan 12, 2011 9:15 AM

  • Planning for Next financial period

    Dear all
    I am with a company which had gone live one year back
    I have just joined the CO team.  I want to know how
    we can generate a cost centrewise planning for various
    cost elements ( atleat primary cost elements ) based on
    the LTP run for the next financial period
    FYI  our financial year ends on 31 3 07. We are likely
    to get the sales forecast for 2007-08 sometime by
    mid Jan 07.  Given this input, when PP runs the LTP
    in say End Jan, what should I do to make the system
    compute the cost centre / primary cost element wise
    anticipated planned expenses based on  2007 - 08 sales
    forecast
    Grateful your expert advice
    Thanks and regards
    Murali

    Hello Sumithra,
    Please see below link.
    http://help.sap.com/saphelp_47x200/helpdata/en/08/5149cf43b511d182b30000e829fbfe/frameset.htm
    Reward points if helpful.
    Regards,
    Santosh

  • Primavera P6 - Earned Value/Financial Periods

    I am using a weekly financial period to record earned value and actuals (units) in P6 v7.0 and then reporting on a monthly (made up of whole weeks) period the earned value and actual cost, but am experioencing some odd numbers within my reports.
    For example, on the completion of a task, my reports are generating the following:
    Week 1 Period Earned Value Cost = $2,050
    Week 2 Period Earned Value Cost = ($2,050)
    This doesn't relate to any change in the % complete that would result in a negative earned value - particularly one that is of the same magnitude as the previous week.
    I'm also finding that the financial period data is not consistent over time.  For example, if I generate a report for two months, the data within the weekly periods is not consistent with that generated in previous months:
    Previous report:
    Prior Period Earned Value Cost = $26,000
    Month 1 Period Earned Value Cost = $62,000
    New report:
    Prior Period Earned Value Cost = $26,000
    Month 1 Period Earned Value Cost = $52,000  (which should be $62,000)
    Month 2 Period Earned Value Cost = $25,000  (which shoud lbe $15,000)
    So far, I've been unable to identify the cause of this, but it appears that we're getting some sort of carry over effect between financial periods.
    Does anyone have any ideas what is causing this and how to fix it?  Any help would be greatly appreciated.

    Hi,
    Thank you very much for your quick reply..
    Unfortunately there is no data in the suggested tables (ACTIVITYSPREAD, PROJECTSPREAD) though the values have been posted already (Budgeted values and Earned values) against the projects.
    I request you please suggest, are there any other tables available to search the above data ..? if there please suggest.
    Regards,
    Srikanth.

  • Get Current financial period

    Hi All,
    I have used following code to get current financial period:
    SAPbouiCOM.Company company = oApplication.Company;
                    int Period = company.CurrentPeriod;
                    SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService();
                    SAPbobsCOM.FinancePeriodParams diPeriodParams = (SAPbobsCOM.FinancePeriodParams)oCompanyService.GetDataInterface(SAPbobsCOM.CompanyServiceDataInterfaces.csdiFinancePeriodParams);
                    diPeriodParams.AbsoluteEntry = Period;
                    SAPbobsCOM.FinancePeriod finPeriod = oCompanyService.GetFinancePeriod(diPeriodParams);
    But iam gettng error "No Matching records found".

    Hi Pravin,
    2007 onward the company.CurrentPeriod is not available . It always returns -1, so you are getting the above error.
    The other way to get the current period is through query :
    select code, name from ofpr where f_refdate <= getdate() and t_refdate >= getdate()
    Hope it helps.
    Regards

  • How to configure the last day of 4-4-5 Financial Period

    Hi,
    Given a 4-4-5 financial calendar as below, the 31-12-2010 posting date will not be mapped into any of the periods since the last date on this calendar is 30th December. Hence how can we map the last date of 31st december into a 4-4-5 financial period?
    Begin Date     |     End Date             |   Days     |   Period
    1-Jan-2010     |     28-Jan-2010     |     28     |     1
    29-Jan-2010     |     25-Feb-2010     |     28     |     2
    26-Feb-2010     |     1-Apr-2010     |     35     |     3
    2-Apr-2010     |     29-Apr-2010     |     28     |     4
    30-Apr-2010     |     27-May-2010     |     28     |     5
    28-May-2010     |     1-Jul-2010     |     35     |     6
    2-Jul-2010     |     29-Jul-2010     |     28     |     7
    30-Jul-2010     |     26-Aug-2010     |     28     |     8
    27-Aug-2010     |     30-Sep-2010     |     35     |     9
    1-Oct-2010     |     28-Oct-2010     |     28     |     10
    29-Oct-2010     |     25-Nov-2010     |     28     |     11
    26-Nov-2010     |     30-Dec-2010     |     35     |     12
    Edited by: FICO Consultant on Feb 1, 2011 10:24 AM

    T549S contains the payroll periods with pay date.  T549Q contains the begin and end dates of the payroll period.
    You can select from the appropriate table (or from both depending on your given data) to get the end date of the period.
    Hope that helps.
    Mary

  • Closing a production order in the previous financial period.

    Hello All,
    I am hoping somebody can help me with a Production order question.  We have recently upgraded to SBO 2005a SP18, I know, just catching up… 
    we have an issue when closing Production Orders at the end of the financial period.   Assume that the period end is on the Sunday (end of period 2), The production from the Friday does not get booked into the system until the Monday morning (next period, period 3). 
    We can adjust the date of the production receipts and bookings on the Monday morning to show as a posting date of the Friday (period 2) but when we close the production order the there seems to be no way of closing it in the previous period (period 2), the transactions get posted in the current period.
    We have played with the changing the periods but our testing so far has been without success.
    Many thanks,
    Mike

    Suda,
    Using standard SAP when we create a standard Prod order, say for 100 units.  The status is defaulted to planned. we then change the status to released.  once released we have an addon that we use to book production. 
    The addon uses the production receipt and issue as well as other stock positngs all against the production order.  At any point in time we can see how many units have been completed and what componenents have been issued against an order.
    once the order is complete we change the staus manually from released to closed. this process then generated a whole bag of journal entries.  It is these journal entries I need in the previous period if I am in to the new period.
    Our SAP parteners say that the only way to do this with the addon is to reverse all of the journals created when closing the Prod order and re-create them in previous period but this would be a significant cost to us.
    Thanks,
    Mike

  • Periodic Extract Method

    Hi People,
    I'm customizing the EC-CS and I need to use the Periodic Extract Method for one company, the problem is that I don't know what to do it, I always customized Real Time Update method. If case someone has documentation about it and could send me I will  appreciate.
    Thanks,

    Hi Dan, 
    I read the documentation from SAP, and I also customized the system but when I perform the report RFBILA00 and try to create a file in presentation server but the system doesn't create the file, I don't know if be missing anything. Could you give a help?

  • Task hierarchy - period specific methods.

    Dear Experts,
    We have two data collection (flexi upload )methods one is specific to non quarter period & another is specific for Quarterly periods &  I want to assign period specific methods for a task. If this task is executed in non quarter months it need to pick non quarter flexi method Like for non quarter periods 1,2,4,5,7,8,10,11and for quarterly periods like 3,6,9,12 another method 
    Is there any possibility?
    Please advice.
    Thanks
    Kamal

    Hi,
    I agree with Gregoire.
    Some more information that can be helpful:
    1. Create period category gruop e.g. 10 - 'Months&Quarters'
    2. In this period category gruop create two period category e.g. 101 - 'Month other than quarter' and 102 - Quarter other than month'
    3. For period category 101 set checkboxes for periods 1,2,4,5,7,8,10,11 and for period category 102 periods 3,6,9,12
    4. Create one consolidation frequency, e.g. 500 - All months (for all period 1-12)
    5. Create one task and assign cons. frequency. Choose period category 101 and assign data collection method for this periods then choose period category 102 and assign data collection method for quarters.
    6. Save your changes
    It usually works without problems.
    I hope this helps.
    Pawel

Maybe you are looking for

  • How to Install Sims 3 on a MacBook Pro?

    How do I install Sims 3 on my MacBook Pro? When I put the disk in, it spins and then stops. The sims doesn't show up on my desktop. What should I do?

  • Hard Drive Clicking

    I've noticed recently that my MacBook hard drive makes a very soft clicking noise at random intervals. Sometimes the clicks are seconds apart, sometimes minutes, and sometimes they don't occur at all. I only hear it when I'm working on the computer l

  • Buying in-app games when unable to connect iPod touch to internet?

    I have mobile broadband and I would like to download an in-app game for my commodore 64 simulator, can I do this without downloading it directly through the app, ie. if I connect to the iTunes store and have my mac connected to the internet?

  • When im creating PO using MIGO

    Hi,Gurus.. When im creating PO using MIGO . im getting error Document number 6000000455 not within defined interval. can any one help me.. thnx in advace.

  • Tracker 0.8.3 and file content indexing

    Hi forum, yesterday I decided to reinstall meta tracker for indexing my system but I had some problems: I don't need to index file contents, I just want to index file names and the possibility to tag files. But in the tracker config dialog there isn'