Skip to Content
avatar image
Former Member

Weekly Avarage Report.

Hi Guru,

I have 5 Weekly moving Average report with 2013 ,2014 data.

user will enter the week based on that week we need -4-3-2-1 like 5 and also we are calculating average.

but only we are getting which ever the selection i used.

ex :  24.2013 if i select  then it display 24,23,22,21,20 of that 2013 year week only

but our requirement is to display both the year how it is achieve please help me out.

Regards

Praveen.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Jan 13, 2015 at 09:15 AM

    Dear Praveen,

    I think the requirement is to get average for 5 weeks of both 2013 and 2014 combined.

    Hope you have both Cal week and year in your data target. You can create two selection at the query one for 2013 and one for 2014. Add these to selection in a formula and divide them with 10.

    Regards

    Gajesh

    Add comment
    10|10000 characters needed characters exceeded

    • DATA: LV_YEAR TYPE /BI0/OIFISCYEAR.

      DATA: LV_WEEK TYPE /BI0/OICALWEEK.

      DATA: LV_ZWEEK TYPE /BI0/OIFISCYEAR.

      DATA: LV_YEAR TYPE /BI0/OIFISCYEAR.
      DATA: LV_PYEAR TYPE /BI0/OIFISCYEAR.

      DATA: LS_VAR_RANGE TYPE  RRRANGEEXIT.
      DATA: LS_OUT_RANGE TYPE RRRANGESID.

      DATA: LV_WEEK TYPE /BI0/OICALMONTH2.

      WHEN 'variable name'. ( new variable )

      IF I_Step = 2.

      READ TABLE I_T_VAR_RANGE INTO LS_VAR_RANGE

          WITH KEY VNAM = 'ZWEEK'.


          IF SY-SUBRC = 0.

            LV_YEAR = LS_VAR_RANGE-LOW+0(4).

           LV_WEEK =  LS_VAR_RANGE-LOW+4(2).

           LV_PYEAR = LV_YEAR-1.

            CONCATENATE LV_PYEAR  LV_WEEK INTO LV_ZWEEK.

            LS_OUT_RANGE-LOW = LV_ZWEEK.

            LS_OUT_RANGE-SIGN = 'I'.

            LS_OUT_RANGE-OPT = 'EQ'.

            APPEND LS_OUT_RANGE TO LT_OUT_RANGE.

            E_T_RANGE = LT_OUT_RANGE.

          ENDIF.

      Regards

      Gajesh

  • avatar image
    Former Member
    Jan 14, 2015 at 07:07 AM

    Hi Praveen,

    I did not get your requirement Can you tell us brief with an example...

    Regards,

    Santu.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Santosh,

      Am not a abaper, could you please give me a code so that i can use that code to get previous year week.

      Regards

      Praveen

  • Jan 14, 2015 at 07:19 AM

    Hi Praveen,

    I assume tht you have the CALDAY in you Cube/MP/Query.

    Create a Var on Calyday and u wll get 14.01.2015.

    Make this Date as 14.01..2014

    Pass this date to FM DATE_GET_WEEK and this will give you 201403 (Current Week).

    Do Offset for 201403 with -5  with Range...

    I hope this gives an idea.

    rgds

    SVU

    Add comment
    10|10000 characters needed characters exceeded

    • Then Praveen you can use FM WEEK_GET_FIRST_DAY to get the First day of the Week.

      Pass 201503 and you will get 13.01.2015 and from there make this as 13.01.2014 and get the Calweek.

      rgds

      SVU

  • avatar image
    Former Member
    Jan 14, 2015 at 08:55 AM

    Hi Praveen,

    Refer to my previous comment, it will work.

    Regards,

    Santu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 20, 2015 at 06:09 AM

    Sorry Praveen,

    I was on vocation so i could not get a time to login. Did you get the solution or u want me to send you the required abap code.

    Regards,

    Santu.

    Add comment
    10|10000 characters needed characters exceeded