Need to derive fiscal year from 0P_FPER

Hello,
I have a number of queries that are used to report amounts for a given period and also a YTD amount and a rolling 12 month amount.  I would like to be able to have the user pass just one variable, 0P_FPER, and then derive the fiscal year from 0P_FPER to find the YTD amounts.  I am fairly certain that I will need a user exit variable to do this but have never written one before.  Can someone help out with code that will use the value passed by the user from 0P_FPER to find the fiscal year?
Thank you.

Hi Derrick,
Please proceede as follows:
1. Go to CMOD
2. Create a project (enter any name & provide the description)
3. select enhancements.
4. Select enhancement RSR00001.
5. Save & Double click on enhancement.
6. An include will be there, double click on that, warning will occur,enter .
7. Editor will open.
8. Place the below code:
DATA : wa_range   TYPE rrrangesid.
     CASE i_step.
  WHEN 1.
    RAISE no_processing.
  WHEN 2.
    CASE i_vnam.
      WHEN 'VAR_1'.
        READ TABLE i_t_var_range INTO wa_value WITH KEY vnam = '0P_FPER_VAR'.
          wa_range-low    = wa_value-low+4.
          wa_range-opt    = 'EQ'.
          wa_range-sign   = 'I'.
          APPEND wa_range TO e_t_range.
endcase.
endcase.
In the above code :
VAR_1 is the variable for which you are writting the customer code.
0P_FPER_VAR : This is the variable based on 0P_FPER.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
Hope this helps.
Thanks !

