Learn how to configure Supply Network Planning (SNP) heuristics to consider various shelf life requirements, such as minimum and maximum shelf life conditions, during planning. Read about the limitations and enhancements associated with SNP when considering shelf life planning.
Key Concept
Consideration of shelf life requirements is not adequately addressed by the various planning engines available in SAP SCM 7.0 Supply Network Planning (SNP), such as Heuristics, Capable-to-Match (CTM), and Optimizer. By tweaking different macros used in SNP and leveraging the shelf life-specific key figures, it is possible to consider shelf life conditions during the SNP heuristics run.
In industries such as Pharmaceuticals, Dairy, and Food and Beverage, many products have a limited shelf life. Planning perishable goods accurately is a critical success factor for these industries. Shelf life restrictions directly influence inventory levels, obsolescence costs, and stock-out costs. Strict customer requirements concerning the minimum remaining shelf life have an important influence on production planning.
By making the minor changes I describe, you can carry out shelf life planning using SAP SCM 7.0 Supply Network Planning (SNP) heuristics. Combining SNP heuristics with propagation heuristics and shelf life alerts meets most of the requirements for industries with short shelf life products.
The following are features available in the SNP module in SAP SCM 7.0 that can assist in shelf life planning:
- Separate planning book 9ASNP_SHLF — This is a new planning book introduced in SCM 7.0 that is specific to shelf life planning. Only this planning book has shelf life-specific key figures and macros. Following are the four shelf life-specific key figures:
- Expiring Quantity: This displays the quantity of the batch that will expire in a particular time bucket based on the shelf life of the product. It shows the entire quantity of a particular batch as expired irrespective of whether some portion of it was assigned to meet certain demand elements.
- For example, consider a batch of 100 units of a product produced on day 1 with a shelf life of 10 days. There is a demand of 50 units on day 5 which can be met with the batch produced on day. However, in the planning book, 100 units are still displayed as expiring on day 10 although only 50 units will expire.
- Projected Wastage Quantity: This displays the portion of a batch or multiple batches that is unused (i.e., not assigned to any demand element) and will be expiring based on the shelf life of the product. Using my example above, on day 10, 50 units would be shown as Projected Wastage Quantity as there is no demand after day 5 and these units will expire on day 10.
- Stock on Hand (Shelf Life): This displays the portion of a batch or multiple batches that is unused (i.e., not assigned to any demand element), not expired, and that can be used to meet demand. In my above example, 100 units are displayed as Stock on Hand (Shelf life) from day 1 to day 4, and 50 units are displayed as such from Day 5 to Day 9.
- Supply Shortage (Shelf Life): This displays the total quantity of a demand element that is unfulfilled and has not been assigned to any stock or supply element. It takes various shelflife conditions into account, such as minimum shelf life, maximum shelf life, and expiry. In my above example, if the demand on day 5 had a minimum remaining shelf life condition of eight days, then the batch of 100 units couldn’t have been used as it has a remaining shelf life of five days. In that case, 50 units would be shown as a Supply Shortage (Shelf Life) from day 5 onward.
- Parameters in SAP SCM’s Product Master: There are shelf life-specific fields in the product master that are important from a shelf life planning perspective. You can see these fields in Figure 1 and read their descriptions below.
- Shelf Life: This field indicates the total shelf life of a product in days. This field is populated automatically from SAP ERP Central Component (SAP ECC) via Core Interface (CIF) through the material master integration model.
- Required Minimum Shelf Life: This field indicates the minimum remaining shelf life that a stock or receipt needs to have to cover the requirement. It is populated automatically from SAP ECC via CIF through the material master integration model.
- Required Maximum Shelf Life: This field indicates the maximum remaining shelf life that a stock or receipt needs to have to cover the requirement. It is not populated from SAP ECC; a default value of 9999 days is used if this field is left blank, or it can be changed manually by the user.
- Maturation Time: This indicates the time between the production of an item and the earliest it can be used. It is not populated from SAP ECC and needs to be updated manually by the user.
- Planning with Shelf Life: This indicator determines whether the shelf life function is active for a product. It is populated automatically from SAP ECC via CIF through the material master integration model.
- There is also an option in the Demand tab of the product master to set these parameters at the location product level (Figure 2). This gives the planner the flexibility to vary shelf life conditions based on different locations.

