Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 19, 2017 at 11:32 AM

    Hi,

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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Dec 19, 2017 at 12:01 PM

    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.
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 21, 2017 at 07:03 AM

    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

    Add comment
    10|10000 characters needed characters exceeded