Skip to Content
avatar image
Former Member

Macro to Copy Average Demand into Safety Stock Key Figure

Hi Experts,

I need your help for creation of a macro to meet a requirement, stated below:

We are releasing Demand on daily bucket for a period of 3 months. We would like to maintain safety stock only for the period of 21st date fo the month to 30th day ( for each months, within the storage bucket). For doing this I need to calculate average demand of the month based on the Forecast of 20th of the month. My requirements are:

Step 1: Read the Forecast value for 20th day of the Month

Step 2: Calculate Average demand based on the Demand of 20th day

Step 3: Populate Average demand in the Safety Stock fey figure from 21st to 30th of the month. For other days safety Stock key figure value shall be populated according to the Product Master value.

I have created following Macro, but it is not serving my requirement. Could you please tell me where I am going wrong:

Macro.jpg (33.6 kB)
macro1.jpg (43.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 21, 2015 at 06:35 AM


    Sorry but from the macro you constructed, it seems that you still do not quite understand how macro works. e.g.

    - the date functions are not correctly used

    - you do not understand how auxiliary table works

    - you do not know how to use SNP macro functions like SAFETY_CALC() ... (I don't think we have SAFETY function.) ...

    - you even don't know how to get value from a certain cell ...

    Sorry that I don't want to be mean, but I suggest you to first try to construct some easy macros and check how they work. Then you can go on to construct some complicated macros.

    You can find all macro functions in our online help Operators and Functions in Macros - SAP Library .
    I also suggest you to read my document to know more about macros.

    Have fun on learning with macros 😊

    Best Regards,

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Ada Lv

      I am still struggling. I have tried another simplistic way to acheive this. following is the the macro I have buit up, but it is not giving desired result. Could you please suggest, what could be the best way for acheiving my requirement.


      With Regards,


      image.jpg (23.2 kB)