# SAP F&R: The process of creating orders. Part 1

Hello, Habr! Today I’ll talk about the process of creating orders in the SAP F&R system with examples and calculations.

I remind you that SAP F&R is a demand forecasting and inventory management system at the target location-supplier location level. The system is part of the SAP SCM (supply chain management) solution and is implemented in two variations:

All SAP F&R functionality can be divided into 4 main blocks:

SAP F&R is supplied with sales data broken down by product-location, stock history, basic data of goods and suppliers, pre-defined delivery schedules and some configuration parameters that allow the system to function effectively in accordance with the retailer’s business.

It often happens that the retailer’s sales statistics are incorrect (unexplained peaks, lost days, underestimated sales due to shortages) are acceptable. SAP F&R can handle inaccurate input. The point of clearing statistics from extraneous values is to avoid the influence of an extraneous value on the sales forecast. F&R first detects extraneous values and then replaces them with a local average sales value. The local average is the average between adjacent weeks, relative to the week with the extraneous value.

In the figure we see several unexplained bursts (peak sales). Black line - real statistics, red line - adjusted sales values.

Detection: To detect an extraneous value in the event of a peak, F&R calculates how strongly the value of the weekly sales of the peak or recession deviates from the local average weekly sales, taking into account the neighboring weeks (two weeks on one side and two on the other). If the deviation from the local average> Standard deviation of the time series * is a coefficient, then such weekly sales are considered an extraneous value. The coefficient is set in the settings. Deviation from the local average = local average of weekly sales - the value of the sales of a particular week, taken modulo. The standard deviation of the time series is calculated for all the weeks for which the sales history is provided.

The figure shows the explicit wholesale distribution of the product and, as a result, zero inventory or shortage. Days with a shortage of goods lead to incorrect sales statistics (lost sales are not taken into account). The system also corrects such values.

Detection: Data on zero stock is also uploaded to the system as input data. Goods for which the stock was zero on some days of the week have underestimated sales per week. The system adds to weekly sales value = (Local average * the number of days with a deficit per week) / the number of working days per week.

The system also adjusts the sales history for too long consecutive periods of low weekly sales.

Detection: The detection length of consecutive weeks is set in the settings. If for several weeks, where their number is not less than the specified length, consecutive weekly sales are less than the specified threshold value, then the system considers these weeks to be weeks of understated sales and adjusts the sales history for these weeks in accordance with the local average.

In this block, the system predicts average sales (or average forecast). The average forecast in SAP F&R terminology is such a value of the volume of goods at a location that with a probability of 50% will satisfy the demand of customers in the store, or, in other words, will ensure the level of customer service = 50%. The average forecast is not the final result put to the order.

To build an average forecast, the SAP F&R system uses sales forecasting models that take into account not only static consumption data, but also the influence of external factors, such as calendar events or promotions. The effect of such factors can be set either manually or automatically detected by the system in the past. Thus, in the formation of the forecast model of the time series both in the past and in the future, SAP F&R uses data on a possible change in the predicted value and imposes the effect of an external factor on the smoothed series.

As you can see in the figure, when forming the forecast model in the past, SAP F&R clearly revealed seasonal fluctuations in sales and peak surges in the New Year period and periods of other holidays.

As mentioned above, when calculating the average forecast, the system takes into account not only the behavior of sales in the past, but also some features of the business. For a more flexible adjustment of the forecast model, all product-location combinations are divided into 6 groups according to the turnover speed: quick-turn 1, quick-turn 2, medium-turn 1, medium-turn 2, low-turn 1, low-turn 2. The boundaries of the values according to which the groups are distributed are set in the settings. Distribution into groups is a dynamic process, a product can relate to one group as well as to another in case of increase / decrease in the turnover rate. Many business settings in the system are carried out in the context of these groups.

Also, on the basis of a group of goods according to the turnover rate, a forecast model is automatically selected in the system:

Methods can also be configured manually at the request of the client’s company.

After choosing a forecasting method, the system automatically calibrates the forecasting model (calculates and selects the smoothing factors, trend, adaptability, etc. based on the smallest forecast-fact error in the past).

The system uses 3 main groups of factors affecting demand:

In F&R, new products are predicted in 2 scenarios:

When specifying an analogue from the same store, the sales history of the predecessor product “sticks” to the tail of the new product. The system predicts based on the sales statistics of the predecessor's product. There is no real sales history (black line). Red line: the history of an analogue product.

