Tuesday, December 1, 2009

SNP process modeling

Source: SNP CTM best practice

Wednesday, November 18, 2009

Note 380352 - DP 3.0: User exit / Business Add Ins



In the Demand Planning, user exits and Business Add Ins are available to extend standard functions or to map own functions.
This note contains brief information on the options.
If you need more details refer to the documentation.

Other terms

User exit, BAdI


With regard to user exits, Note 147522 is also valid for Release 3.0.

  • A Business Add In is the new form of user exit. It is object-oriented. For certain objects / actions, the standard system calls up an additional method which you can remove as a customer.
    • To do this, start Transaction SE18, enter the definition name and choose 'Create implementation' per menu option
    • All the methods are located in 'Interface'. By double-clicking on one of these methods you go to its implementation section.
    • If you choose 'Goto => Class definition', you see the parameter settings and reference type specification displayed.

The following BAdIs are available

  • /SAPAPO/SDP_COLWIDTH - Planning Period Column Width Default
    • In parameter CV_AGC_WIDTH, change the column width depending on planning book, data view and grid (top/bottom).
  • /SAPAPO/SDP_EXTRACT - Extract Planning Area Data
    • You use method CHANGE_INPUT to override the input parameters for the extractor (sent by the requesting system).
    • You use method CHANGE_OUTPUT to change the extracted data, by enhancing it, for example.
  • /SAPAPO/SDP_FIXWIDTH - Fix Column Width for InfoObjects
    • You use parameter CV_COL_WIDTH to override the column width (dependent on characteristics) of fixed columns that are expanded during a drill down.
    • You can change / extend the detailed header information.
  • /SAPAPO/SDP_INTERACT - Interactive Planning
    • You use method FCODES_EXCLUDE to gray out standard functions that you no longer want your user to be able to choose.
    • You use method USER_FCODES_CALCULATIONS to implement your own functions that neither macros nor user exits are able to cover. Under FCODES, you must first release a function code (by entering a description). This released function code (for example, +CUS01) is then displayed automatically in the menu, which then, when selected executes the method.
    • You use method PIVOT_ORDER_SET to automatically set the column sequence after a drill down or 'display dependent objects'.
    • You use method TEXT_CHOOSE to choose between using a short text, a medium text, or a long text.
  • /SAPAPO/SDP_MASTER - Characteristic value combinations
    • You use method CHECK_MANUAL_INPUT to check your manual entries for creating or deleting characteristic value combinations.
    • You call up method COMBI_ENRICH to create characteristics combinations (manually / automatically). You have the option of revising or extending combinations.
  • /SAPAPO/SDP_PROMOT - Promotion
    • Notes: 356589 & 361640
  • /SAPAPO/SDP_RELDATA - Release of DP to SNP
    • You use method CHANGE_RELDATA to edit the requirements released from DP to SNP (quantities / dates).
  • /SAPAPO/SDP_RELSTRAT - Set Requirement Strategy on Release
    • You have the option of dynamically setting the requirement strategy.
    • It is only possible to use Business Add-In '/SAPAPO/SDP_SELECTOR' to extend customer-specific SDP Selector standard functions in interactive planning. Note '399508' details the BAdI methods and how they can be used. Note '377497' provides a sample method implementation code.

See note 394076 for User Exit advice on Forecasts

Header Data

Release Status:Released for Customer
Released on:26.12.2002 17:44:43
Master Language:German
Priority:Correction with low priority
Primary Component:SCM-APO-FCS Demand Planning

Affected Releases


Correction delivered in Support Package


Related Notes

576015 - Collective Consulting Note for Demand Planning

394076 - Consulting: USER-EXITS and BAdIs in the forecast environment


Note 418801 - Creating a user exit macro



You cannot use a standard macro.

Other terms


Reason and Prerequisites

Possible causes:

  • Parameters required to calculate the line entries are not available in the macrobuilder and must first be generated from database tables.
  • More complicated calculations are necessary to determine the line entries.

You can create a user exit macro to correct the problem. We shall outline the exact procedure for this below.

As of SCM Release 5.0, we recommend that you use a Business Add-In (BAdI) macro instead of a user exit macro (see SAP online documentation).

