Variable for previous ytd
I want cmod code for showing previous year ytd over fiscalperiod.
Scenario 1 : consider today date as feb 2011
if user opens the report it has to show the values for the period April 2009 to March 2010
Scenario 2 : consider today date as may 2011
If the user opens the report it has to show the values for the period Aril 2010 to March 2011
And just explain step by step how and where to paste the code
Create a customer exit variable over your fiscal year period variable . The property of the variable should be : Interval,mandatory and ready for input checkbox should be deslected .
Suppose you Customer exit variable name is : ZFISC_CE.
If i_step = 1 . data: zdate type sy-datum . data:zyear(4) type c, zyear1(4) type c, zmon(2) type c, zfiscper_low type /BI0/OIFISCPER, zfiscper_high type /BI0/OIFISCPER. zdate = sy-datum. zmon = zdate+4(2) . zyear = zdate+0(4). if zmon = 1 or zmon = 2 or zmon = 3 . zyear1 = zyear - 2. concatenate zyear1 '001' into zfiscper_low . concatenate zyear1 '012' into zfiscper_high . elseif zmon = 4 or zmon = 5 or zmon = 6 or zmon = 7 or zmon = 8 or zmon = 9 or zmon = 10 or zmon = 11 or zmon = 12.. zyear1 = zyear - 1. concatenate zyear1 '001' into zfiscper_low . concatenate zyear1 '012' into zfiscper_high . endif. l_t_range-sign = 'I'. l_t_range-opt = 'BT'. l_t_range-low = zfiscper_low . l_t_range-high = zfiscper_high . APPEND l_t_range TO e_t_range. endif.
Hope the above reply was helpful.
Edited by: Ashutosh Singh on May 25, 2011 9:44 AM
Edited by: Ashutosh Singh on May 25, 2011 1:07 PM