SAP S/4HANA Project Manufacturing Management & Optimization – Flexible Enhancement via Subclasses
SAP Project Manufacturing Management and Optimization in S/4HANA offers capability to combine material requirements from multiple WBS elements across Projects into one or more grouping WBS elements to help achieve greater efficiency and cost savings across the production chain for Project based Manufacturing.
In this blog post, I would like to highlight the enhancement capabilities for partners and customers within Project Manufacturing Management and Optimization. Often customers and partners have requirements to enhance the standard solution, but left with limited options: either using a BADI that standard offers, implicit enhancement or enhancing via a modification, which is not too ideal.
In Project Manufacturing Management and Optimization, we offer flexibility to enhance the standard without BADIs (in most cases). This is primarily achieved using subclasses for standard delivered classes. For more information, see this link.
Under Technical Settings (transaction code PMMO_IMG), you will find the IMG node highlighted below:
How to enhance using Subclass
You must first know which class you are trying to subclass. Let’s take an example that you want to enhance the standard class CL_PMMO_PEG_BRKPT_PROCESSOR to change the standard behavior regarding how breakpoints are processed. This class has a method DETERMINE_BREAKPOINT that you have identified you want to override.
Creating a subclass is straightforward and easy. You open the class you want to create a subclass for (in this example CL_PMMO_PEG_BRKPT_PROCESSOR) in transaction code SE24. In the menu, click on “Create subclass”.
Provide a description, choose your package and save.
Switch to edit mode and in the methods tab. select the method DETERMINE_BREAKPOINT and click on the icon “Redefine Method”. Here you can add your custom code.
For example, I have used the subclass to change the sequence in which the breakpoint record is applied:
(Note: The sample code below is for illustrative purpose only)
Save and activate the class and method.
Note: In case you use the PMMO RTM (Run Time Measurements) macro, you have to add the statement “INCLUDE rpmmo_rtm_macros.” from the menu: Goto > Local Definitions/Implementations > Macros.
Now add your subclass in the IMG and set the Active flag.
Note that I have added the subclass only for user TESTER. Once I have tested it, then I will create an entry without a user and I can transport the change to productive system.
You can use the compare icon to see the code changes compared to the standard class method either for an individual entry or for all entries.
Productive vs. Non Productive System
Note that the configuration provides capability to enter a subclass for a specific user id or without specifying an user id. If you enter a subclass for a specific user id, then the system executes the subclasses entered for the specific user id logged on. However this is only possible in a non-productive environment. In a productive environment, any entries that have the user id filled will be ignored and only entries without the user id filled are considered during runtime.
In the below example, both the subclasses for the two standard delivered classes will be executed in a non productive environment for user id TESTER. For all other users, only the subclass Z_CL_PMMO_PEGDIS_UTILITIES will be executed. In a productive system, only the subclass Z_CL_PMMO_PEGDIS_UTILITIES will be executed for all users.
The subclass entered must not have syntax errors, otherwise saving the configuration after you make changes is not possible.
This solution provides offers several advantages:
- In your test system, you can always enhance the standard coding and try out fixes (for e.g. before you get an SAP Note) non-disruptively. For e.g., if you have identified a bug, you could use a subclass temporarily to test the fix by specifying the subclass only for the specific user and all other users do not see your changes until they are ready and fully tested.
- Business requirements that are custom specific can be quickly implemented and tested in a non-disruptive manner.
- You can see all your custom enhancements within Project Manufacturing Management and Optimization in one central place, without having to navigate through packages and IMG nodes for BADIs.
- Quick and easy activation or de-activation of the subclasses.
- Ability to quickly compare standard vs. custom enhancement in the subclass.
Note that the class method interfaces could change with the next release of Project Manufacturing Management and Optimization and one or more subclasses may need to be adjusted to avoid syntax errors after the upgrade.
In summary, the subclass offers increased flexibility to enhance Project Manufacturing Management and Optimization to meet your business needs. Feel free to post your comments and questions. More blog posts to come on Project Manufacturing Management and Optimization.