cancel
Showing results for 
Search instead for 
Did you mean: 

BEx report should show last four weeks of data in the report

0 Kudos

Hello all,

Report should show the last four weeks of data in the report from the current date. I want to create Customer exits to fulfill this requirement. Did anybody have this requirement in their project and created customer exits for the same in CMOD. Can anybody share me the logic to write a code.

Thanks in advance.

Regards,

Sheetal

Accepted Solutions (0)

Answers (3)

Answers (3)

Loed
Active Contributor
0 Kudos

Hi,

How are you going to determine your last 4 weeks? For example, today is December 21, what dates will the last 4 weeks fall? Also, what infoobject are you going to use? Is it CALDAY or CALWEEK?

Regards,

Loed

kohesco
Active Contributor
0 Kudos

Hi,

normally in your customer exit you will have checks on I_step and I_vnam, depending how it is coded at your side you should implement code like:

data: tempdate type scal-date,
      tempweek type scal-week.
case I_vnam.
when 'yourvariable'. "note your variable is set as interval and not input ready and mandatory
if I_step =2. "mandatory input and empty, non input ready variables
  l_s_range-high = sy-datum. "if the infoobject is a date, not a week
  l_s_range-sign = 'I'.
  l_s_range-opt =  'BT'.

  tempdate = sy-datum - 21 "(if we want the last 4 weeks incl current week)
call function 'DATE_GET_WEEK'
	exporting date = tempdate
	importing week = tempweek.

call function 'WEEK_GET_FIRST_DAY'
	exporting week  =  tempweek
        importing date  =  l_s_range-low.
"if 19/12/2017 is sy-datum and week 51, then first day of week 47 is 27/11/2017, 27.11.2017 - 19.12.2017
  APPEND l_s_range TO e_t_range.
endif.
when others.
endcase.
0 Kudos

Thanks for your solution. I will try to implement it.

erdempekcan
Contributor
0 Kudos

Hi,

Simply use the standard variable 0CWEEK to get the current week and use the offset option to go back 4 weeks.

0 Kudos

In Infoprovider, we are not maping it 0CAL_DAY. that's why i can not use 0CALWEEK.

erdempekcan
Contributor
0 Kudos

So a simple ABAP with DATE_GET_WEEK function is required. However if you don't have 0CALWEEK in your InfoProvider, your output will be in day detail, you will not be able to show the result in weeks.