Skip to Content
0

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

Dec 19, 2017 at 08:48 AM

78

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Erdem Pekcan Dec 19, 2017 at 11:32 AM
0

Hi,

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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.

0
Koen Hesters Dec 19, 2017 at 12:01 PM
0

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.
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0
Loed Despuig Dec 21, 2017 at 07:03 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded