Skip to Content
author's profile photo Former Member
Former Member

previous fiscal year

I require previous fiscal year data for some kpi's.I have used standard sap provided customer exit(0FYEAR) and set the offset to -1.Its getting the data from previous fiscal year till date but i require data from previous fiscal year only.how should i proceed?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 13, 2012 at 05:06 AM

    Hi ,

    you have to write previous fiscal year exit .

    Sample P fiscal Code :

    PREVIOUS YR YTD

    WHEN 'ZC00000N5'. " Previous Year Till date
    IF i_step = 2 .


    * LOOP AT i_t_var_range INTO loc_var_range
    * WHERE vnam = 'ZC00000N1'. "USER INPUT KEY DATE
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = 'ZC00000N51'. " USER INPUT KEY DATE (Report Date)
    CLEAR l_s_range.
    v_datef1 = loc_var_range-low .
    v_datef1(4) = loc_var_range-low(4) - 1 .
    v_year_tmp = loc_var_range-low(4) .
    v_year_tmp = v_year_tmp MOD 4 .
    IF v_year_tmp EQ 0 .
    IF loc_var_range-low+4(4) EQ '0229' .
    v_datef1(4) = loc_var_range-low(4) - 1 .
    v_datef1+4(4) = loc_var_range-low+4(2) .
    v_datef1+6(2) = '28' .

    ELSE .
    v_datef1(4) = loc_var_range-low(4) - 1 .
    v_datef1+4(4) = loc_var_range-low+4(4) .
    ENDIF .
    ENDIF .
    * v_datef1+4(4) = loc_var_range-low+4(4) .

    * TO CALCULATE FISCAL PERIOD YEAR .

    CALL FUNCTION 'UMC_CALDAY_TO_FISCPER'
    EXPORTING
    i_periv = 'V3'
    i_calday = v_datef1
    IMPORTING
    e_fiscper = v_per_day
    EXCEPTIONS
    invalid = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    l_s_range-low(4) = v_per_day(4) .
    l_s_range-low+4(4) = '0401' .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_range-high = v_datef1 .
    APPEND l_s_range TO e_t_range.
    ENDLOOP .
    ENDIF.

    Above code based on report Date ( system date -1 ), It can be on system date . code can be changed , as you desire.

    Regards,

    Anand Mehrotra.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 13, 2012 at 10:25 AM

    Hi

    Create a Exit Variable and write the below code under i_step = 2.

    WHEN 'ZFYEAR'.
    CLEAR: l_s_range.

    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    EXPORTING
    i_date = sy-datum
    i_monmit = '00'
    IMPORTING
    e_buper = wa_cur_period
    e_gjahr = wa_fiscal_year.

    l_s_range-low = wa_fiscal_year.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.

    Below code will populate current fiscal year. So please use offset -1 for previous fiscal year.

    I'm doing the same in my current project.

    Regards

    Murthy

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.