2012 Mar 16 2:51 AM
In trying to enhance a standard class with a new event handler class, I find that the ECC 6.0 EHP4 system does not appear to recognise the fact the method is an event handler method. The specific example is a new method to handle the event CL_GUI_ALV_GRID->USER_COMMAND.
I notice that the flag called Active has not been ticked - see image below. Perhaps this is the reason why the event handler is not being triggered.
Note that there is an event handler for the same event in the standard class which obviously is executed as expected. Any ideas on limitations in the system or I am missing a step?
Thanks
John
2012 Mar 19 9:31 PM
Looks like SAP doesn't allow to create event handler methods in the Enhancements, even the parameters are not getting inherited from the Event.
But for your purpose, I would suggest to add a Post-Exit method for the event handler method HANDLE_USER_COMMAND. This way you don't need to worry about registering your custom method as the event handler method using SET HANDLER.
Regards,
Naimesh Patel
2012 Mar 16 3:55 AM
Halo John,
Why do you want to enhance standard class with Event handler method. Ideally the event handler method for CL_GUI_ALV_GRID->USER_COMMAND event should be part of your class( Z namespace ).
Regards
Arshad
2012 Mar 20 9:19 PM
Thank you for your replies.
There is a bug in the ALV handler of a standard SAP class (when executed in ITS WebGUI) and I was hoping to create a custom event handler as an Enhancement to execute some custom code to sort of "handle the bug".
I agree - ideally it should be done in a Z class but that will not give me access to the object methods and attributes of the enhanced class.
Cheers,
John
2012 Mar 19 9:31 PM
Looks like SAP doesn't allow to create event handler methods in the Enhancements, even the parameters are not getting inherited from the Event.
But for your purpose, I would suggest to add a Post-Exit method for the event handler method HANDLE_USER_COMMAND. This way you don't need to worry about registering your custom method as the event handler method using SET HANDLER.
Regards,
Naimesh Patel
2012 Mar 20 9:35 PM
Hi Naimesh,
Unfortunately this does not work as the following error message is raised "The class has not yet been converted to the new class-local types".
I suppose I have to be satisfied with the conclusion that this is a limitation within SAP.
Cheers,
John