Creating the macro
  • Use Transaction /SAPAPO/ADVM to call the macrobuilder.
  • Select a macro book.
  • Use Drag and Drop to move the icon labeled 'User exit macro' from the Shuffler into the middle of the screen and attach it to the icon with the name 'Macro'. Rename it.
  • If required, link the user exit macro icon you have just created with one of the event icons located in the right-hand screen.
Creating the user exit
  • Start Transaction SMOD.
  • Enter APODM005 in the 'Enhancement' field. Select 'Display'.
  • Then choose 'Components' or Shift+F11 and double-click the name of the function module.
  • Double-click the include contained in the function module to enter the source code.

Below we exaplain how to fill the interface of the user exit. The user only fills or changes the following tables:

    • T_C_TAB
    • T_E_TAB_OLD

The T_C_TAB table is the actual output table in this case. T_E_TAB_OLD provides information about data changes and must be maintained for technical reasons. All other tables act as input parameters.

The values on the planning board are stored under the V field name in the T_C_TAB table. The table entries are explicitly defined by their Z line index and their C column index. The T_I_COLS table provides the column information here while the line information is returned from an inner join via the T_I_PLOB_VALUES and T_I_LINES tables.

The parameters of the following tables are used to calculate lines and columns:

Interface parameter
| Table | Field | Description |
| T_I_COLS | VONTG | Lower date limit |
| T_I_COLS | BISTG | Upper date limit |
| T_I_PLOB_VALUES | SELECTION | Table composed of the |
| | | IOBJNM characteristic and a |
| | | range structure |
| T_I_PLOB_VALUES | PLOBJ | (for join condition) |
| T_I_PLOB_VALUES- | IOBJNM | Technical name of the |
| SELECTION | | rel. characteristic |
| T_I_LINES | FELDH | Technical name of the |
| | | rel. key figure |
| T_I_LINES | GRIDNR | Name of the rel. grid |
| T_I_LINES | KRIT1 | (for join condition) |
| T_C_TAB / T_E_TAB_OLD | Z | Line index of planning board |
| T_C_TAB / T_E_TAB_OLD | C | Column index of planning board |
| T_C_TAB / T_E_TAB_OLD | V | num. planning board entry |

To manipulate the planning board entries, you must use the source code of the user exit to adjust the grid entries of the T_C_TAB table appropriately. In this case, each individual cell is addressed using the coordinates of the grid. Proceed as follows:

  • Determine column C from the T_I_COLS table depending on the VONTG and BISTG date limits.
  • Use the internal table T_I_PLOB_VALUES-SELECTION to check that the solution is unique and, if necessary, determine T_I_PLOB_VALUES-PLOBJ.
  • In table T_I_LINES, use the following key fields
    • FELDH
    • GRIDNR = '001'

to determine the line number Z = T_I_LINES-LINE.

  • In the T_C_TAB table, enter the required value for the determined line and column index under T_C_TAB-V.
  • If you want to change a value for the table, save the earlier T_C_TAB entry in the table with the same structure, that is, T_E_TAB_OLD. If you enter a new value into the T_C_TAB table, you must insert a null value into the T_E_TAB_OLD table for the corresponding rows and column number.
  • If you want to make changes at the lowest level of granularity, you must ensure that your selection is unique. We shall only consider this case here.
  • You can find the technical names for key figures and characteristics in Transaction /SAPAPO/SDP8B.
Sample code

The following function module fills all buckets for the FELDH key figure within the time interval VONTG to BISTG with a constant value V. The selection is determined by the IOBJNM and CHAR_VAL fields, whereby the first field provides the technical name of the characteristic and the second indicates the value of the characteristic.

FUNCTION zfill_buckets
*"*"Global interface:
DATA: l_selection LIKE LINE OF t_i_plob_values-selection.
DATA: l_line LIKE LINE OF t_i_lines.
DATA: l_tab LIKE LINE OF t_c_tab.
DATA: l_col LIKE LINE OF t_i_cols.
DATA: l_column LIKE t_i_cols-column.
DATA: l_cnt TYPE i.
DATA: l_gridnr TYPE char3 VALUE '001'.
DATA: l_index LIKE sy-tabix.

