Deriving previous Fiscal Period based on current date

Hi All,
I have a requirement wherein I need to derive the previous fiscal period based on the current date. Is there any standard FM to get the same? If not can you let me know if there is any other way of deriving it?
Thanks
Sundar

Hi Srinivas, thanks for your reply. What you have suggested will work fine if I am looking for current fiscal period. I want previous fiscal period. How do I get that?
Thanks
Sundar

Similar Messages

  • Fixed report period based on current date

    I want to create a report containing records over a fixed period without using a date parameter. As a example I would like the report to continually draw on data that is no more than say ten years from the current date.
    E.g. Current date (xx/xx/2008) to (Current date - 10 years) or xx/xx/1998 then next year the formula would automatically adjust to current date (xx/xx/2009) to (Current date - 10 years) or xx/xx/1999.
    I am only a novice when it comes to designing reports so please bear that in mind.

    Hi,
    Create a RecordSelectionFormula and subtract 10 years from the current date with the DateAdd formula.
    E.g.
    //DateAdd (intervalType, nIntervals, startDateTime)
    {Table.Date} > DateAdd ("yyyy", -10, CurrentDate)
    The DateAdd function has more interval types, so you can subtract months, days, hours as well. Check the CR help file and search for DateAdd for details.
    Cheers,
    Fritz

  • Code to derive previous calender month based on System date

    Hi Exerts,
    I have a requirement to derive 0calmonth ( mmm.yyyy ) from System date in the update rule..in BW 3.5
    Can anyone post the code please? We need to consider 1st day of the year tooo..
    Thanks,
    DV
    Please do not dump your ABAP requirements here
    Edited by: Pravender on Mar 16, 2011 5:32 PM

    have a look at function module RSARCH_DATE_CONVERT

  • FM to get previous sunday date based on current date(SY-DATUM)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma

    Hi Kapil,
    You can follow the logic below:
    data:
    l_date like sy-datum, **TODAY
    l_date2 like sy-datum, **Previous Sunday
    data:
    l_daynr like HRVSCHED-DAYNR.
    *Get today's date
    l_date = sy-datum.
    *Gey today's day (Monday, Tuesday, etc.)
    CALL FUNCTION 'HRIQ_GET_DATE_DAYNAME'
    EXPORTING
    langu = 'EN'
    date = l_date
    IMPORTING
    daynr = l_daynr.
    CASE l_daynr.
    *If it is Monday
    WHEN 1.
    -Subtract 2 days for the previous Sunday
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 2
    IMPORTING
    ed_date = l_date2.
    *If it is Tuesday
    WHEN 2.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 3
    IMPORTING
    ed_date = l_date2.
    *If it is Wednesday
    WHEN 3.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 4
    IMPORTING
    ed_date = l_date2.
    *If it is Thursday
    WHEN 4.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 5
    IMPORTING
    ed_date = l_date2.
    *If it is Friday
    WHEN 5.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 6
    IMPORTING
    ed_date = l_date2.
    *If it is Saturday
    WHEN 6.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 7
    IMPORTING
    ed_date = l_date2.
    *If it is Sunday
    WHEN 7.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 8
    IMPORTING
    ed_date = l_date2.
    ENDCASE.
    Regards,
    Dilek

  • FM to get the previous sunday date based on current date(sy-datum)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma
    Moderator Message: Basic date related questions are not allowed
    Edited by: Suhas Saha on Sep 19, 2011 11:39 AM

    Hi,
    There are function modules to find out the current day of the week depending on sy-datum. These are as below:
    1. DATE_COMPUTE_DAY - Returns a number indicating what day of the week the date falls on. e.g. Monday is returned as a 1, Tuesday as 2,...., Sunday as 7.
    2. RH_GET_DATE_DAYNAME  - Returns the day based on the date provided, e.g. Monday, Tuesday,..., Sunday.
    Using any of the above, if you can find out the current day, then you can calculate and compute the date of the previous Sunday.
    My observation is that using the first FM might make the calculation simpler.
    Hope this is of help to you.
    Regards,
    Shayeree

  • How to get fiscal period based on date and Fiscal year?

    Hi Guys,
               Can anybody tell me how to get Fiscal period based on date and Fiscal Year or fiscal year variant?
    Thanks,
    Gopi.

    Hi,
    Please refer the code below:
    *: Report:  ZFISCALYR                                                  :
    *: Date  :  2004                                                       :
    *: Description: Demonstrates how to return the corresponding fiscal    :
    *:              year and posting period for a company code and posting :
    *:              date or posting date and fiscal year variant.          :
    REPORT  zfiscalyr NO STANDARD PAGE HEADING.
    TABLES: ekko.
    PARAMETERS:     p_bukrs TYPE ekko-bukrs,
                    p_bedat TYPE ekko-bedat.
    DATA: gd_fiscalyr  TYPE bapi0002_4-fiscal_year,
          gd_fiscalp   TYPE bapi0002_4-fiscal_period.
    DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
          gd_fiscalp2  TYPE bapi0002_4-fiscal_period.
    DATA: gd_periv     TYPE t009-periv.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * get fiscal year and period - (requires date and company code)
      CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    * Alternative fiscal year function module
    * - (requires date and fiscal year variant code from T009 table)
    * gets first entry in fiscal year variant table (will need to choose
    * correct one from table rather than just using first entry)
      SELECT SINGLE periv
        FROM t009
        INTO gd_periv.
    * get fiscal year and period
      CALL FUNCTION 'DETERMINE_PERIOD'
        EXPORTING
          date                      = p_bedat
    *    PERIOD_IN                 = '000'
          version                   = gd_periv
       IMPORTING
          period                    = gd_fiscalp2
          year                      = gd_fiscalyr2
       EXCEPTIONS
          period_in_not_valid       = 1
          period_not_assigned       = 2
          version_undefined         = 3
          OTHERS                    = 4.
    *END-OF-SELECTION.
    END-OF-SELECTION.
      WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr,
            / 'Fiscal period is:', gd_fiscalp.
      SKIP.
      WRITE:/ 'From function module: DETERMINE_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr2,
            / 'Fiscal period is:', gd_fiscalp2.
    Thanks,
    Sriram Ponna.
    Edited by: Sriram Ponna on Apr 17, 2008 8:59 PM

  • Get Fiscal Period based on Fiscal Year

    Hello Experts,
    I have one query. I wanted to get fiscal period based on fiscal year entered in selection screen.
    I tried to find the FM for it but didn't get it. Can you suggest me any FM which gives in Fiscal period based on fiscal year in FI?
    Regards,
    Neha

    Hi,
    Check the following link:
    How to get fiscal period based on date and Fiscal year?
    http://www.sapdev.co.uk/fmodules/fms_fiscalyr.htm
    Regards,
    Bhaskar

  • To get Fiscal period based on Fiscal Year

    Hi Guys,
               Can anybody tell me how to get Fiscal period based on Fiscal Year?
    Thanks,
    Arpan

    Hi Anshu,
    Have a good day.
    I need to convert fiscal year(2011) to fiscal period(2011001).
    Fiscal year(key field in data source) mapped to the fiscal period(key field in infoprovider).
    But in the transformation when I have mapped these fields, data is not coming propperly into the infoprovider because in the transformation its not converting fiscal year to fiscal period.
    This is the scenario. Please help.
    Thanks,
    Arpan

  • How to suppress a row based on current date -  at query level?

    In an Bex query report i have suppress rows based on current date.
    There is no current date available in query.
    there is a date field in the query.
    If by chance the date in that field is lesser than current date, I have to suppress that row.
    How can this be achieved?

    What is the code ofr creating a variable to get values >= to current date?
    I have implemented the following code which is not working.
    data L_S_range like line of E_T_range[].
    CLEAR L_S_RANGE.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'GE'.
    L_S_RANGE-LOW = SY-DATUM.
    APPEND L_S_RANGE TO E_T_RANGE[].
    Actually i have written in class, which will be inherited in superclass.
    Edited by: akshara20 on Feb 2, 2011 1:21 PM

  • Routine in DTP to load data from previous fiscal period - current

    Hi Friends,
    I want to load data for previous & current fiscal period and I want to write a routine in DTP to automate this process, can any one help me with this routine!
    Thanks & Regards,
    vidiyala

    Hi Bilal,
    We cant create ABAP routine in DTP, instaed we can create in Info package.
    $$ begin of routine - insert your code only below this line -
    data : v_date like sy-datum.
    data : v_new_date like sy-datum.
    data: l_idx like sy-tabix.
    read table l_t_range with key
    fieldname = ' '.
    l_idx = sy-tabix.
    v_date = sy-datum.
    l_t_range-low = v_date+0(6).
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    *anzahl_jahre =
    anzahl_monate = 8
    *anzahl_tage =
    datum_ein = v_date
    IMPORTING
    datum_aus = v_new_date.
    l_s_range-sign = 'BT.
    l_s_range-opt = 'I'.
    if l_idx 0.
    modify l_t_range index l_idx.
    else.
    append l_t_range.
    endif.
    p_subrc = 0.
    $$ end of routine - insert your code only before this line

  • Data changed based on current date  in Bex

    Hi Gurus,
       Hope you are all doing good ! I have a scenario in queries in Bex. When the query is executed the current system date must be captured and the data must be divided by the count of the previous months.
       For instance if the query is executed today the data must be divided by 1 ( for  jan)
       if it is executed next month, then the data muset be divided by 2 ( jan + feb ).
       Is there any COUNT variable in Bex ? Any idea how this could be done?
      Points would be assigned for sure.
    Regards,
    Sunitha.R

    Sunitha,
        You should create a variable which is not user entry and user exit as processing type. Based upon the date entered you should write code in CMOD to derive the figure with which you can divide the amount.
    The logic can be something like this:...
    If the user enters     period like 02.2207(feb 2007), then you can pass value as 2 for the variable newly created. This is a simple code which can be written easily if you have ABAP knowledge.
    Try it out.....

  • Customer exit code for fiscalyear period based on system date

    Hi Experts,
    Please provide customer exit code for fiscalyear period derive based sy-datum. Fiscal year period derivie current to previous 12 periods and current to fast 12 periods.
    Thanks,
    Subbaraju

    Hi Subbaraju,
    Please use below customer exit code for your solution. Please define declarations as per requirement.
    When 'ZFPERIOD'.
    IF I_STEP = 2.
    ztoday = sy-datum.
    zfast = sy-datum + 365.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
      EXPORTING
        i_date               =  ztoday
        i_periv              = 'K4'
    IMPORTING
       E_BUPER              = PERIOD2
       E_GJAHR              = YEAR2.
    CONCATENATE YEAR2 PERIOD2 INTO FISCPERLOW.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
      EXPORTING
        i_date               =  zfast
        i_periv              = 'K4'
    IMPORTING
       E_BUPER              = PERIOD2
       E_GJAHR              = YEAR2.
    CONCATENATE YEAR2 PERIOD2 INTO FISCPERHI.
    L_S_RANGE-LOW = FISCPERLOW.
    L_S_RANGE-HIGH = FISCPERHI.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    Similar code user for your previous periods also.
    Thanks,
    Chandra

  • Adding previous Fiscal Period YTD KF

    Hi Gurus,
    I have data in 2 IC as below:
    IC : Current
    *FiscalPEriod    Amount*      YTD
    2011.01          100               100
    2011.02          100               200
    2011.03          100               300
    2011.04          100               400
    2011.05          100               500
    2011.06          100               600
    2011.07          100               700
    2011.08          100               800
    2011.09          100               900
    2011.10          100              1000
    2011.11          100              1100
    2011.12          100              1200
    2012.01           100               100
    2012.02          100                200
    IC Forecast :
    *Forecast Version     Fiscal Period     Amount*   YTD
    2011.04                 2011.04       200      200
    2011.04                 2011.05        200       400
    2011.04                 2011.06         200           600
    2011.04                 2011.07         200           800
    2011.04                 2011.08      200           1000
    2011.04                 2011.09      200              1200
    2011.04                 2011.10      200           1400
    2011.04                 2011.11      200           1600     
    2011.04                 2011.12      200           1800     
    2011.05                   2011.05     300       300
    2011.05                   2011.06   300         600
    2011.05                   2011.07    300         900
    2011.05                   2011.08      300            1200
    2011.05                   2011.09      300            1500
    2011.05                   2011.10      300            1800
    2011.05                   2011.11      300            2100
    2011.05                   2011.12      300            2400
    2011.05                   2012.01  300       300
    2011.05                   2012.02  300        600
    2011.05                   2012.03      300            900
    2011.05                   2012.04      300            1200
    2011.05                   2012.05      300            1500
    Master Data for Forcaste Version:
    Forecaste Version         FLAG
    2011.04                   Prior
    2011.05                   Current
    Now while creating Query, I need one KF called "Current Forecast YTD", So I need to go to master data and see forecast version against 'Current' and go to forecast cube abd select YTD under that Forcast Version. I did it with the help of Customer exit variable on Forcast Version.  its displaying data as below:
    2011.01    2011.02    2011.03    2011.04   ||   2011.05    2011.06   2011.07   2011.08.......... 2012.01    2012.02   2012.03
                                                        300       600     900        1200             300      600      900
    But I need query output as below:
    2011.01    2011.02    2011.03    2011.04   ||   2011.05    2011.06   2011.07   2011.08.......... 2012.01    2012.02   2012.03
                                                        700       1000     1300        1600             300      600      900
    If you notice 700 = 300 from Forecast IC + 400 from Actuals IC for Fiscal Period 2011.04
    1000 = 600 from forecast IC + 400 from Actuals IC for Fiscal Period 2011.04
    so on..but when new year starts ( 2012)..it will only take data from forecaste IC. So basically we need to add YTD KF of month 2011.04     ( this reference Fiscal Period will be decided from master data) from actuals IC to coming months in forecast IC.
    How can we achieve this?
    Please guide me.
    Regards
    Aman
    Edited by: AmanSharma123 on Jun 22, 2011 8:43 AM

    Hi Rooki Sapbi,
    Thanks again..Seems like this the way to do this, but still one more complexity. My structure of the query is as below:
                                                                    Columns
                                                         |
                                                         |               fiscal year
                                                         |              Fiscalyear Period
                                                         |               KF's
                                                         |             Formula Current Forecast YTD (Formula1)
                                                         |                            |_Actual YTD filtered by FV1
                                                         |                             |_ RKF1
                                                        |
    Rows                                            |
    GL_ACCOUNT
    By you logic, I can get Kyfigure for 2011.04 but which against GL_account? There are many GL_Account, profit centers etc in the Actuals IC, I can find Keyfigure value for Fiscal period 2011.04 with the help of formula Variable, don't i need to provide GL_Account information etc?
    Thanks again for your help. Waiting for your reply!
    Have a good day!
    Regards
    Amandeep

  • PowerShell Script to Delete Files Based on Current Date

    I know by using Get-Date PowerShell will look at the current date.  I would like to make a very basic PS Script which will delete a file older than 8 days based on the current day.  I believe using a if/then function will be necessary. 
    I am very new to scripting so Im not sure how the syntax is written.  All help appreciated.

    Yes, use -Recurse to get subfolders too:
    $Folder = "C:\Users\Me\Backups"
    Get-ChildItem -Path $Folder -Recurse |
    Where { $_.LastWriteTime -lt [DateTime]::Today.AddDays(-8) } |
    Sort LastWriteTime |
    Remove-Item $_ -Force -Confirm:$false
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Last month end date based on current date

    Hi,
    How to show last month end date based on the current date.
    Eg:
    Current date = "08/26/09"
    Var- Last Month End Date = "07/31/09" etc...,
    Please help me how to get it...
    Thank You!

    Good to hear that it worked for you. but not for me.
    I tried like this:
    1st::
    1. var1= ToDate("06/30/09","MM/dd/yyyy")
    2.Var2= RelativeDate([Var1];-DayNumberOfMonth([Var1]))
    result: 5/30/09
    2nd:
    RelativeDate('6/30/2009';-DayNumberOfMonth('6/30/2009'))
    result: 5/30/09
    Am working on SAP OLAP cubes.
    Please help me where am going wrong....
    Thank You!

Maybe you are looking for

  • How to creat a numerical error propagation program

    trying to create a numerical error propagation program

  • External hard drive between mac and pc

    i got a "my passport" external hard drive to load all my stuff onto it from my mac, to be used on our pc. i have to reformat the hard drive for a mac before i can even copy my items on it. but my stupid question is, will it all open up fine on the pc

  • Managing the mail service for WebCenter Spaces

    I need to setup the mail service in WebCenter Spaces and could use some assistance. I have a standalone Linux DEV box that has WebCenter 11.1.1.2 installed. I have Documents, Discussions, wikis+blogs all working in this instance. Now, I need to confi

  • What's about the suddenly extremely long right mouse-click menu?

    Suddenly, since the latest update (20.0.1) my right-click menu is terribly LONG. It's filled with things that seem useful, but are not to be and are not necessary at all. E.g. it contains video-control options, like mute and play, go full screen. Mor

  • Water mark used in error, how can I remove when I export again?

    Hi I have exported some images from lightroom and have used a watermark in error.  When I now go back into LR the images still have the watermark showing in the library and develop screens.  I have made some changes and want to re export them but wit