Similar Messages

  • Derive fiscal year

    hello
    i have a field called BUDAT (posting date) and i need to derive the fiscal year from this date. Can you help me. I am not very familiar with abap so please help me write the code for it. I found a FM called GM_GET_FISCAL_YEAR but i am not sure how to use it.
    thanks
    Laura.

    Fiscal year (and variant) is about FI concept.
    To translate from calendarday to fiscal year and fiscal year / period you need the formula in update rules:
    DATE_FISCPER3
    DATE_FISCPER
    DATE_FISCYEAR
    ... and others.
    But you need the fiscal year variant! It is normally mantained in administration (FI) of your ERP source system in customizing and transferred in BW.
    In BW you can see the variant by customizing (SPRO):
    SAP Netweaver\SAP Business Information W\Mantain fiscal Year variant

  • How to calulate previous fiscal year from current year and periods as input

    hi all,
    i have a report where i have 2 select options as year and period.
    my period can be a range  like( Ex: 1 to 6).
    i like to know previous fiscal year from the following inputs.
    Tel me a suitable conversion routine to calculate
    depending on periods and fiscal year.
    regards
    sivaram.

    Hi
    U need to check the lower period, if it's 1 the previous fyscal year will be the year before:
    IF PERIOD = '1'.
      PREV_YEAR = YEAR - 1.
    ENDIF.
    U can also use the fm FI_PERIOD_DETERMINE, in this case you need a date, u can get it from lower current period:
    Get the first day of the period
    BUDAT(4)   = YEAR.
    BUDAT+4(2) = PERIDO_LOW.
    BUDAT+6(2) = '01'.
    Now get the last day of the previous month:
    BUDAT = BUDAT - 1.
    Use this date to get its period by fm FI_PERIOD_DETERMINE
    Max

  • Delete old Fiscal variant / Fiscal Periods / Fiscal Year from the BW

    Hi
    When initially Loading data we had different fiscal variant for each source system.
    This was found not to be correct and after the initial load we reloaded the same data with a common fiscal variant across source systems.
    Now the problem we have on hand is that we do not want the old Fiscal variant / Fiscal Periods / Fiscal Year to show up in the F4 pop up.
    Is there a way to delete these old Fiscal variant / Fiscal Periods / Fiscal Year from the BW System.
    regards

    Hi,
    Go to your infoprovider, select the required characteristic and in the Infoprovider specific properties under the F4 values for filter option, you can choose "Only values from infoprovider data".
    Just check if this option is available with time characteristics or not.
    Regards,
    Durgesh.

  • How to derive month/year from date in SAP BW 3.5 data flow

    Hi
    How we can derive cal year/month and fiscal month/year from date in SAP BW 3.5 data flow (we're using transfer and update rule)..
    Thanks,
    PK

    Hi,
    if you have any date filed in source side you can just map to any time char system will automatically convert to target objects.
    please look at the screen shot for understanding. (not 3.x it is 7.x)
    Thanks,
    Phani.

  • How can i derive 0calender year from ZBUDQUART

    hi friends
    i have ZBUDQUART, for example its value is 200402,  that means i juat have year and month.
    now from this how can i derive 0calender year.
    thanks and regards
    sampath

    Hi,
    If ZBUDQUART is following exactly calendar year, then just write the following logic in the 0calender year update rule.
    RESULT = COMM_STRUCTURE-ZBUDQUART+0(4).
    hope it helps...
    regards,
    raju

  • FISCAL year from Date  in the Selection Screen.

    Hi Folks,
    Is there any function module which returns the Fiscal year if we provide the date in ranges.
    I mean, I have a select option for date in the selection screen.So,if a user enters the date say 01042007 01042007 it should return the corresponding fiscal year.
    Kindly let me know if anyone here has any idea regarding this.
    Thanks,
    K.Kiran.

    Hello,
    Check these FM's
    FTIS
    FTI_FISCAL_YEAR_MONTH_GET
    KBPA                           Budget/Plan - application-specific
    KBPA_GET_START_FISCAL_YEAR     Determine Start Year for Funds Management
    KBPA_GET_START_FISCAL_YEAR_OPT
    Vasanth

  • Fiscal YearDeriving from Current System Date

    Hi Experts,
    As per my requirement i need to derive fiscal year.
    My client financial year is 2011-the year starts from July -2010  and ends on June 2011.
    Could you pelase let me know how can i start the code in CMOD as i am not femiliar with ABAP code.
    ANy sample code would be great appreciated.
    Thanks in advance.
    Regards,
    Talluri
    Edited by: Talluribi on Jul 12, 2010 5:22 AM
    Edited by: Talluribi on Jul 12, 2010 5:23 AM

    Hi,
    UMC_CALYEAR_TO_FISCPER
    I_PERIV                           =    V3
    I_CALYEAR                    =     2010
    If you use above FM and give the inputs like above V3 as per Indian Period, and normal Year 2010, in the same way you give as per your Client Country and then execute in SE37 and you can find 12 Entries, here take First and Last Entry and use that in Report, you need to use Customer Exits for this.
    You need some ABAP code to declare and take the values from above FM.
    For Customer Exits See..
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    Thanks
    Reddy

  • Should Fiscal Year be derived from posting date for sales stat cube

    Greetings,
    Is it common to derive FY from posting date of the invoice for the sales stat cube.  We have the standard SAP datasource 0UC_SALES_STATS_02 to extract billing information from ECC.  On the BI side, the FY is derived from posting date in the transformation before it reaches the target (i.e. cube).  Is this derivation common
    Thank you in advance for your response.
    Behnaz

    Hi,
    You can derive the Fiscal Year from the posting period and it not uncommon to see this.
    Reg,
    Rahul

  • Determine 3 year old fiscal date from today's date

    I have a requirement where I need to find  fiscal date from current calendar month/getdate. Our fiscal year starts from October and ends on Sept30. Also, I only want what will be fiscal date which is older than 36 fiscal month from todays date. 
     For example:
    If I calculate today It should return like that:
    Oct 2014 - Feb  2015 = 5months
    Oct 2013 - Sept30 2014 = 12months
    Oct 2012 - Sept30 2013 = 12months
    March 2011 - Sept30 2012 = 7months 
    Total #fiscal months=36 or 3 fiscal years
    Resultset should look like that:
    '2011-03-09'
    Thanks in advance!
    ZK

    For the first of your request, meaning getting difference between Specific month and either first day of fiscal year or last day of fiscal year, you can use a table that will hold your fiscal year information and a query like below:
    DECLARE @UserRequestedDate DATE
    DECLARE @FiscalInfo TABLE (FiscalYear SMALLINT, StartDate DATE, EndDate DATE)
    INSERT INTO @FiscalInfo
    SELECT 2010, '10/01/2009', '09/30/2010' UNION ALL
    SELECT 2011, '10/01/2010', '09/30/2011' UNION ALL
    SELECT 2012, '10/01/2011', '09/30/2012' UNION ALL
    SELECT 2013, '10/01/2012', '09/30/2013' UNION ALL
    SELECT 2014, '10/01/2013', '09/30/2014' UNION ALL
    SELECT 2015, '10/01/2014', '09/30/2015'
    SELECT
    ,@UserRequestedDate
    ,DATEDIFF(MONTH, StartDate, @UserRequestedDate) + 1 AS MonthsPassedFromFiscalYear
    ,DATEDIFF(MONTH, @UserRequestedDate, EndDate) + 1 AS MonthsPassedFromFiscalYear
    FROM
    @FiscalInfo
    WHERE
    @UserRequestedDate BETWEEN StartDate AND EndDate
    Which with your samples would be:
    SET @UserRequestedDate = CURRENT_TIMESTAMP
    SELECT
    ,@UserRequestedDate
    ,DATEDIFF(MONTH, StartDate, @UserRequestedDate) + 1 AS MonthsPassedFromFiscalYear
    ,DATEDIFF(MONTH, @UserRequestedDate, EndDate) + 1 AS MonthsPassedFromFiscalYear
    FROM
    @FiscalInfo
    WHERE
    @UserRequestedDate BETWEEN StartDate AND EndDate
    SET @UserRequestedDate = '03/01/2011'
    SELECT
    ,@UserRequestedDate
    ,DATEDIFF(MONTH, StartDate, @UserRequestedDate) + 1 AS MonthsPassedFromFiscalYear
    ,DATEDIFF(MONTH, @UserRequestedDate, EndDate) + 1 AS MonthsPassedFromFiscalYear
    FROM
    @FiscalInfo
    WHERE
    @UserRequestedDate BETWEEN StartDate AND EndDate
    And output would be:
    FiscalYear StartDate
    EndDate (No column name)
    MonthsPassedFromFiscalYear
    MonthsPassedFromFiscalYear
    2015 2014-10-01
    2015-09-30
    2015-02-09 5
    8
    FiscalYear StartDate
    EndDate (No column name)
    MonthsPassedFromFiscalYear
    MonthsPassedFromFiscalYear
    2011 2010-10-01
    2011-09-30
    2011-03-01 6
    7
    And for your second request, something like below may help you
    DECLARE @UserRequestedMonthNo TINYINT = 36
    SELECT DATEADD(MONTH, 1, DATEADD(MONTH, @UserRequestedMonthNo * (-1), CURRENT_TIMESTAMP))
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • Derivve fiscal year

    hello
    i have a field called BUDAT (posting date) and i need to derive the fiscal year from this date. Can you help me. I am not very familiar with abap so please help me write the code for it. I found a FM called GM_GET_FISCAL_YEAR but i am not sure how to use it.
    thanks
    Laura.

    Hi,
    try this,
    U can Use this Function module to get the Fiscal year..
    *function module used to determine current fiscal year and period
    CALL FUNCTION '/BEV3/CHPERIOD_DETERMINE'
    EXPORTING
    date = sy-datum
    version = c_version
    IMPORTING
    period = l_period
    year = l_fiscal_year
    EXCEPTIONS
    period_in_not_valid = 1
    period_not_assigned = 2
    version_undefined = 3
    OTHERS = 4.
    If not use GM_GET_FISCAL_YEAR
    CALL FUNCTION 'GET_CURRENT_YEAR'
    EXPORTING
    BUKRS = '1000' " Company Code
    DATE = SY-DATUM " Date to find fiscal year for
    IMPORTING
    CURRM = w_currm " Current Fiscal Month
    CURRY = w_curry " Current Fiscal Year
    PREVM = w_prevm " Previous Fiscal Month
    PREVY = w_prevy. " Previous Fiscal Year
    Regards,
    Anver
    if helped pls mark points

  • What is the difference between Fiscal year variant, Fiscal year and Calyear

    hi,,
    What is the difference between
    1. Fiscal Year Variant (0FISCVARNT)
    2. Fiscal Year (0FISCYEAR)
    3. Calendar Year (0CALYEAR)
    In what scenarios they should be used. If we are getting 0FISCVARNT data from ODS. Can we change into other in cube at update rules level or some other level?
    How can we get factory calendar????
    Message was edited by:
            Avneet M

    Hi Gurus
    I was going through this thread and came up some more questions in my mind.
    1. Do we need to set Fiscal Year, Fiscal Varient settings once for all in BW ? ( The path is given in one of the thread above ) need to know if this is one time setting / rebuilding the tables. what will happen when we select and execute factory calender and Fiscal Varient and Rebuild tables in transfer global setting ? Is this one time we have to do for whole BW system?
    2. when we go to SCAL t-code what we need to do and what it do in the system ? I know its for Factory calender but just want to know what it does. It it also for one time during BW build phase ?
    3. How can we link Factory calender and Fiscal year? IS it thro Fiscal varient ?
    Pl help me to clear this doubt,thanks in advance.

  • Date range using Fiscal Year

    Hi,
    Please tell me the function module to get this data.
    My input is Fiscal Year -2008(for eg).
    I need the output with
              f_day = 01.04.2008
              l_day = 31.03.2009
    How to get this?

    Hi,
    I think SAP considers fiscal year from 01.01.2008 to 31.12.2008
    And FM for this is 'HR_E_GET_FISC_YEAR_DATES'
    So what u can do this is create an Z-FM and paste code as in Standard FM which is given above
    In code the changes will be
       FISC_FECINI = FISC_YEAR.
       FISC_FECINI+4(4) = '0401'.
       FISC_FECFIN = FISC_YEAR.
       FISC_FECFIN+4(4) = '0331'.
    Let me know further.
    Cheers,
    Parth Parikh

  • Urgent!Fiscal Year Changes !

    Hi All
    Does anyone has implemented the changes for the Fiscal Year from Calendar Year Jan-Dec 2011 to Apr 2011 - Mar 2011
    So in my case now I need to show the reports for 2011 as Jan 2011 - Mar 2012.
    for 2012, Apr 2012- Mar 2013.
    Any ideas are highly appreciable. very urgent.
    so how my month and year report retrival changes... to be done?
    what are the precautions?
    Thanks for your suggestions.

    Hi,
    I do not know about the fiscal year variant way as it means you would need to customize and I am not sure if its possible to do what you want but since I am not an expert on that matter please rely on other posters.
    Regarding the ABAP way:
    1) create a variable on 0FISCYEAR that the user needs to fill, for example ZVAR_FISCYEAR. Use it in query but not on relevant keyfigures. It needs to pop up on selection screen but should restrict some dummy.
    2) create a variable on 0CALMONTH that is processed by user exit, for example ZVAR_CALMONTH. Make sure it is an interval
    3) go to the user exit relevant for bex reporting (please do investigate yourself also as this is covered in lots of topics)
    4) create logic that whenever user fills in 2011 in ZVAR_FISCYEAR the ZVAR_CALMONTH variable is filled as needed
    Small example:
      WHEN 'ZVAR_CALMONTH'.
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'ZVAR_FISCYEAR'.
            CLEAR l_s_range.
            l_s_range-low(4)   = loc_var_range-low(4).
    IF l_s_range-low(4) = '2011'.
            l_s_range-low+4(2)  = '01'.
            l_s_range-high(4) = '2012'.
            l_s_range-low+4(2)  = '05'.
    ELSEIF
    l_s_range-low(4) = '2012'.
            l_s_range-low+4(2)  = '04'.
            l_s_range-high(4) = '2013'.
            l_s_range-low+4(2)  = '03'.
    ENDIF.
            l_s_range-sign     = 'I'.
            l_s_range-opt      = 'BT'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    5) restrict the relevant keyfigures in your query on 0CALMONTH with as range ZVAR_CALMONTH
    Please not I am not an diehard abapper nor do i have access to a system to test now so please share thoughts if the above is incorrect, usually i need one or two fixes before it works
    hope it at least gave you the right direction.
    C.

  • Data selection Fiscal year/period in info package

    Hi Experts,
    I loaded the data from application server to my data target and load completed with lot of records, but as per my requirment i need to load Fiscal year/period 001/2010 to 012/2010. I just giving selection in info package like 001/2010 to 012/2010  and i excute load it sowes no records, make sure in application server we have lot of records for this period.
    CAn any one tell me how can i give format in infopackage.
    Thanks in advance
    David

    Hi,
    Select range in correct format. Instead of giving manually, You can select from system. This can be wrong format of selection.
    Thanks,
    SAC