Figure 1
Shelf life parameters in the Product Master

Figure 2
Location-specific shelf life parameters
- Shelf life enabled for demand elements: A forecast carries shelf life requirements from the product master. When the forecast is released from demand planning (DP), the default Min. Shelf Life requirements from the product master data are attached to each demand element. This logic can be changed by implementing the method CHANGE_RELDATA of Business Add-In (BAdI) /SAPAPO/SDP_RELDATA if you need to vary minimum shelf life conditions depending on the customer. Sales orders for configurable materials carry shelf life information from SAP ECC. Figure 3 shows the minimum shelf life requirement for the forecast on August 6, 2011.

Figure 3
Shelf life for demand elements
- Shelf life enabled for receipt elements: Shelf life information for individual stock batches is transferred from SAP ECC to SAP Advanced Planning and Optimization (SAP APO) via CIF. The key figure Expiring Quantity shows the expiring quantity of each batch in a respective time period. Planned orders and distribution receipts generated in SAP APO carry shelf life information from the product master. For planned orders, the system calculates the shelf life expiry date by adding shelf life days to the production end date of the order. For distribution receipts, it is calculated by adding shelf life days to the shipment end date. Figure 4 shows the expiry date for the Distribution Receipt (Planned) on August 6, 2011.

Figure 4
Shelf life for receipt elements
- Shelf life considerations in SNP engines: SNP heuristics and CTM do not consider shelf life conditions during the planning run. SNP Optimizer supports shelf life planning in a restricted way. The SNP optimizer profile has a section on shelf life where it is possible to make shelf life a hard or soft constraint. In industries with very short shelf life such as dairy, food, and beverage, it is important that the planning run be executed in daily buckets so that the planner can clearly see when the products will expire and can plan appropriate actions.
- Shelf life – hard constraint: To ensure shelf life is considered as a hard constraint by the optimizer, select the Dispose of Expired Product option in the shelf life section of the optimizer profile (Figure 5). Note that the Use Penalty Costs that are not Prod-Dep. option should not be checked as it would produce unexpected results, especially in the case of products in which the bill of materials (BOM) components also have shelf life. The optimizer uses the procurement cost as the disposal cost when this option is not checked, which produces the optimum results. The optimizer tries to minimize the disposal of the expired product. It would not produce anything that can result in products expiring without being used, as the optimizer would incur disposal costs for disposing of the expired product.

