Wednesday, 15 April 2015

How to create Watchpoint for Object attributes

Posted by Sreenivasa Rao Yarru in ABAP Development on Oct 25, 2013 5:36:36 AM

http://scn.sap.com/community/abap/blog/2013/10/25/how-to-create-watch-point-for-object-attribute

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,



No comments:

Post a Comment