SAP SOP Creation of Macros for Planning Type

Study Material Contributed by Ulhas Kavle - Senior SAP Consultant

Macros in Flexible Planning

You can add mathematically formulas on the data pulled in from the information structure to arrive at the final values of a certain key figures through the use of macros. As an example, one can write macros for arriving at the production quantities as equal to the sales quantities or X % more or less than the production quantities. It should also be noted that the macros can only be written for the key figures. Normally macros are written to calculate/change the values of key figures, for example key figures like the production quantities, days’ supply, target days supply.

Macros can be run automatically in the planning table; for which they are used as “default macros”, “initial macros” and “final macros”. The Default macros are called during entry in the planning table, the Initial Macros are called at the start of planning in the planning table and the Final Macros are called at the end of planning in the planning table.

In level by level planning, SAP uses macros for aggregation and disaggregation functionalities, since they are not triggered automatically as in consistent planning methods.

Note – Creation of Macros is not a mandatory step, you can prefer not to have events at all in your planning situation.

Some of the standard SOP macros are shown in the screens below. You could use the same logic for deriving values for key figures such as production, stock level, and target day’s supply. If you observe the below figure/screenshots, the key figure called sales/day, zero stock level, are included in the planning type to behave as an intermediate variable for deriving the values of some other key figures. Such keys figures can be declared as Auxiliary key figures.

You should create macros in the planning type transaction; choose the path Macros > Create. After the creation of Macros, you can test them by entering values test values in the planning type for the key figures and then execute the macros so as to test them (path Macros > Execute)

Default Macros (S893_00001), as shown below, can be constructed for the planning table {also refer to the Standard SAP macros used in Planning type SOPKAPA (S076)}. The equations in the default macros come in to action real time in the planning table.

If you don’t set the display indicator, then the macros are executed at the point of time, they are supposed to run, though if the “display indicator” is set, you are left with a chance of executing them manually in the planning table, as and when you wish to.

In the example below for consistent planning, the production value is set at 10% more than the sales quantities, i.e., Sales Order Quantity * 1.10 = Production

Fig – SOP_28

Note: “LO” = Stock of previous period + Receipts – Issues, “/” = divide as value, “*” = multiple as value

Examples of some more macros are shown below:

These below macros can be executed as default, initial or final macros or even they can be executed manually if they are not set in the planning type as default, initial or final macros.

a) Production = Sales

Fig – SOP_29

Note: “=V” = Copy From

b) Production from target stock level

Fig – SOP_30

Note: “L1” = Receipts based on target stock level = Target stock + Stock Previous Period – Issues

c) Production from target day’s Supply

Fig – SOP_31

Note: “/” = divide as value, “*” = multiple as value

d) Production from Zero Stock

Fig – SOP_32

All the site contents are Copyright © www.sapsword.com and the content authors. All rights reserved.

All product names are trademarks of their respective companies. The site www.sapsword.com is in no way affiliated with SAP AG. Every effort is made to ensure the content integrity.

Information used on this site is at your own risk.

The content on this site may not be reproduced or redistributed without the express written permission of

www.sapsword.com or the content authors.

Sitemap Sitemap