Creating Heuristics Using Your Own Algorithm
Purpose
You can program heuristic algorithms yourself, link them to the SAP APO system, and define heuristics. This allows you to specifically address your planning requirements.
Your own heuristics are an enhancement of the SAP 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 SAP R/3 system, you should pay particular attention to whether the changes to planning data and orders are also supported by the CIF interface and by SAP R/3. For example, inspection lots cannot be changed as standard in SAP APO. You cannot change, create, or delete inspection lots using your own heuristics, because SAP does not support the transfer of these changes from SAP APO to SAP R/3.
SAP provides BAdIs for some standard heuristics – for procurement planning heuristics, for example. 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.
Process Flow
...
1. Copy the function group /SAPAPO/RRP_HEUR_TEMPLATE under a new name. This is used as a main program for the subscreen in which you maintain settings for the heuristic. A dialog box appears that contains a list of the function modules that are to be copied. Copy and rename the following function modules:
¡ Function module for the algorithm /SAPAPO/HEU_TEMPLATE
¡ Get function module /SAPAPO/HEU_TEMPLATE_DATAGET
This function module is used to read the output structure for the screen.
¡ Set function module /SAPAPO/HEU_TEMPLATE_DATASET
This function module is used for input into the output structure of the screen.
2. Create an output structure for the subscreen in the ABAP Dictionary. You can use the structure /SAPAPO/HEU_TEMPLATE_D1000_STR as a template.
3. Replace the name of the template output structure with your output structure name everywhere this appears in the function group, for example, in the
¡ Top include
¡ Set function module
¡ Get function module
¡ Subscreen 1000
4. Use the subscreen 1000 for the maintenance of the heuristic settings.
5. The structure /SAPAPO/HEUR_SETTINGS contains the tables in which the settings for the heuristics are stored on the database. Use one of the existing tables or create your own include structure in the table structure /SAPAPO/HEURCUST.
6. Modify the function modules to ensure that the relevant settings stored in the structure /SAPAPO/HEUR_SETTINGS are copied into the relevant fields of the output structure for the subscreen.
7. Modify the get function module to ensure that the fields of the output structure are copied into the relevant fields of the structure /SAPAPO/HEUR_SETTINGS.
8. Program the algorithm function module.
The interface consists of import and export parameters.
Import parameters include:
¡ Relevant settings /SAPAPO/HEUR_SETTINGS
¡ Planning version: You must ensure that this data is transferred to SAP liveCache.
¡ Simulation version: You must ensure that this data is transferred to SAP liveCache.
¡ The structure /SAPAPO/HEUR_OBJECT_KEYS. This structure contains the tables with the planning objects (resources, line networks, products, orders, and operations).
Export parameters include:
¡ (E_CHANGED_OBJECTS). This updates the objects in the main program.
¡ (E_OBJECT_KEYS). This is used during background planning to transfer the objects from one processing step to another.
For an example of how algorithms are programmed, see the algorithm for the standard heuristic SAP001 Standard lot-sizing heuristic.
9. To integrate the heuristic into the SAP APO system, enter the following objects in the table /SAPAPO/HEURFUNC:
¡ The function module for the planning algorithm
¡ Function group
¡ The subscreen
¡ The set function module
¡ The get function module
In the table /SAPAPO/HEURFUNC, you also have to define:
¡ Where the heuristic can be executed – for example, in the production planning run or in the DS planning board
¡ The objects for which it can be executed – for example, for products or for resources
¡ Whether the heuristic is a procurement planning heuristic that you can enter in the location product master as a product heuristic
You define this using the PROD_HEUR field. After a planning run using the heuristic, the system only resets the planning file entry for a product if you have flagged the heuristic in the table as a product heuristic.
10. Create a heuristic in Customizing for Production Planning and Detailed Scheduling based on the algorithm you have defined. For more information on defining heuristics, see the Implementation Guide (IMG) for Production Planning and Detailed Scheduling (PP/DS).
You can create and connect system documentation for the algorithm.
· To create the documentation, create a Dialog Text using transaction SE61. Create and activate the text.
· To connect the documentation to the algorithm, proceed as according to SAP note 613189.
· To call the system documentation, in Customizing for Production Planning and Detailed Scheduling (PP/DS), under Maintain Heuristics, select the Information icon for the heuristic.
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/43873/viewspace-1055487/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/43873/viewspace-1055487/