Figure 5
Shelf Life - Hard Constraint in Optimizer
- Shelf life – soft constraint: If you want shelf life restrictions to be able to be violated (i.e., if an expired product can still be used), then you can model this as a soft constraint in SNP optimizer. Select the Continue Using Expired Product option in the shelf life section of the optimizer profile to allow this to happen. You should select the Use Penalty Costs that are not Prod-Dep. option so that the optimizer uses this cost as a penalty cost for shelf life condition violations instead of the product procurement cost. Therefore, when shelf life is modelled as a soft constraint, the optimizer might use the expired products (if required), but would incur the penalty costs maintained in the optimization profile. Due to the penalty costs, the optimizer would avoid using the expired products.
- Propagation of shelf life data: SNP propagation heuristics transmit the shelf life requirement of demand to corresponding receipts (and their dependent demand), considering transport and production duration. Due to different transit times between the source and destination locations in the supply chain, shelf life conditions vary, which creates issues. To avoid any issues, shelf life information is propagated across the supply chain so that it is uniform across various stages (e.g., plant or distribution center) of the supply chain. I describe propagation in detail in the last section of this article.
- Shelf life data alerts: You can set up alerts in SAP’s alert monitor and interactive planning to inform planners of shelf life problems that can arise from expiring stocks or batches, or due to a remaining shelf life that is not long enough to cover requirements. There are two shelf life-specific alerts available to help planners: Projected Wastage Quantity (Database and Dynamic alert) and Supply Shortage Shelf Life (Database and Dynamic alert). The Projected Wastage Quantity alert is generated if there is stock or receipts that are not assigned to any demand (unpegged) and will be expiring. The Supply Shortage Shelf Life alert is generated if some or the entire portion of a demand element is not fulfilled due to various shelf life conditions like minimum remaining shelf life, maximum shelf life, or due to expiry.
To set up the alerts in the alert monitor, you need to create a copy of the standard shelf life planning book 9ASNP_SHLF and change shelf life alerts macros to default macros.
Limitations of Shelf Life Functionality in SNP
Shelf life functionality available in SNP is helpful, but it is not enough to meet all planning requirements. Out of the three SNP engines, only SNP Optimizer supports shelf life planning but in a very restricted way — it does not consider various shelf life conditions such as minimum remaining shelf life, maximum shelf life, and maturation time.
It also does not recognize the actual batch expiry date of stock. It calculates the expiry of the batches assuming they were produced on the first day of the planning horizon and adds the shelf life from the product master. If there are multiple batches with different production dates, then the optimizer assumes the same expiry date for all of them even though they will expire on different dates.
The standard Stock on Hand and Supply Shortage key figures in the shelf life planning book (9ASNP_SHLF) can be confusing as they do not consider shelf life information in their calculations and assume a product won’t expire and could be used whenever required. The Expiring Quantity key figure can be misleading as it shows some quantity as expiring even when the entire batch quantity has been assigned to a demand element and in reality nothing is expiring.
Shelf life-specific key figures like Projected Wastage Quantity or Stock on Hand (Shelf Life) are useful but do not provide complete information to the planner. Projected Wastage Quantity does not consider the minimum or maximum shelf life requirements in the calculation. It shows the wastage only in the bucket where the batch is actually expiring and has not been assigned to any demand. Instead the wastage should be shown in the bucket when a batch/receipt can’t be assigned to a demand, as it is not meeting the minimum or maximum shelf life requirement even though it has not yet expired. The Stock on Hand (shelf life) key figure also does not consider the minimum or maximum shelf life requirements. So even if a particular batch/receipt can’t be used to meet a demand due to these conditions, Stock on Hand (shelf life) still shows that quantity as available.
The Supply Shortage (shelf life) key figure is the most important key figure in SNP from a shelf life planning perspective. It shows the shortage when a batch or receipt is expiring or does not meet the minimum or maximum shelf life conditions. The only shelf life requirement it does not consider is the maturation time. Ideally, if the maturation time of a batch or receipt is after the demand date, then that receipt should not be used to meet that demand and you should see the quantity in the Supply Shortage (shelf life) key figure. Unfortunately it ignores it and you do not see any shortage.
Note
Considering maturation time during a planning run can be handled by
using dummy resources in the Production Process Model (PPM) or
Production Data Structure (PDS) to consume the maturation time. The
product will be available for use only after maturation time is spent at
the dummy resource. This way a receipt would only be used to fulfill a
demand if the demand date is after the maturation time. Further
explanation of this topic is beyond the scope of this article.
Enhancements to Enable Shelf life Planning Using SNP Heuristics
Before I get into enhancements, let’s first understand the functions of SNP heuristics. There are some standard macros that perform various calculations before SNP heuristics is run. The Stock Balance macro is the most important macro from an SNP heuristics perspective as it determines if there is a net demand of a particular product at a particular location and a need to create receipts to meet that demand. It does the following calculations:
- Total Demand: This adds up the relevant key figures that should be considered in the demand calculation (Figure 6).

Figure 6
Demand calculation in the Stock Balance macro
- Total Receipts: This adds up the relevant key figures that should be considered in the receipts calculation (Figure 7).

Figure 7
Receipts calculation in the Stock Balance macro
- Stock On Hand (Initial): This uses a macro function to fetch an initial stock value from the live cache, then adds initial receipts and subtracts initial demand to calculate the projected initial stock on hand (Figure 8).

