cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Previous Year date range

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

anshu_lilhori
Active Contributor
0 Kudos

Hi,

You need to apply local filters only.If you apply global filter then data gets restricted to that particular range.I think you have applied global filters.

So in columns make two selections and restrict your keyfigure with the two variables.

One will be user entry variable and other will be processed by customer exit.Make sure the variable is of type interval only.

And also try to debug the code to check what values are getting populated this will help you have better understanding on the coding part.

Hope this helps.

Regards,

AL

Former Member
0 Kudos

Thank you so much for quick reply Anshu.

It is working Partially.

i have created two selections with the same key figure. In one selection i have restricted posting date with user input variable. and in another selection i have restricted posting date with both user entry and exit variable.

Is that correct? for P.Year selection both variables required or one is enough

anshu_lilhori
Active Contributor
0 Kudos

Hi,

In second selection just restrict with customer exit variable no need to restrict with user input variable as that is already been taken care in first selection.

Now first selection will be for current based on user input and other one for previous year.

Regards,
AL

Former Member
0 Kudos

Thank you so much once again. Points asaigned.

Answers (0)