Skip to Content
Author's profile photo Sreenivasa Rao Yarru

How to create Watchpoint for Object attributes

Hi Friends,

We can set watch point for object reference but not to object attribute in abap debugger. But using Debugger Script we can do it.

What I would like to explain:

How to set  Watch point to object reference attributes.

My Example:

I created simple class with 3 attributes and one method to set the those values and one report to test.

Capture.PNG

Capture.PNG

Capture.PNG

I want to stop when age is 30.

What needs to be done:

1.Go to transaction SAS click on Script editor and create new script.

write down  following code in Script method

Capture.PNG

Here P_var_name is attribute on which you want to set watch point. So if value is 30 setting watch point by calling method BREAK.

Now you need to load this script in debugger as below.

2.execute programme in debugger mode , in debugger click on script tab,and then click on Load script and give script name which created above.

Capture.PNG

Capture.PNG

Then we have to set when this script should trigger. I want to watch age value so I am selecting watch point reached and setting watch point to reference LR_OBJECT.

Capture.PNG

Capture.PNG

Then click on Start Script, Programme stops at write .We can see age value is 30.

Capture.PNG

Capture.PNG

If we set the age other than 30 programme won’t stop.

You can watch above example through this link.http://www.youtube.com/watch?v=HeaXtgtO2K4

For more details about script http://scn.sap.com/docs/DOC-10249,

http://scn.sap.com/docs/DOC-10250

Regards,

Sreenivas.


Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice Info Sreeni....

      Author's profile photo Former Member
      Former Member

      Thank you Sreenivas. it is useful 

      Author's profile photo Former Member
      Former Member

      I think you you should put clearer & sharper images in the blog

      - Suhas

      Author's profile photo Former Member
      Former Member

      Hi Suhas

      The images are clear and sharp once we click on it.

      Jive is downsizing the image when it's width crosses certain threshold.

      To improve user experience, OP can use screenshot tool to capture only relevant portion of screen that is small enough to fit in Jive layout without downsizing.

      Author's profile photo Former Member
      Former Member

      I know that. Perhaps i should have rephrased my suggestion as - "Please put screenshots which capture relevant portions only".

      Thanks,

      Suhas

      Author's profile photo Former Member
      Former Member

      Of course you know that. I meant to spell it out for the OP.

      I saw a blog/doc recently that had full-size images, 3/4th of which was white color.

      User had probably cropped the image in MS Paint, but didn't take care of drawing area.

      Author's profile photo Sreenivasa Rao Yarru
      Sreenivasa Rao Yarru
      Blog Post Author

      Hi Suhas,

      While writing this blog abap learners in my mind .So I wanted to give as much information as I can.Because of that I captured full screens, so as Manish explained it is not clear.

      Regards,

      Sreenivas.

      Author's profile photo Chandra Shekhar Agarwal
      Chandra Shekhar Agarwal

      Nice piece of info 🙂

      Author's profile photo Venkat Aileni
      Venkat Aileni

      Good work Sreenivas, thanks for explaining each step with proper screen shots and brief description.

      Keep posting!

      -Venkat

      Author's profile photo Former Member
      Former Member

      Good work, Sreenivas. Your post is very nice.

      Regards,

      André

      Author's profile photo Bharatkumar M A V
      Bharatkumar M A V

      Good work Sreenivas