Skip to Content

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’ ).

 

Debugging Hooks1.png

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.

Debugging Hooks2.png

Next you need to update the value mentioned above i.e. ‘ZCL_EHHSS_PCO_INC_LC_NEW->SEND_MAIL_NOTIF’ in the below table.

Debugging Hooks3.png

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.

Debugging Hooks4.png

Hope you understood 🙂 .If any doubts please feel free to comment below i will try answering it.

Learning is done by sharing knowledge 🙂

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

    1. Bob Varghese Post author

      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 🙂

      (0) 

Leave a Reply