Skip to Content
Product Information
Author's profile photo Emanuel Klenner

Enhancements in SAP S4 HANA Project Manufacturing Management and Optimization (PMMO)

Introduction

This article will give you an understanding of the two main options that allow you to make enhancements to the PMMO application.

Note: Option 2 requires the use of option 1 but in contrast to option 1 you are not bypassing any SAP delivered coding. This might save you some headaches during an upgrade or support package installation.

Use of Events in PMMO

With the on premise 2022 release (Release To Customer on 10/12/2022) the development team has introduced more than 30 ABAP OO events that can be used by customers and/or partners to influence the behavior of the PMMO application.

This new enhancement approach was integrated into the PMMO implementation guide (transaction PMMO_IMG):

PMMO%20IMg

PMMO IMG

The IMG node was also down ported to the 2021 release via note 3198543 but there you will not find  many events.

Executing the IMG activity will lead you to this screen:

In the list output you can see the PMMO classes and the public events that the classes publish.
On the right hand side you see an icon, indicating that documentation for the event exists.

If you click on the documentation link, you will see a screen like this:

As the documentation indicates, we deliver a sample class CL_PMMO_PEG_UTIL_CUST_ENH_EX to show you how to use the delivered events.

Let’s take this example and start from scratch to see how we get to this point.

Edit Pegging Records in PMMO 2022

We are running transaction PMMO_PEGGING to display the current assignments in the database.

We select a lot of records and then click the ‘Change Assignments’ button.

The system has limited the number of records that can be edited to 100.

Now we want to implement the event handler that allows us to increase this limit to 250.

Implement an Event Handler

For that we go back to our IMG listing of the available events (the shortcut to get there is transaction PMMO_DISPLAY_EVENTS) :

Click the hotspot on the SAP delivered class: CL_PMMO_PEGGING_UTILITIES:

Select the GUI option ‘Create subclass’:

Create the class in your own namespace. Make sure that the instance generation is set to ‘Public’.

Next, create a CONSTRUCTOR method for the class:

We’ll come back to the constructor in a minute but first we have to create an event handler
method for the event we want to process:

The typical naming convention for an event handler method is ON_name_of_the_event.
Once you have entered the method name, click on the detail button highlighted above.

The method has to be marked as an event handler method for the class/event that we want to process.

When this is complete, switch to the Parameters of the method:

Click on the button ‘Event Parameters’ to copy the parameters into your event handler method:

The parameter has been copied to the method.

In the method itself, we change the number of records that can be processed:

Since the event parameter is a reference, we can address it via the ‘->*’ selector.

Now the method is ready for use.

It’s time to go back to the constructor method and register the method we just created for the actual event handling:

You have to call the super constructor first before you can use the SET HANDLER command.

Everything is ready now from a coding perspective. The last step we need to complete is the registration of the class in the PMMO subclass manager.

Register Class in Subclass Manager

Go to the PMMO IMG and choose the option ‘Replace SAP PMMO Classes with Customer Classes’.

Execute the activity and select the button ‘New Entries’:

You can choose to run the code only for your user ID or for all users (in this case leave the User ID field empty). In a production client the code can not be run for an individual user. The User ID field must be empty.

In the Class field you enter the standard PMMO class you want to enhance. Use the F4 help on the Subclass field to select your class. As you can see the standard delivered class CL_PMMO_PEG_UTIL_CUST_ENH_EX is also shown, since it inherits from CL_PMMO_PEGGING_UTILITIES as well.

Activate the entry to complete the setup.

Test the Enhancement

Run Pegging Display again:

Select a lot of records and try to change them:

Now we get an error message that reflects the changes we made:

We have successfully implemented an enhancement via PMMO events!

Other Events

The previous example is a simple event with one parameter. Most events have multiple parameters and many offer a parameter ER_DO_NOT_EXECUTE, as in the following example:

If you set this parameter ER_DO_NOT_EXECUTE->* = ABAP_TRUE in your event handler method
then the system will skip the processing of further code in the standard implementation.

Need for Additional Events

We are aware that the events we deliver will not cover all the scenarios were you would like to add/change functionality in the PMMO application.

If you have a need or suggestion for additional events, please send us a customer message
on component LO-PMM and explain your scenario to us. We would be happy to provide
additional events as needed.

Multi Level Inheritance

Does this concept support multi-level inheritance and how does it work?
Yes, it does and we will look at how it works now.

You might need this if you work with one of our partners and they deliver add-on functionality to PMMO via their classes.

Let’s assume that partner A delivers a class to you that implements an event handler for the event
CHECK_IN_STK_INDICTR of class CL_PMMO_UTILITIES. You also want to enhance the standard SAP class.

Here is the class that the partner delivers:

It is important that the partner class is not marked as final:

Now you can create a class that inherits from the partner class:

Attributes of your class:


This class can be final, unless you want/need additional subclasses.

This is what the inheritance hierarchy looks like:

In the subclass manager you have the following entry:

In the Subclass field you specify the class with the lowest level in the inheritance hierarchy that you want to process. Because of the inheritance the partner class as well as the customer class will be processed.

Note that the F4 help shows all classes that inherit from CL_PMMO_PEGGING_UTILITIES, even though they might not directly inherit from it. This display feature is only available starting with the PMMO 2022 release .

In the 2021 release the ZCL_PMMO_PEGGING_UTILITIES class would not show in the F4 help but you can
still enter it in the Subclass field and the inheritance functionality will work just fine.

Another nice feature available starting with the 2022 release is the inheritance display in the subclass compare function:

After you click the ‘Compare’ button, you will see this:

The system has recognized that we have an inheritance chain active and displays that in the list.

Click the hotspot ‘Multi Level Inheritance Hierarchy’ and you will see this:

Local Classes in Reports

The final piece in the PMMO enhancement puzzle are local classes in reports. This was either done because there didn’t seem to be a need for a global class or because of a tight integration of the class and the screen/view cluster functionality, e.g. for the change pegging transaction.

These local classes still support the subclass enhancement concept but the implementation is slightly different.

With transaction PMMO_CSUBCL you can see the global and local classes that support our enhancement concept:

Let’s take class LCL_RTM_DISPLAY in report RPMMO_DISPLAY_RTM as an example:

You can see that most of the methods in the local class have to do with the ALV functionality to display the data.

Note the statement INCLUDE ZRPMMO_DISPLAY_RTM IF FOUND.
Each report with local classes will have one or more INCLUDE report_name IF FOUND statements.

This is intended for you to enhance the local class, if so desired.

The includes are in customer namespace and do not exist in the SAP standard delivery.

Double click on the Z include name to create the object:

In the new include we can define the subclass and the functionality we want to implement:

Here we are just making a field visible that was set to TECH in the standard delivery.

When we are done with the enhancement in the report, we still need to register the new subclass in the subclass manager:

Note that now the fields Class and Program are filled. This is done automatically if you use the F4 help on the Class field and pick the appropriate local class/program combination.

The F4 help for local subclasses is only available starting with the PMMO 2022 release. In the 2021 release you will get a message that an F4 for local subclasses is not available but you can just copy and paste the local class name from the report.


Make sure to set the entry to Active.

Now you have also implemented a subclass enhancement for a local report.

At this time we do not have events available in the local classes but if one is needed, please let us know.

Summary

I hope that you now have a good understanding of the enhancement concept in the PMMO application.

The use of events is preferable and less disruptive then overriding methods delivered in the standard solution. It is the way we would recommend for you to enhance the PMMO solution.

Good luck with your implementation and we are looking forward to your feedback.

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.