Debugging hooks in EHSM
Debugging Hooks
I’m writing this blog to make you understand the importance of debugging hooks which is available in EHSM module. It’s a very useful mode for debugging background activity which through normal breakpoints is not achievable.
During my time working in EHSM module I observed that many EHSM programs (mainly class) have debugging hooks which SAP has provided. So I started wondering why SAP has provided this line of code in standard class (then wore my Thinking Cap 🙂 ) .After few days I got the idea behind the debugging hooks in EHSM.I will share the same with you in Layman language 🙂 .
Two things you need to know one is a class ‘CL_EHFND_WFF_DEBUGGING’ which is a utility class mainly used in workflow related methods and second a table ‘EHFNDD_DEBUG’ .Normally this class is used mainly for workflow method whose activity is background processing. This class contains many methods but we will be using method : ‘debug_location’.
For example suppose in standard workflow activity there is some data issue and you require a debugging on the activity to check the issue. Normally it requires a lot of struggle to get the debugging running but with this particular class it’s easier to debugging standard workflow.
Below is the code that I have added in my custom workflow for incident creation. Through this you can set breakpoint.
cl_ehfnd_wff_debugging=>debug_location(
‘ZCL_EHHSS_PCO_INC_LC_NEW->SEND_MAIL_NOTIF’ ).
So here if you see in parameter I’m specifying a value which is nothing but the class name and its method. You can give any name but for better understanding and readability it’s good if you follow in this manner.
Now you might wonder what does this piece code do and how does it set breakpointJ. It’s simple the code performs an infinite loop using do enddoJ( but the code is bit different in that method it’s not simple do enddo). Then use SM50 to debug the program.
Next you need to update the value mentioned above i.e. ‘ZCL_EHHSS_PCO_INC_LC_NEW->SEND_MAIL_NOTIF’ in the below table.
Now the configuration is almost done. If you want to activate the debugging point you just need to mention ‘X’ in value column as show in the below screenshot.
Hope you understood 🙂 .If any doubts please feel free to comment below i will try answering it.
Learning is done by sharing knowledge 🙂
good one Bob. I used to put endless loop in my code to debug through sm50 . This is really helpful 🙂
Thanks sreehari 🙂 . I think its only used in SAP EHSM module as per my knowledge not sure whether it will work out for other modules.
But can use the same code and create a z class for it 🙂
Thanks Bob, It was very usefull!
Thank you Fabrizio 🙂
Thank you Bob, It was a useful piece of information 🙂 Expecting more 😀
Thank you Jeena 🙂 .Will release few more informative blogs 🙂
Also feel free to check my Twitter Integration with SAP CRM blog.
Hi Bob,
Great Blog - thanks for sharing this with the community!
A similar feature has been available in since I think EHS 2.2B with the BREAK_POINT macro.
IF you do not mind - could you add as second tag SAP Environment, Health, and Safety Management to it. Then your blog would show up in the SAP EHS Community!
Kind Regards
Mark
P.s: Found your blog through LinkedIn
Hi Mark,
Thank you for your comments 🙂
As you suggested I have added second tag with SAP Environment, Health, and Safety Management for this blog.
With Regards,
Bob.
Really glad that you shared this, definitely saved me time that would have been spent figuring it out.