Figure 8
Initial Stock on Hand calculation in Stock Balance macro
- Stock on Hand: This takes the projected stock on hand for the previous period, adds the receipts coming in during the current period, and subtracts the demand for the current period to come up with the projected stock on hand for the current period (Figure 9).

Figure 9
Stock on Hand calculation in the Stock Balance macro
- Stock On Hand Display: If the projected stock on hand for any period is negative, then it is set to zero and the supply shortage key figure is set to the same quantity but as a positive number (Figure 10). For example, if the projected stock on hand is -100, then it is set to 0 and supply shortage is set to 100.

Figure 10
Stock on Hand Display in the Stock Balance macro
The reason I explained this macro in detail is because of the way SNP heuristics functions. It does not look at the demand and supply elements directly; it plans new receipts only when projected stock on hand is below the safety stock. To ensure SNP heuristics considers shelf life requirements, you need to make some changes in the way it is calculated so that you get appropriate results. You also need to include a key figure that shows the projected wastage quantity due to shelf life conditions such as minimum remaining shelf life or maximum shelf life. Let’s discuss the step-by-step changes required to enable shelf life planning using SNP heuristics.
1. Create a custom shelf life planning book: Since it is not possible to make changes to the SAP standard shelf life planning book 9ASNP_SHLF/SHELF_LIFE, create a custom planning book for shelf life planning by copying 9ASNP_SHLF.
2. Change the execution sequence of the default macros: The shelf life macro calculates all shelf life-related key figures using the shelf life macro functions like SHLF_EXP_QUANTITY (expiring quantity calculations) or SHLF_PROJ_WASTAGE (projected wastage calculations). Figure 11 shows the various shelf life-specific macros and macro functions which are used for calculating the shelf life-specific key figures. Because these shelf life-related key figures will be used in the other calculations, you need to make sure that the shelf life macro is executed earlier than any other macros. To do this, move the shelf life macro by clicking and dragging it to the top of the default macros list as shown in Figure 12.

Figure 11
The shelf life macro showing calculation of shelf life-specific key figures

Figure 12
The sequence of the default macros
3. Update key figures names: Planners can become confused because of multiple Stock on Hand key figures with similar names. I therefore suggest you change the names of two of the key figures to avoid any confusion.
- Change the key figure Stock on Hand to Stock on Hand (All Shelf Life conditions) because it displays the stock that considers all shelf life conditions.
- Change the key figure Stock on Hand (shelf life) to Stock on Hand (Unexpired) as this key figure shows the unexpired stock but ignores shelf life conditions like minimum remaining shelf life or maximum shelf life.
4. Change the projected stock on hand calculation: You need to change the projected stock on hand calculation so that the shelf life requirements are considered in the calculation. To do this, first check the supply shortage due to shelf life conditions (as calculated in the Supply Shortage (Shelf Life) key figure). If it is there, then the projected stock on hand is set to a negative value equal to the supply shortage (shelf life) quantity as highlighted by the red box in Figure 13. For example, if the supply shortage (shelf life) is 100, then the projected stock on hand is set to -100. This is done to ensure that when SNP heuristics runs, it plans receipts to fulfill the demand that can’t be met because there is no stock available or the existing stock does not meet the shelf life requirements, such as minimum remaining shelf life.

Figure 13
Enhanced Stock Balance macro with shelf life considerations
If there is no supply shortage due to shelf life conditions, then set the Stock on hand (Projected) as equal to the Stock on Hand (Unexpired) as highlighted by the green box in Figure 13. This ensures that when heuristics runs, it does not consider the expired stock. Also, since there is no supply shortage (shelf life), it means there are no issues due to the minimum or maximum shelf life requirements that Stock on Hand (Unexpired) does not consider. In Figure 13, you can see how the Stock on Hand macro looks after this change is made so that shelf life requirements are considered in the calculations.
5. Create a custom macro to update projected wastage quantity: Create a custom macro to ensure that the projected wastage quantity also considers the shelf life conditions (Figure 14). Refer to the previous SAPexperts article “Start-to-Finish Guide to Creating APO DP Alerts Using Macro Builder” by David Ducray for a step-by-step guide on how to create a macro. This macro checks if both Supply Shortage (Shelf Life) and Stock on Hand (Unexpired) are greater than zero. If they are, the projected wastage quantity is set to the difference of the Stock on Hand (Unexpired) and Stock on Hand (All Shelf Life conditions). If they aren’t, the projected wastage quantity is left unchanged. This macro is a default macro and placed last in the execution sequence. This way, the required input data for this macro is already calculated by preceding macros.