Maybe you are looking for

  • Hide button in ribbon bar in dispform.aspx

    Is there any way to hide or remove the "Edit Item" button in the ribbon bar of the dispform.aspx in a single list? I know that giving the user "read only" permission would grey out the button but this is not the intended approach. Hiding the complete

  • Library - maximum size?

    I've had a problem with my MacBook Pro for a long time - the dreaded spinning wheel comes on often and sometimes it takes up to 30 seconds to go away. Plus, I will crash in iTunes every so often. The song just stops playing. I'll still be able to acc

  • Missing pdf viewer add in

    Updated to Yosemite recently and I know this features worked since the update... but of the life of me, I can't view or download pdf files in safari. I looked and pdf viewer file is missing from the plug ins subdirectory. Restarting the machine has f

  • How to develop and Run .jsp page from Jdeveloper 10g

    Dear All, I need to develop one small JSP page using Jdeveloper10g. pls share information How to develop and Run .jsp page from Jdeveloper 10g. Thanks in Advance, Hanimi.

  • Oracle Resource Manager

    hi, In the GROUP section of the ubb file I have defined a Oracle Resource Manager. GRP1 LMID = SITE1 GRPNO =1 TMSNAME = TMS_ORA TMSCOUNT = 2 OPENINFO = "Oracle_XA:Oracle_XA+Acc=P/usr1/usr1+SesTm=0+LogDir=/tmp/xa_logs+Objects=T+Loose_Coupling=false+Se