Defining a Macro in a Planning Type 

The definition of macros is optional.

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

Disaggregating a Line Using the Proportional Factors

You can define a macro in one of two ways:

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).

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.
  2. The Define Macro dialog box appears.

  3. Enter here the name and description of your macro.
  4. To continue, choose ENTER .

  5. 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).
  6. From the application toolbar, choose the operation you wish to perform.
  7. Define the second operand for your macro (either choose a line or enter a value using the pushbutton Enter value ).
  8. Choose the line in which you want the results of the operation to be displayed.
  9. To save your macro, choose Macro ® Save.
  10. To exit Record mode, choose Macro ® Exit macro.
  11. 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.
  2. The Define Macro dialog box appears.

  3. Enter here the name and description of your macro.
  4. To continue, choose ENTER .

  5. Choose Special operation .
  6. See also Macros for Stock Balance, Production, Days’ Supply, and Historical Totals.

  7. Choose the desired operation and choose ENTER .
  8. 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).
  9. The mathematical operations to be performed by this operator are recorded internally.

  10. When the message Choose first line reappears, either specify further calculations or save the macro with Macro ® Save.
  11. To exit Record mode, choose Macro ® Exit macro.
  12. 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.

 

To define a macro using the Create function:

  1. Choose Macro ® Create.
  2. The Define Macro dialog box appears.

  3. Enter here the name and description of your macro.
  4. To continue, choose ENTER .

  5. In the first Operand field, enter the first operand for your macro. This operand must be a line text from the planning table.
  6. Choose an operation.
  7. 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.
  8. You leave the field blank if, for example, you want to aggregate members (first Operand) to owner level (Result).

  9. In the Result field, enter the text of the line on which you want the macro result to appear.
  10. If your macro requires more than one line for its calculation, repeat steps 3 to 6 until your macro is complete.
  11. Set or not, as necessary, the Display and Disregard selection indicators.
  12. Choose Macro ® Save.
  13. To return to the main definition screen, choose Goto ® Back.
  14. 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 ® Execute. To delete a macro, choose Macro ® Delete.