Figure 14
Steps in the custom Macro Projected Wastage (Shelf Life)
6. Clean up the planning book: Because you have all the relevant key figures enabled with shelf life information, you can get rid of some of the key figures that are either not useful or have similar information. As you can see in Figure 15, this custom planning book (data view) has fewer key figures as compared to the SAP standard shelf life planning book 9ASNP_SHLF.

Figure 15
Custom shelf life planning book with only the relevant shelf life key figures
Because from step 3 to step 5 I modified some of the macros and included shelf life information in the calculations, I just need the following four key figures from a shelf life planning perspective. I can eliminate all the other key figures. These key figures include the relevant shelf life information and therefore there is no need to have similar key figures (one standard and another specific to shelf life) in the planning book:
- Stock on Hand (All Shelf Life conditions)
- Stock on Hand (Unexpired)
- Supply Shortage
- Projected Wastage Quantity
There is no need for a separate Supply Shortage (shelf life) key figure as I have incorporated the shelf life information in the Supply Shortage key figure. The Expiring Quantity key figure, although not of much use, can be kept in the planning book to indicate the expiry dates of batches.
SNP Planning Run Heuristics
To clearly understand how the above changes would help in shelf life planning, let’s review the shelf life scenario shown in Table 1.

Table 1
Example shelf life planning scenario
- Demand Elements: Each of the forecast requirements needs a supply that still has a minimum of five days of shelf life remaining. For example, to fulfill a demand of 50 KG on 12-01, the supply should have shelf life at least until 12-06. Similarly for the demand of 100 KG on 12-05, the supply should have shelf life at least until12-10.
- Supply Elements: There is an initial stock of 150 KG for product DPALSL3 at location DPD1. It is expiring on 12-07. The distribution receipt (planned) on 12-02 for 300 KG is expiring on 12-09 and the distribution receipt (planned) on 12-04 for 100 KG is expiring on 12-11. Both of these are fixed receipts, so the SNP planning run can’t change or delete them.
- Demand-Supply Situation before the SNP Heuristics run: Figure 16 represents the demand supply situation before the SNP heuristics run. The initial stock of 150 kg is fulfilling the demand of 50 kg on 12-01 as it meets the minimum shelf life requirement of 12-06 (the stock expires on 12-07). The demand on 12-05 for 100 kg needs a supply which has shelf life at least till 12-10. So out of the three supply elements at location DPD1 (Stock of 100, incoming supply of 300 and 100), only the incoming supply on 12-04 for 100 kg can meet the shelf life requirements as the other two supply elements are expiring before 12-10.

Figure 16
Demand-supply situation before the SNP Heuristics run
There is a supply shortage of 75 kg from 12-06 onward as there is no supply available that has a shelf life at least up to 12-11 20:00 hours. The incoming supply on 12-04 expires on 12-11 at 12:00 hours so it can’t be used. The stock of 100 expires on 12-07. So even though I have a total of 400 kg that has not expired on 12-06 (as seen in the Stock on Hand (unexpired) key figure in Figure 16), it cannot be used to fulfill the demand since it does not meet the minimum shelf life requirements.
Figure 17 shows how the demand-supply situation looks in the SAP standard planning book 9ASNP_SHLF. Because the Stock on Hand key figure does not consider shelf life conditions, it assumes that the entire demand can be met with the existing supply and there is no supply shortage. The Projected Wastage Quantity key figure also does not show the correct information as it does not consider the minimum shelf life requirements of the demand elements in its calculation. The projected wastage quantity should be shown as 400 kg on 12-06 as the supply element of 400 kg does not have the minimum shelf life remaining of 5 days (as per the requirement of the demand element on 12-06).

