on 11-22-2008 10:43 AM
Dear Experts,
I have a Z table with below fields.
Calender Date Merchandising Date
01/01/2008 30/12/2007
02/01/2008 31/12/2007
03/01/2008 01/01/2008
04/01/2008 02/01/2008
I need to calculate the YTD based on merchandising date.
Suppose, if the current system date is 04/01/2008, i need to calculate the merchandising YTD ( i.e sum of 01/01/2008 and 02/01/2008) based on above mapping table.
Can you pls help me with solution ?
Regards,
Srikanth
Hi,
If you want to Display in Report, then use the following code.
the following code : FMYEAR and LNYEAR are the Customer Exit Variables on 0CALMONTH, I have the same requirement, so I did like this, after that you give offset for FMYEAR and LMYEAR. Create New Selections in Columns and then restrict the above key figures with these two variables by using 0CALMONTH. Or You can create Restricted Keyfigures also, but in the both the case you need to give off set values.
Just try this FMs in SE37 then give some input and see what is out put, with this you get some Idea.
DATA : l_s_range TYPE rsr_s_rangesid,
loc_var_range LIKE rrrangeexit,
zbdatj LIKE t009b-bdatj,
zbuper LIKE t009b-poper,
zper LIKE t009b-poper.
First Month Of Current Fiscal year comment
WHEN 'FMYEAR'.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
I_MONMIT = 00
i_periv = 'V3'
IMPORTING
e_buper = zbuper
e_gjahr = zbdatj.
CLEAR: l_s_range.
l_s_range-low+4(2) = '04'.
l_s_range-low+0(4) = zbdatj.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
Using above code you get First Month Of Current Fiscal year , create Restricted KeyFigure and restrict 0CALMONTH with Value Range and give FMYEAY+3; 0CALMONTH. And in the same RKF, take 0CALDAY and give one input Day with variable, here you can pass day value.
Last Month of Current Fiscal year
WHEN 'LMYEAR'.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
I_MONMIT = 00
i_periv = 'V3'
IMPORTING
e_buper = zbuper
e_gjahr = zbdatj.
CLEAR: l_s_range.
l_s_range-low+4(2) = '03'.
l_s_range-low+0(4) = zbdatj + 1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
Thanks
Reddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.