User Exit on Fiscal Period

Hi all,
I have the following problem:
I have a query where I need to compute the beginning of week and end of week values for certain key figures. Now I need to this analysis over a period of two fiscal years and also this analysis needs to be per fiscal period. So it should be like this:
Fiscal period        BOW KF1     EOWKF2
  001/2006             10         20
  002/2006             20         25
  003/2006             25         30
Notice that the end of week for one period becomes the beginning of week for the next period. I need to create a customer exit variable for this on fiscal period. The customer exit should automatically process all periods from the date the query runs to the first period of last fiscal year (in this example from 001/2005 to today).
Can somebody help me with a sample code? I am struggling with the ABAP code on this. I really would appreciate your help on this.
Thanks,
Ashmith Roy

Here is the sample code for your requirement:
DATA: W_I_T_VAR_RANGE_IN  LIKE RRRANGEEXIT ,
        L_S_RANGE TYPE RSR_S_RANGESID,
        (ZPER, ZYR & ZFISC To be declared).
  CLEAR: W_I_T_VAR_RANGE_IN, L_S_RANGE.
  IF I_STEP = 2.
    READ TABLE I_T_VAR_RANGE WITH KEY VNAM = 'VARIABLE ON 0FISCPER’
              INTO  W_I_T_VAR_RANGE_IN.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
      EXPORTING
        I_DATE               = SY-DATUM
        I_PERIV              = 'Z4'
    IMPORTING
       E_BUPER              = ZPER
       E_GJAHR              = ZYR.
    Concatenate ZYR ZPER into ZFISC.
    L_S_RANGE-LOW =  ZFISC.
    L_S_RANGE-HIGH =  W_I_T_VAR_RANGE_IN-low     
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT  = 'BT'.
    append l_s_range to e_t_range.
  ENDIF.
ENDFUNCTION.