* read table t_i_cols index 1 into l_col.
LOOP AT t_i_cols INTO l_col WHERE bistg <= bistg
AND vontg >= vontg.
l_column = l_col-column.

LOOP AT t_i_plob_values.
* For checking uniqueness calculate # entries
CLEAR l_cnt.
LOOP AT t_i_plob_values-selection INTO l_selection
WHERE iobjnm = iobjnm
AND low = char_val.
l_cnt = l_cnt + 1.
IF l_cnt > 1.

IF sy-subrc <> 0 OR l_cnt > 1.
READ TABLE t_i_plob_values-selection WITH KEY
iobjnm = iobjnm
low = char_val
z = l_line-line
c = l_column
* store old value
IF sy-subrc = 0.
MODIFY t_e_tab_old FROM l_tab INDEX sy-tabix.
APPEND l_tab TO t_e_tab_old.
* store new value
l_tab-v = v.
MODIFY t_c_tab FROM l_tab INDEX l_index.


Header Data

Release Status:Released for Customer
Released on:16.02.2006 09:45:22
Master Language:German
Priority:Correction with medium priority
Primary Component:SCM-APO-FCS-MAC MacroBuilder
Secondary Components:SCM-APO-SNP-MAC MacroBuilder

Affected Releases


Related Notes

1045639 - Consulting notes in SNP/CTM

539797 - Collective consulting note on macros

Tuesday, November 10, 2009

Production Process Model (PPM): Settings for CTM

If you create a PPM for Capable-to-Match (CTM), note that CTM does not support setup matrices or teardown activities.

CTM does not use all settings from the PPM. This table lists the settings that CTM does use:

Screen/tab page

In this field...

Initial screen

· Plan number

· Use


· Multilevel Costs (Fixed)

· Status


· Operation

· Description

· Operation type


· Activity number

· Description

· Activity category

· Scrap in percent (time and version dependent)

Logical components (only PP/DS PPM)

· Description

· Input/output

Alternative components

· Product

· Input/output indicator (only SNP PPM)

· Storage

· Date from

· Date to

· Unit of measure

· Material consumption (variable)

· Material consumption (fixed)

· Time-dependent data

· Prevention of product explosion


· Mode

· Mode Priority

· Primary Resource

· Location

· Unit of measure (in the case of SNP PPM: only Day is allowed)

· Duration (variable)

· Duration (fixed)

· Time-dependent data

· Break not allowed

· Break without interruption


· Resource

· Location

· UoM for continuous consumption

· Continuous consumption (variable)

· Continuous consumption (fixed)

· UoM for bucket consumption

· Bucket consumption (variable)

· Bucket consumption (fixed)

· Time-dependent duration

Activity Relationships ® Predecessor/Successor

· Operation name

· Activity number

· Reference type (only end-start)

· Unit of measure

· Usage min.

· Process-related minimum interval

· Usage max.

· Maximum interval

· Mode linkage (only via primary resources)

Product-plan assignment

· PPM name and description

· Validity (date/time)

· Planning location

· Production location

· Minimum and Maximum Lot Size

· Procurement Priority

Friday, October 9, 2009

Master Data Setup for Hierarchical Planning

Entering content frame

Process documentation Master Data Setup for Hierarchical Planning Locate the document in its SAP Library structure


Since you run the SNP heuristic and SNP optimizer at product group level in hierarchical planning, you first have to create the relevant master data for running the SNP heuristic or SNP optimizer. For more information about this, see Master Data Setup for the Heuristic and Master Data Setup for the Optimizer. There are also details regarding master data maintenance that are specific to hierarchical planning.

Note that you have to maintain all the master data at both product level and at product group level; you cannot automatically generate the product group level from product level.

Process Flow


1. You create products and locations.

The following details apply to hierarchical planning:

¡ You run hierarchical planning on the basis of a location product group. To create this location product group, you first have to create a product group and a location group. These groups consist of individual products or locations that are grouped into hierarchies (see step 3). You create all the levels of these hierarchies as standalone products and locations in the product and location master data. The location product at the head of the location product hierarchy represents the location product group on which you are basing hierarchical planning.

