on 06-12-2012 6:21 PM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.