Similar Messages

  • Query with user-exit hierarchy variable and input ready hierarchy node var.

    Hello everyone.
    we are using several hierarchies (2005, 2006 and 2007) of the same info object 0FUNDS_CTR (one for each fiscal year). We would like to be able to use same reports regardless of chosen fiscal year (selected hierarchy) and ever more, to select node inside proper hierarchy. At the moment reports use 3 parameters:
    1) fiscal period from - fiscal period to
    2) hierarchy name
    3) hierarchy node
    Our goal is to get report with only 2 parameters:
    1) fiscal period from - fiscal period to
    2) hierarchy node
    since hierarchy name could be derived (user exit) from fiscal period.
    When user selects hierarchy node he is being asked to select hierarchy name (despite of user exit for hierarchy name) and key date (populated with current date).
    We would like to avoid step of user selecting hierarchy. Is it possible?
    Any other approaches to problem would be appreciated.
    Kind regards,
    Josko.

    Hi Jörg,
    As mentioned, I_STEP = 3 is  processed once per query, not once per varaiable.
    If this statement is placed within case-endcase for I_VNAM it never will be processed.
    Please take a look on this, it might be helpful..
    Regards
    Joe

  • Defining an exit variable for a specific day based on Fiscal Period

    If I do not have Calendar Day time dimension available for reporting is it possible to define a customer exit variable for a specific day.  The days are the first and last day of the financial year?
    Example
    User Input for Fiscal Period: 2009004
    The exit is to define a value for 01.01.2009 and 31.12.2008 (end of last year)
    Thanks

    Hello Niten,
    yes it is possible. Procedure:
    - add a new column in the report structure
    - hide this column
    - create a new text variable in this column (for customer exit)
    - now you can fill this variable during query execution based on 0FISCPER
    You don't want to filter by this variable. Right?
    Buy,
    André

  • Zero values in Periodic Valuation User Exit (EXIT_SAPLKEAB_001)

    Dear All,
    Can anyone give a perspective on the following issue:
    We are using periodic valuation (ke27) and user exit EXIT_SAPLKEAB_001 in order to valuate COGS. There are instances where we have to zero our specific value field COGS for a material for all previous months of the year.The issue is that although we initialize the specific line items in the exit properly, no revaluation postings are made. When, instead of initializing, we give a specific value ( i.e. '0.01' ) the posting is made.
    Kind Regards,
    Orestis

    Hi Dalip !
    Welcome on board !
    "Has anyone figured out how/where step 3 is used ?"
    SURE !!!
    Take a look to https://websmp101.sap-ag.de/bi -> Services & Implementation -> HOW TO... Guides -> Guide List SAP BW 2.x -> How to... Verify the Variable Input
    Hope it helps!
    Bye,
    Roberto
    (and please don't forget to assign points to the answers...it's THE way to say thanks here!)

  • Customer exit code to populate fiscal period for prior three months

    Dear frns,
    I need an ABAP customer exit code to populate prior three month's fiscal period.
    Please update on this...thanks
    Cheers! Shana

    Hi
    Here is the code that will satisfies ur condition.
    CASE I_VNAM.
    IF I_STEP = 2.
    WHEN 'ZVAR1'.
    DATA DATE1 TYPE D.
    DATA PERIOD1 TYPE N.
    DATE1 = SY-DATUM.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'.
    exporting
    l_date = date1
    l_periv = 'v3'
    importing
    E_BUPER = PERIOD2
    E_GJAHR = YEAR2.
    DATA PER3 TYPE N.
    PER3 = PERIOD2 + 1.
    CONCATENATE YEAR2 PERIOD2 INTO FPERLOW.
    DATA LDATE TYPE D.
    LDATE = SY-DATUM + 365.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'.
    exporting
    l_date = LDATE
    l_periv = 'v3'
    importing
    E_BUPER = PERIOD2
    E_GJAHR = YEAR2.
    CONCATENATE YEAR2 PERIOD2 INTO FPERHIGH.
    DATA WA1 LIKE LINE OF E_T_RANGE.
    WA1-LOW = FPERLOW.
    WA1-HIGH = FPERHIGH.
    WA1-SIGN = 'I'.
    WA1-OPT = 'BT'.
    APPEND WA1 TO E_T_RANGE.
    ENDIF.
    Hope u gotit,
    Regard,
    RaviChandra

  • Customer exit code to populate three month's fiscal period

    Dear frns,
    I need an ABAP customer exit code to populate three month's fiscal period.
    Please update on this...thanks
    Cheers! Shana

    Dear,
    Thank u for all replies.
    My requirement is simple.
    Rows:
    Fiscal Year
    Columns
    GR Value
    Filters
    Material Number
    Input Paramters:
    Material No.
    Fiscal Year
    Using customer exit if we populate current fiscal year in the selection screen output be like this....
    FISCAL YEAR    GR Value(in crores)
    2009                     4000
    2008                     3000
    2007                     2000
    2006                     1000
    The cube name Custom Cube ZBBP_C03.
    But I dont have time char 0FISCYEAR in my Cube.In my cube avaiable chars are Calender Year,Calender Year/Month,Calender Year/Quarter,Fiscal Period
    Please let me know if you need any information.
    Waiting for replies,
    Thanks & Regards,
    Praveen.K

  • User exit to calculate Same period Last Year

    Dear gurus,
    can some help me to code the user exit to calculate the same period last year for bex variable
    i.e
    System date :18.05.2010
    Same period last tear : 18.05.2009
    Your help  highly appreciated
    Thank you
    BR

    Hi,
    The above code creates problem only when date is 29th of Feb.
    To find whether year -1 is leap yr or not include following code also:
    l_year = sy-datum(4)-1 .
    l_mod4 = l_year mod 4.
    l_mod100 = l_year mod 100.
    l_mod400 = l_year mod 400.
    if ( l_mod4 = 0 and l_mod100 ne 0 ) or l_mod400 eq 0.
    if( l_date = 29)
    l_date= l_date -1.
    endif.
    endif.
    Modify your code according to youe need. Hope this helps you.
    Thanks,
    Jitender.

  • Error when using SAP Exit Variable for Current Fiscal Period (0FPER)

    Hi Friendz,
    My requirement is to execute a query for the current fiscal period. I am using the SAP Exit Variable 0FPER.
    I placed this variable on char. Fiscal year/period 0FISCPER.
    When I execute the Query, it is returning the error: No value could be determined for variable ZVBSYCUR; Variables Contain Invalid Values.
    Please give inputs on how to use this variable.
    Regards...
    Ganesh

    Hello Dipika,
    I am also getting the same error.
    ERROR: Variable 0FPER could not be replaced.
    Yesterday we created one customer exit. But this should not affect the SAP Exit right? Till yesterday the 0FPER variable was working fine. I tried re-installing from BI content, but still getting the same error. If anybody has a clue please let me know.
    Thanks,
    Harshal

  • Rolling Period User-Exit

    Hi All,
        I have a requirement where I have to populate 11 prior months based on user entered Period and Year. I've created declared 24 customer exit variables ( 12 for month and 12 for year ), upon debugging the user-exit I found that the user-exit populates the values in the variables correctly. But when data is displayed I only get values in my first column ( 1 of 12 ) and all others remain blank. Here is the code snippet for your review. Kindly advice.:
    The following code is only for the periods.
    DATA:P1(3),  " type /BI0/SFISCPER3-FISCPER3
    P(3) TYPE N.
    when 'ZCPOST1' or 'ZCPOST2' or 'ZCPOST3' or
           'ZCPOST4' or 'ZCPOST5' or 'ZCPOST6' or
           'ZCPOST7' or 'ZCPOST8' or 'ZCPOST9' or
           'ZCPOST10' or 'ZCPOST11' or 'ZCPOST12'.
        temp = i_vnam.
        IF I_STEP = 2.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                   WHERE VNAM = 'ZCPOST'.
            p1 = LOC_VAR_RANGE-low.
          endloop.
          case temp.
            when 'ZCPOST1'.
              p1 = p1.
            when 'ZCPOST2'.
              p1 = p1 - 1.
            when 'ZCPOST3'.
              p1 = p1 - 2.
            when 'ZCPOST4'.
              p1 = p1 - 3.
            when 'ZCPOST5'.
              p1 = p1 - 4.
            when 'ZCPOST6'.
              p1 = p1 - 5.
            when 'ZCPOST7'.
              p1 = p1 - 6.
            when 'ZCPOST8'.
              p1 = p1 - 7.
            when 'ZCPOST9'.
              p1 = p1 - 8.
            when 'ZCPOST10'.
              p1 = p1 - 9.
            when 'ZCPOST11'.
              p1 = p1 - 10.
            when 'ZCPOST12'.
              p1 = p1 - 11.
          endcase.
          IF p1 <= 0.
             y = y - 1.
            IF p1 = 0.
              p1 = 12.
            ELSE.
              p1 = 12 - ABS( p1 ).
            ENDIF.
          ENDIF.
          MOVE P1 TO P.
          l_s_range-low = p.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
        endif.
    Regards,
    Srini D

    Thanks for your advice. But here is my problem: I have two selection screen exit variables one for year and one for Period. If the user enters
    005 and 2006, I should be able to calculate the following:
    5,4,3,2,1,12,11,10,9,8,7,6 for periods and the year should roll from 2006 to 2005. That's why I had the user-exit, It calculates fine for the first column but all other columns remain blank.
    Also, I tried your solution:
    When I use fiscalyear/period variable, and use use offsets ( 0, -1, -2 and so on ), only the first column is getting populated and the others are coming out as blank.
    Kindly advice.
    Regards,
    Srini D

  • Customer  exit to get the result in between two fiscal periods

    Hi Guys,
    I have a requirement  to write customer exit, in which i have to get the result for a range of fiscal periods,
    that is in Between   fiscal period1 and fiscal period3,
    and i am getting this Fiscal period from other variable called version in which it consists of combination of fiscalperiod and text
    and now i have filtered the fiscal period and stored in Final_val ( this is an interger), but  how can i use dynamically this Final_val to get the results in between Final_val1 and Final_val3 ( that means if the Final_val is 2008010 then i have to get the results in between 2008011 and 2009001).
    Please provide me the solution, with the possible piece of code

    Hi Diogo,
    Here is the code
    WHEN 'ZC_PVR'.
        DATA: FIN_YEAR(4) TYPE C,
              FIN_DATE(3) TYPE C,
              FIN_VAL(7) TYPE C.
        IF I_STEP = 2.
          READ TABLE I_T_VAR_RANGE INTO LT_VAR_RANGE WITH KEY VNAM = 'ZC_VCS'.
          IF SY-SUBRC EQ 0.
            CONCATENATE '20' LT_VAR_RANGE-LOW+2(2) INTO FIN_YEAR.
            CONCATENATE '0' LT_VAR_RANGE-LOW+4(2) INTO FIN_DATE.
            CONCATENATE FIN_YEAR FIN_DATE INTO FIN_VAL.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW =  FIN_VAL.
            L_S_RANGE-HIGH =  ''.
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT = 'BT'.
            APPEND L_S_RANGE TO E_T_RANGE.
          ENDIF.
        ENDIF.
    which i am using for Filter the fiscal period, after this when i tried to restrict on this "ZC_PVR" vairable and  set the offset like
    zc_pvr 1 to zc-pvr3 under value of ranges, but i am facing an error saying the " variable may be deleted or used incorreclty",
    could u plz suggest

  • Customer Exit for Deriving Current Fiscal Period, Period+1 and Period+2

    Hi all,
    I have created three customer exit variables in my query for custom info object ZFISCPER (Fiscal Year PEriod), Fiscal 1, Fiscal 2 and Fiscal 3. I want to write a customer exit to derive the current period, current 1 and current2 period's respectively for these variables based on the system date. The format of the period is YYYY0MM ( 2009004). Could someone give me the exact code i can plug in CMOD for these
    Thanks a lot
    Rashmi.

    Hi Rashmi,
    I think you need only one customer exit variable. Other can be derived by setting an offset to current Fiscal Period.
    Check the BI content variable for current fiscal period. Use this variable with an offset for derving the other periods (e.g. SAP Exit variables (0FPER, 0FYTCFP, 0FYTLFP). So you have to write no own code...
    Other option is to check how SAP exit is working and building own variable based on this code.
    Check the following link to get information how to do this:
    Reg Variable 0FYTCFP
    Regards
    Andreas

  • User exit to Change Accrual period in revenue  recognition

    Hi All ,
    I have requirement to change the accrual period while revenue posting from VF44 in collective processing from 365 days to static 12 months .
    Need help finding the rigth user exit and approach .
    Thanks in advance
    vinay

    Hi Amuktha ,
    Look s like I have to implement a Bussiness transaction event OUTBOUND_CALL_00503103_E
    the program LVFRR069 , I found below lines
        If accrual period start date and/or end date has been changed
        through userexit 'OUTBOUND_CALL_00503102_E' forecarst lines are
        created in single step mode
          if pif_accpd_start ne lvf_fplt_start or
             pif_accpd_end   ne lvf_fplt_end.
    Need help in implemeting this .
    thanks
    Vinay

  • Option to show values up to last closed fiscal period or up to current date

    Hello,
    How would I create a query that would ask if I want it to calculate values 'up to the current date' or for the 'latest closed fiscal period'.
    Currently I have setup a report, within which, has restricted key figures that will give the 'Period to date', 'Year to Date', and 'Last Year Year to Date' values for some RKFs, however, it would be very helpful if this report could be setup so that the user could choose whether the report provides:
    1. Values only through the last closed fiscal period
    or
    2. Values up to the current date.
    <b>For example</b> if we are in period 7 of 2006, the user could have the report show all values up to the last closed fiscal period, which in this case would be period 6 of 2006.
    Or the user could have the report show all the values up to the current date.
    Hopefully I have been clear,
    Thanks,
    Nick
    Message was edited by:
            Nick Bertz

    Nick,
        What is the problem you are facing? As San mentioned you can only report till Last Fiscal Period using Customer Exit Variables(Calculate Current Fiscal Period using Current Month and Fiscal Year Variant).
    Or as you mentioned you can create restricted Key Figures using Date or month (YTD etc)
    If i miss your requirement, please guide me.
    Regards,
    Nagesh Ganisetti.
    *Assign Points if it helps.

  • Last Closed Fiscal Period

    Hi All
    How can I identify the Last Closed Fiscal Period in a query variable ?
    eg. The current calendar month is Feb which is Fiscal period 11 (Variant is Z3). However Finance still have January open so they want to report YTD figures up to and including December (Fiscal periopd 9).
    I have created a user exit variable (with help from SDN) that works out the YTD range for the fiscal periods but it uses system date to calculate current period. Therefore, the current fiscal period is coming out at 11 but I need 9. When the Month End occurs on Friday the current fiscal month should become 10.
    All help appreciated.
    Asif

    Hi Surender
    I need a variable that does not have any user interaction, and will determine the range of periods that constitute the current fiscal year. The range should start at 1 and end at the last closed fiscal period as maitained on R3.
    I have decided to bite the bullet extract the table T100B from R3. It contains details on all open periods.
    I am trying to load it as master data. Its the first tme I have done this type of work so taking some time.
    I have created the extractor and a characteristic with attributes to hold this info. I then plan to read this data in the variable to work out the range.
    If there is a simpler way to do this then please advise.
    Regards
    Asif

  • Problem with BI-IP and Offsets in Fiscal Period/Year

    Hi freinds,
    I got a request that is linked to BI-IP and Query design.
    The request is that the users should always see a complete year by Fiscal Periods (001.2010...012.2010).
    Now the BI-IP should be dynamic. This means in 007.2010 the user should plan 008.2010...012.2010, the previous month are supposed to be the actuals.
    Problem: I do not want to change the query each month in order to move the planning month. I tried to use an offset with 11 month actuals. Saying "current month/Year", -1,-2,...,-11 using 11 restricted key figures. Same I did for the planning month. I now limited the Data to 2010 in the filter and anywhere I could. However, the result columns are showing all 22 Month. 001.2010...007.2010 are the only once which carry data. all other columns are empty.
    I just do not want to see the columns that do not belong to the current year.
    Any ideas or How to's I can use?
    Thanx and best regards
    Joerg

    Sorry, but I can't imagine how that should work.
    I have two Cubes combined under a Multicube. One containing the Actuals and one for the Forecasts. To show the actuals I have to create a restricted key figure that shows the actuals and for the forecast I have to select differently.
    What is the exit variable supposed to do? I could use a SAP Provided variable to find out about the first month and the actual month, but since it will be a restricted keyfigure it will be shown as sum between the two month. I need for each month of the year a column, and the "open" Month should be input ready. And this should be dynamic.
    Thanks for helping
    Joerg

Maybe you are looking for