¡ If you want to plan multiple levels (locations) of your network, the same product groups should be defined in all locations. There should not be any cycles in your network.

¡ SNP disaggregation takes into account the rounding values and lot size parameters defined for the individual products and product groups. If you want to ensure that during SNP disaggregation there are no remainders at product group level, the rounding values defined at product level must be the same within a group. The rounding value of the product group must be a multiple of the value at product level. In addition, the minimum lot size at group level should be larger than or equal to the minimum lot size defined at product level.

¡ The procurement type defined at product group level should also be supported at product level.

¡ The same SNP production horizon, extended SNP production horizon, and SNP stock transfer horizon should be defined for all products of the product group (including the header product and product group).

2. You create resources, production process models (PPMs), and transportation lanes.

The following details apply to hierarchical planning:

¡ For optimization-based planning, you always have to also create a resource at product group level. The SNP optimizer uses the resource and costs defined at product group level for hierarchical planning. Creating resources is optional for the SNP heuristic.

¡ To ensure that the resource consumption of fixed orders at product level is correctly taken into account during planning, note the following restrictions for creating resources:

§ You should use the same resources at product level and product group level.

§ The resource consumption of the PPMs and transportation lanes at product level and product group level should be similar.

¡ The total of the resource capacities defined at product level should form the resource capacity at product group level. If you are using several PPMs at product level, the total resource consumption of the different PPMs at product level should form the PPM’s resource consumption at product group level.

¡ You cannot automatically generate PPMs at product group level from the PPMs at product level; you have to create the PPMs individually for the product groups.

¡ For external procurement, since SNP disaggregation uses the source determination decisions from product group level, the same transportation lanes must apply for the product group and the individual products.

3. You create hierarchies.

To create a location product group, you first create a product group and a location group using hierarchies; that is, you create a product hierarchy and location hierarchy in Customizing for SAP APO master data. You then generate a location product hierarchy from the product hierarchy and the location hierarchy. The location product representing the location product group is at the top of this location product hierarchy.

You can create the location product group as a location group for a product or a product group for a location, for example. In the first instance, you have to create a location hierarchy with a header location (the location group) and several subordinate locations, and a product hierarchy with a header product (the product group) and only one subordinate product. In the latter instance (to create a product group for a product), you have to do the opposite. The graphic below provides an example of the different possible combinations:

Location Product Hierarchy Example

This graphic is explained in the accompanying text

In this example, the product hierarchy consists of product group A with the subordinate products B and C. The location hierarchy consists of location group 1 with the subordinate location 2. There are also location products A/1, A/2, C/2, and B/3, and location 3. The generated location product hierarchy consists of the following levels: Product group/location level (level 1) and product/location level (level 2). A/2 is located on level 1 and C/2 on level 2. C/2 is a component of A/2. A/1 is not a component of the location product hierarchy since the product group/location group level was not defined in the generated hierarchy. B/3 is not a component of the hierarchy since location 3 is not a component of the location hierarchy and nor are there any product group/location nodes for B/3 (which would then have to be called A/3).

With in-house production, you also have to create a PPM hierarchy at product group level for every PPM since SNP disaggregation uses source determination decisions from product group level. The PPM hierarchy should be consistent with the location product hierarchy.

For more information about creating hierarchies, see the Structure linkHierarchy section of the SAP APO master data documentation and the corresponding implementation guide (IMG) documentation.

Leaving content frame

Scheduling Agreements with Supplier in SNP

Source from SAP.

Wednesday, September 23, 2009

Planning Horizons


/SAPAPO/SNPPRODHPP/DS Horizon in Calendar Days


You specify a location-product-specific PP/DS horizon here.

If you do not enter any value for the PP/DS horizon or if you enter the duration '0', the system automatically uses the SNP production horizon as the PP/DS horizon. Therefore, the PP/DS horizon is as long as the SNP production horizon. This means the planning intervals for SNP and PP/DS are sequenced with no gaps or overlaps.

