Skip to Content
0
Former Member
Mar 10, 2013 at 12:45 PM

Regarding Previous Year date range

23 Views

Dear Folks,

My requirement is user will input Posting date range and the report has to show Input posting date range data as well as The same date range of previous year data,

For Ex : if user input is 10/25/2012 - 10/31/2012. Report has to display data of 10/25/2012 - 10/31/2012 in one column and 10/25/2011 - 10/31/2012 in second column.

I have created Filter variable ZVAR_POSTING_DATE on posting date for user input. and i have created restricted key figure AAA and kept key figure xxxx and Posting date info object . Restricting Posting date infoobject with ZVAR_PDATE_PYEAR. Kept two direct key figure xxxx and Restricted keyfigure AAA in columns.

Below is the code i wrote.

WHEN 'ZVAR_PDATE_PYEAR' ."'ZVAR_POSTING_DATE_PYEAR'."for Posting Date Range Previous Year.

LOOP AT i_t_var_range INTO loc_var_range

WHERE vnam = 'ZVAR_POSTING_DATE'.

CLEAR: lv_temp_low,lv_temp_high,lz_year_high,

lz_year_low,lz_day_high .

loc_var_range-low = loc_var_range-low.

loc_var_range-high = loc_var_range-high.

lz_year_low = loc_var_range-low+0(4).

lv_temp_low = loc_var_range-low+4(4).

lz_year_high = loc_var_range-high+0(4).

lv_temp_high = loc_var_range-high+4(4).

lz_year_low = lz_year_low - 1.

lz_year_high = lz_year_high - 1.

CONCATENATE lz_year_low lv_temp_low INTO lz_day.

CONCATENATE lz_year_high lv_temp_high INTO lz_day_high.

l_s_range-low = lz_day.

l_s_range-high = lz_day_high.

l_s_range-sign = 'I'.

l_s_range-opt = 'BT'.

APPEND l_s_range TO e_t_range.

FREE MEMORY ID 'RANGE_YEAR'.

EXPORT e_t_range TO MEMORY ID 'RANGE_YEAR'.

ENDLOOP.

If i run the report i am getting only current data (User input date range Data). Not getting Previous year data. If i run the report in RSRT in the Text Symbols beside to Posting Date Range Previous year it is showing correct value (1 year less than input).

Please help me out where i did mistake and is there any thing wrong in the code. If code is wrong please give the correct code.

Thanks in Advance.