Skip to Content
author's profile photo Former Member
Former Member

APO Moving Average

Dear Experts;

I am new to SAP APO. I am current interning and my boss ask me to see if I can figure out how to write a code or use workbench to come up with a moving average macrons. The objectives is to have a 3 months average calculate itself and move over to the next by using macron and that run in the background. After searching for the answers for days, I cannot come up with anything. So please help.

Visal Lay,

SAP APO Intern

Penn State University

Information Sciences & Technology

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Posted on Jul 29, 2016 at 02:17 AM


    If you just want to practice ABAP, this does not look like a good exercise ...
    Moving average is already provided in APO system and you can use it directly. But normally we do not use macro to calculate forecast ... You can define different background activities in /sapapo.mc8t, and as you can see, macro and forecast are different ones ...
    Macros in APO are also provided in APO, you can just create them easily in /sapapo/advm.
    So not sure about what you want to do exactly ... Do you want to learn how to configure DP functionalities or you want to practice ABAP coding purely?


    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Then I suppose the best way would be using forecast strategy 99 (external forecast).
      You can set your univariate forecast profile in /sapapo/mc96b to use strategy 99.
      Then you create a badi implementation of badi /SAPAPO/SDP_FCST_EXT, and put your coding in method EXTERN1 or/and EXTERN2.
      If you assign this profile during forecast run, your coding in the BADI will be called.


  • author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2016 at 02:34 PM

    Dear Visal,

    To calculate the moving average using macro, use the below logic.

    Let's suppose you are using two different keyfigures for Sales & Forecast respectively.

    Considering an example of generating the forecast for 12 months.

    step1: one iteration

    Forecast(Jan 2016) = avg (sales(oct2015); sales(dec2015))

    step2: one iteration

    Forecast(Feb 2016) = ( sales(nov2015) + sales(dec2015) + forecast(jan2016) ) / 3

    step1: one iteration

    Forecast(Mar 2016) = ( sales(dec2015) + forecast(jan2016) + forecast(feb2016) ) / 3

    step4: nine iterations

    Forecast(Apr2016) = avg (forecast(Jan2016); Mar(2016))

    Use respective keyfigures and iterations as per your requirement.

    Feel free to ask if you still have any queries.

    Kindly close the discussion if resolved.



    Add comment
    10|10000 characters needed characters exceeded