Also SAP F&R can take into account periods of temporary exclusion of goods from the assortment matrix, the mutual influence of sales (when beer sales affect chip sales, for example), the use of a link module to predict sales of new products (combining the sales history of several products), etc. . etc. to achieve the most accurate result.

As I wrote above, as a result of the module’s work, an average forecast is formed - such a value of the product’s volume at a location that with a probability of 50% will satisfy the demand of customers in the store, or, in other words, will ensure the level of customer service = 50%.

In order to avoid lost sales, the target level of customer service, as a rule, is planned at least 95%. This means that in 95 cases out of 100, the customer will buy what he planned in the store. Providing a high level of service in SAP F&R is carried out by means of an insurance premium to the average forecast, which depends not only on the target level of service, but also on the variability of the past sales values of the goods. Thus, the maximum sales forecast is generated in the system, the volume of which will be enough to minimize the stock in the warehouse or store (and, therefore, the withdrawal of capital frozen in stocks) and comply with the target level of customer service.

In the second part I’ll talk about calculating needs and optimizing the quantity of goods in an order.

Read my SAP F&R publications:

»Overview: SAP F&R today and tomorrow is the future of sales forecasting

. The Art of Forecasting in SAP F&R Inventory Management

I remind you that SAP F&R is a demand forecasting and inventory management system at the target location-supplier location level. The system is part of the SAP SCM (supply chain management) solution and is implemented in two variations:

- SAP F&R SCM - implementation with seamless integration with SAP systems;
- SAP F&R OI is a system for integration with non-SAP systems.

All SAP F&R functionality can be divided into 4 main blocks:

- Input Processing
- Prediction calculation
- Requirement calculation
- Need optimization

SAP F&R is supplied with sales data broken down by product-location, stock history, basic data of goods and suppliers, pre-defined delivery schedules and some configuration parameters that allow the system to function effectively in accordance with the retailer’s business.

### Input Processing

It often happens that the retailer’s sales statistics are incorrect (unexplained peaks, lost days, underestimated sales due to shortages) are acceptable. SAP F&R can handle inaccurate input. The point of clearing statistics from extraneous values is to avoid the influence of an extraneous value on the sales forecast. F&R first detects extraneous values and then replaces them with a local average sales value. The local average is the average between adjacent weeks, relative to the week with the extraneous value.

*Example 1. Correction of peak values.*In the figure we see several unexplained bursts (peak sales). Black line - real statistics, red line - adjusted sales values.

Detection: To detect an extraneous value in the event of a peak, F&R calculates how strongly the value of the weekly sales of the peak or recession deviates from the local average weekly sales, taking into account the neighboring weeks (two weeks on one side and two on the other). If the deviation from the local average> Standard deviation of the time series * is a coefficient, then such weekly sales are considered an extraneous value. The coefficient is set in the settings. Deviation from the local average = local average of weekly sales - the value of the sales of a particular week, taken modulo. The standard deviation of the time series is calculated for all the weeks for which the sales history is provided.

*Example 2. Correction of the history of understated due to lack of sales data*The figure shows the explicit wholesale distribution of the product and, as a result, zero inventory or shortage. Days with a shortage of goods lead to incorrect sales statistics (lost sales are not taken into account). The system also corrects such values.

Detection: Data on zero stock is also uploaded to the system as input data. Goods for which the stock was zero on some days of the week have underestimated sales per week. The system adds to weekly sales value = (Local average * the number of days with a deficit per week) / the number of working days per week.

*Example 3. Correction of consecutive underestimated sales.*The system also adjusts the sales history for too long consecutive periods of low weekly sales.

Detection: The detection length of consecutive weeks is set in the settings. If for several weeks, where their number is not less than the specified length, consecutive weekly sales are less than the specified threshold value, then the system considers these weeks to be weeks of understated sales and adjusts the sales history for these weeks in accordance with the local average.

### Prediction calculation

In this block, the system predicts average sales (or average forecast). The average forecast in SAP F&R terminology is such a value of the volume of goods at a location that with a probability of 50% will satisfy the demand of customers in the store, or, in other words, will ensure the level of customer service = 50%. The average forecast is not the final result put to the order.

