Introduction
In this blog I will provide insights to a Detailed Scheduling process and the configuration of control constraints, rules, and parameters to consider different types of relationship between planning objects (Orders, operations, activities) during detailed scheduling and optimization.
Since Pegging and order internal relationships in PP/DS are commonly known and well-documented functions I will focus in this article on external / cross-order relationship and provide a template how you can setup your own custom service heuristic to maintain external cross-order relationships.
This own service heuristic can be used as template for an own developed heuristic in a project or as heuristic to prototype the planning with cross-order / external relationship.
Target audience of the blog are experts (Solution Architects, Consultants or PP/DS Developer) in Manufacturing for Planning & Scheduling (PP/DS) who are interested or responsible for the implementation of production planning and scheduling with SAP S/4HANA.
S/4HANA Manufacturing for Planning & Scheduling
As an important and integral part of the material planning process, S/4HANA Manufacturing for Planning & Scheduling …
Planning and Scheduling in PP/DS can consider different types of relationship between planning objects in scheduling.
By the Optimizer or Strategy profile you can define whether the system must consider during detailed scheduling the product availability (pegging relationships) and/or whether the system must retain time relationships between operations/activities into account. (order internal or cross-order as external relationship)
Focus of this blog will be an SAP Template function as service heuristic that maintains order external relationship.
Pegging
Pegging is used to assign suitable existing product receipts and product stocks, which can cover the requirement, to a product requirement. Pegging organizes the material flow through all BOM levels, from the procurement of components and raw materials to the delivery of a sales order, for example.
Orders that are linked together, and their pegging relationships, form a Pegging structure.
The picture below gives an example of a pegging structure. The arrows represent the pegging relationships; that is the material flow.
Example End-to-End Pegging Relationship
Pegging be used by subsequent procedures.
Based on pegging relationships, the system can:
For details refer to SAP help: Pegging
There are two different types of pegging relationships: fixed and dynamic.
Fixed pegging enables you to fix a pegging relationship. The fix pegging relationship will not be changed automatically by the system. See also SAP Note “458996 – Fixed pegging in SAP APO (documentation)”
For pegging relationships to be created, the product, location, account assignment (make-to-stock and make-to-order production) and planning version must be the same.
For details “Considering Pegging Relationships” in Detailed Scheduling refer to SAP help : Considering Pegging Relationships
Pegging should not be confused with the net requirements calculation: During planning, using the net requirements calculation, the system identifies shortages in order to then create receipts to remove these shortages. If the MRP has taken place, a pegging network will be established based on it.
Considering Time Relationships
Two activities of can be linked by a time relationship that specifies a minimum or maximum interval between the activity dates.
Taking relationships between activities into consideration means scheduling or rescheduling activities so that no minimum or maximum intervals are violated.
The following types of relationship exist:
Order-internal relationships
These include operation-internal relationships between activities in the same operation and cross-operation relationships between activities from different operations of the same order.
Cross-order relationships
external relationships link activities of different orders like internal relationships.
For details refer to SAP help: Considering Time Relationships
Considering order-internal relationships
The PP/DS system considers cross-operation time relationships when there are maintained relationships between activities with minimum and maximum intervals and in the strategy profile it is specified whether system is to consider time relationships and intervals.
The minimum and maximum intervals between operations are defined by queue times of an operation, and the wait times and transportation times.
There is a certain complexity to calculating relationship durations and implementing them in production orders and source of supply in PP/DS (PDS) and is not always easy to understand at first glance.
For details refer to SAP note “604878 – R/3->APO Relship duration w/ interoperation times, overlaps”
The note 604878 describes in detail the calculation of the durations of the relationships of two directly consecutive operations and also provides tips for dealing with situations where the visible durations in the PP/DS manufacturing order or in the PP/DS source of supply ( PDS) or the operation dates in the PP/DS manufacturing order appear to make no sense.
This note will discuss only operations for which interoperation times were defined in the form of wait times, transportation times or queue times.
The following times are analyzed as interoperation times from ERP to PP/DS:
With these times the minimum and maximum constraints are calculated for the scheduling in the Optimizer or liveCache.
There are two different types of relationships in PP/DS
Wait time – The wait time is always taken into account using a non-scheduled relationship.
Queue times – the queue time is always taken into account using a scheduled relationship. In this case, the process-related minimum interval corresponds to the minimum queue time, the planning-related minimum interval is defined using the standard queue time.
In the same way as the queue time, the transport time is always taken into account using a scheduled relationship. The process-related minimum interval corresponds to the minimum transportation time; the planning-related minimum interval is defined in the form of the normal move time.
If there is a wait time, and also a transportation time or queue time defined for an operation neither the transportation time nor the queue time is taken into account in the relationship duration. The wait time has a higher priority than a transportation time or queue time and therefore only the wait time is ever taken into account as the duration in a relationship.
Considering cross-order (external) relationships
Cross-order as external relationships link activities of different orders like internal relationships (e.g. between operations defined in a routing or production order) and allow you to define minimum and maximum intervals between linked activities of different orders .
For details refer to SAP Note “601990 – External relationships (documentation)” and / or “3109069 – External relationships in Advanced Planning (PP/DS) in S/4 HANA (documentation)”
An external relationship between activity A1 in order O1 and activity A2 in order O2 with an “end-start relationship” hierarchy structure category and a minimum interval of zero determines that activity A1 is always to be performed before A2. Such external relationships are considered by the liveCache Scheduler and PP/DS optimization.
In SAP standard cross-order relationships are relevant for subcontracting and the SAP standard system does not include options for setting external relationships explicitly for inhouse manufacturing or for displaying them.
The main reason for this is that there is no suitable master data that could be used to create external relationships in large numbers.
The SAP note “601990 – External relationships (documentation)” contains a report (“REPORT ZZ_EXT_AOB_CREATE”) that can be used to set external relationships between the activities of two planned orders or production orders.
The report only provides a simple example of how you can create external relationships. It is in no way suitable for use in practice.
Most projects start with the report REPORT ZZ_EXT_AOB_CREATE of note 601990 and customers have to develop an own heuristic from scratch.
In this blog I will show you how you can setup a custom Service heuristic to accelerate the development of an own solution.
The article provides also only a simple example of how you can create external relationships. It is also in no way suitable for use in practice. Expect no SAP Standard Support for the function module e.g. via Service incident.
You can use it to prototype your function in custom namespace and as starting point / template.
Detailed Scheduling with Pegging- and Order relationship (Configuration and Business Processes)
In the next section you will find a use case and how-to guide to setup a production planning scenario that considers fixed pegging during scheduling .
Planning and Scheduling scenario with fixed material flow by Pegging
Result of a Planning and Scheduling scenario with fixed material flow by pegging
The picture above shows the result of a planning scenario that plan with exact lot size and considers no constraints such as limited capacity or shortage or delay in the material availability.
However, in the daily business constraints and restrictions must be taken into account in real planning scenarios and thus it is required to use defined criteria to set fixed pegging relationships between requirements and receipts.
For example, in scheduling during the PP/DS optimizer the production orders have to be planned as the earliest receipt for upcoming customer requirements and production orders must not to be scheduled by the optimizer for later requirements. (e.g. Planned independent requirements)
Following an example of the process flow for delayed dispatching of production orders with SAP standard planning heuristics according to a Planning and Scheduling scenario without fixed material flow.
Finite planning on Finished Good level with delay to requirements
In the following infinite planning run (MRP) the net-requirement planning will create replenishment elements (planned orders) on time.
Demand-/Supply situation after net-requirement planning
The planned stock-/requirements result will be repegged dynamically
new dynamic Pegging result
The next finite Planning and Scheduling run by the PP/DS Optimizer that considers the new pegging relationship will schedule the production order into the future
new finite scheduling result based on dynamic Pegging
To avoid that production orders will be scheduled into the future and the planned date&time on the capacity is filled by planned orders instead , you can control how the Service Heuristic must set the fixed Pegging relationship. E.g. fixed pegging for production orders and still dynamic pegging for planned orders.
fixed Pegging for Production orders and dynamic Pegging for Planned orders
Finite Planning with fixed Pegging for Production orders
Define in Customizing user-defined heuristic to fixe Pegging relationship according to your own control parameters.
In the next section will find a how-to guide to implement and run your own defined heuristic with your own control parameters to set up fixed pegging relationship.
The heuristic based on SAP heuristic SAP_PP_019
(Algorithms /SAPAPO/HEU_PEG_FIX_CREATE)
Maintain Heuristic in Customizing IMG
Copy SAP algorithms to define your own heuristic to fix Pegging relationship.
Transaction: SPRO
Advanced Planning -> Heuristics -> Maintain Heuristic
On View ‚Change Heuristic‘ mark the SAP Standard Heuristic “SAP_PP_019 Fix Pegging Relationships” and copy it to customer namespace e.g. ‘ZPEG…’
SAP Standard Heuristic in Customizing
On the Screen ‘Heuristic Settings’ enter the following Parameter as selection criteria to fix Pegging-relationships ( example)
Field | Value | Description |
Heuristic | ZTAA_PP_019 | Fix Pegging Relationships |
Algorithmus | /SAPAPO/HEU_PEG_FIX_CREATE | Name of the Function Module / algorithm to create fixed Pegging relationship |
User-Defined Settings | ‚X‘ – Flagged | User-Defined Settings for Fixed Pegging Relationship |
Filter for Requirements | e.g. ‚FA‘; ‚BM‘ | ATP Category FA Planned independent requirements, BM Sales Order (for multi Level e.g. prod.order reservation) |
Filter for Receipts | e.g. ‚AC‘, ‚AD‘ | AC Production Order (Created) AD Production order (released) |
Assignment Strategy | Use Earliest Receipts (FIFO) | The Heuristic assigns the receipt with the earliest availability date to the requirement. These are typically Prod.Orders in the short term and Planned orders in the medium/long term |
For details on User-Defined Settings refer to the SAP Help: SAP_PP_019 Creation of Fixed Pegging Relationships -> User-Defined Settings
own Service Heuristic as copy of SAP_PP_019
Define Heuristic profile that includes your own new customized heuristic to fix Pegging relationship.
Transaction: SPRO
Advanced Planning -> Heuristics -> Maintain Heuristic profiles.
Create for example the following Heuristic profile.
Field | Value | Description |
Heuristic profile | ZTAA_001 | Own heuristic profile for PP |
Heuristic | SAP_PP_002 | Planning of Standard Lots |
Heuristic | ZTAA_PP_019 | Fix Pegging Relationships – SAP_PP_019 |
Heuristic Heuristic | SAP_PP_011 | Delete Fixed Pegging Relationships |
Customized Heuristic Profile
To test the scenario in an PP/DS for SAP S/4HANA System and to call the heuristic from the Product view (transaction /SAPAPO/RRP3) you have to assign the heuristic profile in the User Settings.
Execute Heuristic ‘ZTAA_PP_019 – Fix Pegging Relationship’ from Product View
Product View with Requirements (Forecast) and Receipts (Production and Planned Orders)
Pegging View with dynamic Pegging
Execute own customized Heuristic as Variable Heuristic
Pegging View with dynamic Pegging for Planned orders and fixed Pegging for Production orders.
For fixed pegging the system differentiates between automatically (created by the system/heuristic) and manually created pegging relationships.
The following indicators for the Pegging type can be displayed:
As result of the Heuristic the Productions orders have a fixed relationship to the demand and a planning run with MRP and Optimization (see scenario above) will not schedule the production orders into the future
Define in user-defined heuristic to create external (cross-)order relationships.
As described in PP/DS, the orders from different production stages are connected to each other via “pegging relationships”.
For example, the planned orders can be linked between End Product and Component via Pegging, but it is not possible to specify a minimum or maximum interval between 2 different orders in the PP/DS for SAP S/4HANA standard system.
Without an order relationship between the manufacturing ( production- or planned-) orders, PP/DS can schedule the manufacturing orders as far apart as you like.
In some Business scenarios it is required to restrict the min. or max. time period between the production stages e.g. mixing and bottling due to the short shelf life of the mixture (as example).
However, orders with a pegging relationship may be a logical unit and should be rescheduled in a coherent manner.
Planning and Scheduling scenario with fixed material flow (w Pegging and Cross-Order relationship)
A function for the automatic creation of external relationships is to be created via a custom development. External (cross-order) relationships are necessary in order to take into account the minimum and/or maximum distance between orders of two levels during optimization.
This means that the following general implementations need to be done:
The following picture below shows the situation before the implementation of a Cross-Order-Relationship Heuristic and the result after the implementation the heuristic when the heuristic has ensured that external constraints have been added to the manufacturing orders.
As shown on scenario 1 orders on the End Product level can be moved from the Component level without any time restriction.
On scenario 2 the orders on the Component level will be “forced” to be finished (by scheduling) latest a defined max. time before the manufacturing of the End product will start.
The template heuristic will only create external / cross-order relationship for orders that are connected to each other via a ” fixed pegging relationships”.
Scheduling of orders w/o external order relationship (min., max.time) and with external order relationship
Define your own heuristic to maintain external (cross-order) relationship.
In the next section you will find a how-to guide to setup your own heuristics in PP/DS to maintain the external cross-order relationship.
As mentioned at the beginning of the blog the heuristic can be used as template for an own developed heuristic in a project (e.g. developed by a consulting partner or inhouse IT) or as own heuristic to prototype the planning with cross-order / external relationship.
Your own heuristics are an enhancement of the SAP PP/DS planning processes. Note that even small changes or enhancements to the planning processes can lead to unexpected planning results. Any changes or enhancements you make are at your own risk. SAP cannot be held responsible for any defects or malfunctions resulting from changes or enhancements to the software.
In an integrated system landscape with an ERP system, you should pay particular attention to whether the changes to planning data and orders are also supported by the integration to SAP-ERP.
SAP provides BAdIs for some standard heuristics . Before you program your own heuristics, check if you can use a BAdI. For more information, see the Implementation Guide for Production Planning and Detailed Scheduling (PP/DS) under Business Add-Ins for PP/DS.
Customizing Heuristic /SAPAPO/HEU_EXT_CONSTRAINTS
Maintain the function module /SAPAPO/HEU_EXT_CONSTRAINTS in customizing table /SAPAPO/HEURFUNC
PP/DS heuristics in Table /SAPAPO/HEURFUNC
Call transaction SE11 – table /SAPAPO/HEURFUNC
Execute ‚Utilities -> Table Contents -> Create Entries
Enter available heuristic in SAP table /SAPAPO/HEURFUNC
Enter the following data
Field | Value | Description |
Algorithm/ FUNCTION | /SAPAPO/HEU_EXT_CONSTRAINTS | Function name (FUNCTION) |
Program Name/ REPID | /SAPAPO/SAPLRRP_HEUR_CONSTRAIN | Program Name |
Screen / DYNNR | 1010 | Screen Number |
Function for Data Set / DYN DATA SET | /SAPAPO/HEU_EXT_D1010_DATASET | Function name |
Function for Data Get/ DYN DATA GET | /SAPAPO/HEU_EXT_D1010_DATAGET | Function name |
Plng table heuristc | ‚X‘ Flagged | Heuristic for the planning table |
Background heuristic | ‚X‘ Flagged | BckgrndHeurist |
Product heuristic | ‚X‘ Flagged | Product Heuristic |
Valid for Orders | ‚X‘ Flagged | Valid for Orders |
Valid for Products | ‚X‘ Flagged | Valid for Products |
View for /SAPAPO/HEURFUNC
Maintain the algorithms as your own heuristic to create/change/delete cross-order relationship.
Transaction: SPRO
Advanced Planning -> Heuristics -> Maintain Heuristic
On the Screen ‘Change Heuristic’ execute function ‘New Entries’ and enter the following ( example)
Field | Value | Description |
Heuristic | ZHEU_EXTCON0 ZHEU_EXTCON1 |
0 = Delete and Create External/Cross order relationships 1 = Delete External / Cross order relationships |
Algorithm | /SAPAPO/HEU_EXT_CONSTRAINTS | Name of the Function Module / algorithm to create fixed Pegging relationship |
Processing mode | 0 or 1 | 0 = Delete and Create External/Cross order relationships 1 = Delete External / Cross order relationships |
Constraint-Typ | 2 | 0 Minimum Interval (Minimum Constraint) 1 Maximum Interval (Maximum Constraint) 2 Min./Max. Interval (Combination Min. and Max.) 3 Min.interval = Max.Interval = 0 (Equal) |
Constraint-Subtyp | Blank | Not relevant for Blog 0 GC_STANDARD_ 1 GC_LINE_SEGMENT_CONSTR 2 GC_BUFFER_TIME_CONSTR in 3 GC_LINE_SEGMENT_BUFF_CONSTR 4 equal slot |
Constraint Ref. Type |
2 | 0 Start-Start Relationship 1 Start-End Relationship 2 End-Start Relationship 3 End-End Relationship |
ModLinkTyp | Blank | not relevant 0 gc_resource_independent 2 gc_identical_resource 3 gc_identical_mode_no 5 gc_compatible_resource |
Minimum Time |
e.g. 3.600 sec (1h) | Min.Time in Seconds – |
Max.time | e.g 28.800 sev (8h) | Max. Time in Seconds |
Min.time unpl.act. | Minimal Offset in Case of an Unplanned Activity | |
Note
It can be useful in complex planning situations not to consider the maximum intervals so that the system can (more easily) find a solution in detailed scheduling, which can be used as a starting point for further planning.
Customizing heuristic to Delete and Create external order relationship
Enter new heuristic in to the Heuristic profile of the previous scenario that includes already your own new customized heuristic to fix Pegging relationship.
Transaction: SPRO
Advanced Planning -> Heuristics -> Maintain Heuristic profiles.
Create for example the following Heuristic profile.
Field | Value | Description |
Heuristic profile | ZTAA_001 | Own heuristic profile for PP |
Heuristic | SAP_PP_002 | Planning of Standard Lots |
Heuristic | ZTAA_PP_019 | Fix Pegging Relationships – SAP_PP_019 |
Heuristic | SAP_PP_011 | Delete Fixed Pegging Relationships |
Heuristic | ZHEU_EXTCON0 | Delete and Create External/Cross order Rel |
Heuristic | ZHEU_EXTCON1 | Delete External/Cross order Rel. |
Customized Heuristic Profile
As mentioned, the heuristic will only create external / cross-order relationships for those orders that have already a fixed pegging relationship.
For this scenario you can also fix the pegging relationship between orders manually in the product view
The Planning of the heuristic is bottom-up (Default) according to the Pegging overview in the product view
Fix Pegging relationship Component Receipts to requirements of End product manually and execute Heuristic to create External / Cross-order relationship
Following to the Heuristic run you can check the Min.-& Max. time interval in the operation that provides the Component as output to the component requirement of the End Product order
Relationships in order detail
The last operation of the order of Component Product ‘TAA_SFG_10’ has a Min. (1h) and Max.(8h) interval to the order of the End Product TAA_FG_10 (Order 1929437 Operation 0040 to the first operation 0010 of order 1929421.
With the heuristics to maintain the fix pegging relationship and heuristics to maintain the external / cross-order relationship you can now consider more constraints during Scheduling and Optimization of PP/DS for SAP S/4HANA and run an end-to-end scenario to optimize the planning and scheduling of your end-to-end bill-of-material.
I hope you enjoyed this blog and gained more insights about the control constraints, rules and parameters for Considering Time Relationships in Scheduling and Optimization of PP/DS for SAP S/4HANA