If the SNP production horizon also has a duration of 0, the system uses the PP/DS horizon from the planning version.


  • You can use the PP/DS firming horizon within the PP/DS horizon to firm (short-term) planning for planning with procurement planning heuristics.
  • Supply Network Planning (SNP) is permitted to plan outside of the SNP production horizon only. If the SNP production horizon is smaller than the PP/DS horizon, the planning horizons of SNP and PP/DS overlap. SNP and PP/DS can both use this overlapping period for planning.


SNP Production Horizon

Horizon in which Supply Network Planning (SNP) and Capable-to-Match (CTM) do not plan production.


You divide the areas of responsibility for planning between the SNP production horizon and the PP/DS Horizon: You plan production with SNP or CTM outside of the SNP production horizon; planning is bucket-oriented and usually stretches over the medium-term horizon. In the short-term horizon, that is the PP/DS horizon, you plan production in more detail using automatic Production Planning and Detailed Scheduling (PP/DS). You can manually create PP/DS orders outside of the PP/DS horizon. Therefore, the SNP production horizon is only relevant for SNP and CTM and does not cause constraints on order generation at PP/DS level.

If the SNP production horizon is shorter than the PP/DS horizon, the planning areas overlap. This means that planning tasks require full reconciliation.

Use in SNP

SNP does not create any planned orders in the Production (planned) key figure, but moves production to the first day after this horizon. SNP deletes all unfixed SNP planned orders from previous planning runs within this horizon. The horizon starts on the system date (or date defined in the Planning Start Date field of the planning book or using the PDATE user exit for background processing).

Use in CTM

CTM does not generate or delete any planned orders within this production horizon. The horizon starts on the system date (or the date you specified as the planning start in the CTM profile). If no value has been specified here, CTM takes into account the PP/DS Horizon in the planning version.

Use in PP/DS

If you do not enter any value for the PP/DS horizon or if you enter the duration '0', the system automatically uses the SNP production horizon as the PP/DS horizon. Therefore, the PP/DS horizon is as long as the SNP production horizon. This means the planning intervals for SNP and PP/DS are sequenced with no gaps or overlaps.

For more information, see Adjusting the PP/DS Horizon.


If you want to plan the receipts created in SNP or CTM in detail, convert the SNP or CTM orders into PP/DS orders.


In the Fix Production field, you can specify that SNP is to consider all SNP planned orders from previous planning runs as fixed in this horizon and therefore does not delete them.

You use the Period Category field to specify that the SNP production horizon is defined in calendar days, weeks, or months. This setting can influence data consistency, particularly regarding integration of SNP planned orders with SAP R/3.


Situation at the start of the month:

  • The production horizon is 15 days long.
  • Distribution demands arise at a plant on the 10th and 20th of the month.
  • The target days' supply at the plant is zero.

Result: Production for the distribution demands is planned for the 15th and the 20th of the month. The demands within the SNP production horizon are planned including due date overruns in Supply Network Planning.


Supply Network Planning: Forecast Horizon in Days

Horizon in calendar days during which the forecast is not considered as part of the total demand.


Within this horizon, Supply Network Planning (SNP) does not take the forecast into account when calculating total demand. Outside of this horizon, the system calculates total demand using either the forecast or sales orders (whichever value is larger), and the other demands (dependent demand, distribution demand, planned demand, and confirmed demand).


If you have defined a requirement strategy on the Demand tab page of the location product master, the system calculates the total demand outside of the forecast horizon either as a total of the forecast and sales orders (strategy 20, Planning with Final Assembly) or only uses the forecast (strategy 10, Make-to-Stock Production).

The SNP and deployment optimizers only take into account the forecast horizon if you have set the Forecast Horizon indicator on the Integration tab page of the SNP optimizer profile or SNP deployment optimizer profile.


The situation at the start of the month is as follows:

  • Demand of 10 pieces is forecast for the 10th, 20th, and 30th of the month.
  • There are sales orders of 5, 5, and 15 pieces respectively on the 10th, 20th, and 30th of the month.
  • No requirements strategy has been specified in the location product master.
  • The defined forecast horizon is 15 days.

Result: After the planning run, the following is displayed in the Total Demand key figure in interactive Supply Network Planning: 5 pieces on the 10th, 10 pieces on the 20th, and 15 pieces on the 30th of the month.