In the case of consistent planning, the macros for aggregation and disaggregation come predefined with the system. You do not have to write them yourself. In both consistent and level-by-level planning, a function for disaggregating a line using the predefined proportional factors is available.
See also:
Ways to Aggregate and Disaggregate in Consistent Planning [Page 195] Disaggregating a Line Using the Proportional Factors [Page 127]
You can define a macro in one of two ways: • with the Record function
The Record function allows you to define a macro directly in the planning screen. It is therefore quicker than the Create function. The operands can be either texts from lines in the planning table or numerical values. The operators are displayed in the application toolbar. Standard operators are provided for the calculation of stock balance, production, days’ supply, and historical totals (see Macros for Stock Balance, Production, Days’ Supply, and Historical Totals [Page 73]).
• with the Create function
The Create function allows you to define a macro in a separate window. You therefore see exactly how each macro is calculated. You also set two indicators that determine how the macro is handled in the planning table. The operands can be either texts from lines in the planning table or numerical values. This function is suitable for complicated macros consisting possibly of several lines.
You can also write your own coding for function module EXIT_SAPMMCP6_002 to define a highly complicated macro. See also the Implementation Guide for Sales & Operations Planning (the step “Develop functional enhancement to calculate a macro”).
To define a macro using the Record function: 1. Choose Macro → Record.
The Define Macro dialog box appears.
2. Enter here the name and description of your macro. To continue, choose ENTER.
3. Choose the first line, that is, the first operand for your macro (place the cursor on it and choose Choose or double-click with the mouse).
Defining a Macro in a Planning Type 5. Define the second operand for your macro (either choose a line or enter a value using
the pushbutton Enter value).
6. Choose the line in which you want the results of the operation to be displayed. 7. To save your macro, choose Macro → Save.
8. To exit Record mode, choose Macro → Exit macro.
9. You can now try out your macro by entering values in the appropriate lines and choosing
Macro → Execute.
To define a macro for stock balances, production, days’ supply, or a historical total using the Record function:
1. Choose Macro → Record.
The Define Macro dialog box appears.
2. Enter here the name and description of your macro. To continue, choose ENTER.
3. Choose Special operation.
See also Macros for Stock Balance, Production, Days’ Supply, and Historical Totals [Page 73].
4. Choose the desired operation and choose ENTER.
5. Choose the lines to be included in the calculation by following the instructions at the bottom of the screen (to choose a line, place the cursor on it and choose Choose or
double-click with the mouse).
The mathematical operations to be performed by this operator are recorded internally. 6. When the message Choose first line reappears, either specify further calculations or
save the macro with Macro → Save.
7. To exit Record mode, choose Macro → Exit macro.
8. You can now try out your macro by entering values in the appropriate lines and choosing
Macro → Execute.
You cannot try out macros for production or days’ supply in the planning type. This is because these macros depend on the number of workdays in a period and the period length is not specified in the planning type.
Defining a Macro in a Planning Type
72 December 1999
3. In the first Operand field, enter the first operand for your macro. This operand must be a line text from the planning table.
4. Choose an operation.
5. In the second Operand field, enter the second operand for your macro. This operand can either be a line text from the planning table, or a number, or a blank.
You leave the field blank if, for example, you want to aggregate members (first Operand) to owner level (Result).
6. In the Result field, enter the text of the line on which you want the macro result to
appear.
7. If your macro requires more than one line for its calculation, repeat steps 3 to 6 until your macro is complete.
8. Set or not, as necessary, the Display and Disregard selection indicators. 9. Choose Macro → Save.
10. To return to the main definition screen, choose Goto → Back.
11. You can now try out your macro by entering values in the appropriate lines and choosing
Macro → Execute.
To change or display an existing macro, choose Macro → Edit. To try out a macro, choose Macro
Macros for Stock Balance, Production, Days’ Supply, and Historical Totals
Macros for Stock Balance, Production, Days’ Supply,
and Historical Totals
You can use the following special operators to record a macro:
Operator Description L0 Stock balance L1 Target stock/receipts L2 Receipts L3 Issues L4 Target stock/issues PR Target supply/production RW Days’ supply ZS Historical total
The operations performed by these operators are defined internally as described below. All you need to do is specify which lines in the planning type are to represent which operands in the macro (see Defining a Macro in a Planning Type [Page 70]); for example, you might define the sales line as goods issues and the production line as goods receipts.