To build an average forecast, the SAP F&R system uses sales forecasting models that take into account not only static consumption data, but also the influence of external factors, such as calendar events or promotions. The effect of such factors can be set either manually or automatically detected by the system in the past. Thus, in the formation of the forecast model of the time series both in the past and in the future, SAP F&R uses data on a possible change in the predicted value and imposes the effect of an external factor on the smoothed series.

As you can see in the figure, when forming the forecast model in the past, SAP F&R clearly revealed seasonal fluctuations in sales and peak surges in the New Year period and periods of other holidays.

As mentioned above, when calculating the average forecast, the system takes into account not only the behavior of sales in the past, but also some features of the business. For a more flexible adjustment of the forecast model, all product-location combinations are divided into 6 groups according to the turnover speed: quick-turn 1, quick-turn 2, medium-turn 1, medium-turn 2, low-turn 1, low-turn 2. The boundaries of the values according to which the groups are distributed are set in the settings. Distribution into groups is a dynamic process, a product can relate to one group as well as to another in case of increase / decrease in the turnover rate. Many business settings in the system are carried out in the context of these groups.

Also, on the basis of a group of goods according to the turnover rate, a forecast model is automatically selected in the system:

- Simplified forecasting methods (moving average, weighted average, etc.) are selected for new products whose sales history does not exceed 6 weeks.
- Constant methods (forecast = n) are used for goods with a low turnover rate.
- Methods based on exponential smoothing and regression analysis are applied to all goods, if an external factor affecting demand acts on sales.

Methods can also be configured manually at the request of the client’s company.

After choosing a forecasting method, the system automatically calibrates the forecasting model (calculates and selects the smoothing factors, trend, adaptability, etc. based on the smallest forecast-fact error in the past).

__Factors affecting demand.__The system uses 3 main groups of factors affecting demand:

- Boolean factors: an event of a Boolean factor consists of two possible situations: the factor is either valid or not (for example, advertising events, holidays, other calendar events). F&R estimates the effect on sales of goods at a store that was in the past due to an event of a factor, for example, a rise factor of 1.5 caused by an advertising event. If a factor event with the same indicator occurs in the future for the same product and store, the system will calculate its expected effect on the forecast. The figure shows the action of PROMO factors, and the new year (+ weeks before the new year). The reaction to other factors is not so obvious. The forecast (blue line) is calculated taking into account the effect of the factor “Until the new year”.
- Metric factors: the factor has a certain value at any time (for example, price dynamics). The system evaluates the correlation between sales values under the influence of a factor and the history of consumption of goods. If a discount is used as the metric FVS, then during periods of no discount the value of the FVS should be determined and equal to 0.
- Ignore factor: events of this factor are used to exclude certain periods of the sales history from statistics, since they are not correct values (for example, the repair period of a part of a store, etc.).

__Prediction of new products__In F&R, new products are predicted in 2 scenarios:

- Simplified: manual order or forecast using average methods until the necessary history of goods is obtained;
- Complex: an indication of the product of the predecessor from the same store.

*Example 4. Prediction of new products*When specifying an analogue from the same store, the sales history of the predecessor product “sticks” to the tail of the new product. The system predicts based on the sales statistics of the predecessor's product. There is no real sales history (black line). Red line: the history of an analogue product.

__Additional functionality__Also SAP F&R can take into account periods of temporary exclusion of goods from the assortment matrix, the mutual influence of sales (when beer sales affect chip sales, for example), the use of a link module to predict sales of new products (combining the sales history of several products), etc. . etc. to achieve the most accurate result.

As I wrote above, as a result of the module’s work, an average forecast is formed - such a value of the product’s volume at a location that with a probability of 50% will satisfy the demand of customers in the store, or, in other words, will ensure the level of customer service = 50%.

In order to avoid lost sales, the target level of customer service, as a rule, is planned at least 95%. This means that in 95 cases out of 100, the customer will buy what he planned in the store. Providing a high level of service in SAP F&R is carried out by means of an insurance premium to the average forecast, which depends not only on the target level of service, but also on the variability of the past sales values of the goods. Thus, the maximum sales forecast is generated in the system, the volume of which will be enough to minimize the stock in the warehouse or store (and, therefore, the withdrawal of capital frozen in stocks) and comply with the target level of customer service.

In the second part I’ll talk about calculating needs and optimizing the quantity of goods in an order.

Read my SAP F&R publications:

»Overview: SAP F&R today and tomorrow is the future of sales forecasting

. The Art of Forecasting in SAP F&R Inventory Management