Figure 17
Demand-supply situation in 9ASNP_SHLF planning book
I’ll now run the heuristics in the 9ASNP_SHLF planning book and then in the custom planning book to compare the results. The results of the 9ASNP_SHLF planning book run are shown in Figure 18.

Figure 18
Demand-supply situation after Heuristics run in 9ASNP_SHLF Planning book
As you can see in Figure 18, standard SNP heuristics did not create any new receipts to meet the demand as it assumed the existing supply should be able to meet all the demand. But as explained earlier, the supply of 400 kg on 12-06 does not have enough shelf life to meet the shelf life requirements of the demand of 75 kg on 12-06. The planner has to manually create receipts so that the shelf life requirements of the demand on 12-06 are met.
The results of the custom planning book run are shown in Figure 19. You can see that after the heuristics run, the distribution receipt (planned) of 75 kg was created on 12-06 so that it can meet the shelf life conditions (minimum remaining shelf life of 5 days) of the demand on that day.

Figure 19
Demand-supply situation after SNP run in the custom shelf life planning book
Propagation of Shelf Life Data
After the SNP heuristics run is complete, the next step is to execute the shelf life propagation heuristics in SNP to propagate the shelf life conditions to the corresponding source locations or stages considering the transportation and production lead time.
As a result of the heuristics run, the distribution receipt (planned) was created for 75 kg for product DPALSL3 at location DPD1 on 12-06. This created a distribution demand (planned) of 75 kg at the supplying location DPSCVN on 12-03 as the transit time between the locations is three days. Figure 20 shows the distribution demands at location DPSCVN.

Figure 20
Distribution Demand at the source location DPSCVN
The minimum shelf life at the source location DPSCVN is calculated based on the shelf life master data maintained, which is five days. So at location DPSCVN, the stock/receipts should have a shelf life at least until 12-03 + five days, which is 12/08. This could create an issue as the minimum shelf life conditions at the locations DPD1 and DPSCVN are different. At DPD1, the product should have a shelf life of at least till 12-11 but at DPSCVN the product can have a shelf life until 12-08 only.
To rectify this mismatch, you need to execute the Shelf Life Propagation Heuristic (transaction /SAPAPO/SNP10) so that shelf life requirements are propagated from DPD1 to DPSCVN. Figure 21 shows the selection screen for executing the Shelf Life Propagation Heuristics.

Figure 21
Selection Screen for Shelf Life Propagation Heuristics
After you enter the appropriate data in the selection screen for running the Shelf Life propagation heuristics and run it by clicking the execute icon , the minimum shelf life dates are updated for various orders as seen in the application log of the Shelf Life Propagation run in the Figure 22.

Figure 22
Results of Shelf Life Propagation showing the orders which got updated
The Shelf Life Propagation Heuristics adjust the minimum shelf life requirement of the demand element at the source location considering the transportation lead time to the destination location. In this example, the Min Shelf Life date of the stock transfer order at the source location DPSCVN is updated after running the propagation heuristics. It was changed from 12-08 to 12-11, which is same as the DPD1 (destination location). Figure 23 shows the minimum shelf life requirement at DPSCVN (source location) as 12-11 as a result of the Shelf Life Propagation Heuristics run.

Figure 23
Min Shelf Life dates updated at the source location to 12-11 after the SNP Propagation Heuristics run
Mitesh Verma
Mitesh Verma has 14 years of experience in supply chain consulting, SAP APO implementation, and enhancements. He is an SAP SCM solution architect at Dorman Products specializing in multiple modules (DP, SNP, GATP, and PP-DS) of SAP APO. He has worked on supply chain projects for various clients in the high-tech, semiconductor, automotive, and food and beverage industries.
You may contact the author at mitesh.verma@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.