Requirement:

I have Internal table of type MARA.I need to stop the programme in debugger when Internal table contains particular filed value ,say Material no 10,add line of  particular filed value say  Material no 20, delete line of  particular filed value say  Material no 30.

Problems:

We can solve above problem by setting  watch point for particular filed value of internal table in debugger if operation on table is single or with in a loop.If table is modified many places in programme it is difficult to set watch point at all places. If we delete table entries by using index it is not possible to set watch point which depends on the content value.

We can overcome above problems by using debugger script

What I am trying to explain:

1.Set the watch point for internal depends on deleted or added line content

Experimental set up:

To show you how to archive that I created simple report,with in that created internal table as below.

c1.PNGc2.PNG

I would like to show 3 things in this example.

1. Set watch point when table contains name  ‘NAME25’.

Go to transaction SAS and create following script.

To know how to create script go through http://scn.sap.com/community/abap/blog/2013/10/25/how-to-create-watch-point-for-object-attribute, http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d08bd05d-e6e8-2d10-4282-cd0ac41710e5&overridelayout=true

c3.PNG

c4.PNG

c5.PNG

What I am doing is getting the table content and storing in global variable gt_attr.

The  lt_attr is deep structure ,contains ‘fields’ as internal table. The ‘fields’   contains data of one line of internal table as shown below.

c6.PNG

c7.PNG

c8.PNG

From above we can find that if we take one row of internal table, it store in ‘fields’ as table,first column value of line as first row of fields, second column value of line as second row of fields  and so on.     

So I am looking for ‘NAME25’ and if find setting break point.

2. Setting watch point when delete the line with name ‘NAME50’.


For this I am comparing present internal table value with past value and finding deleted values ,setting break point if find NAME50.

c9.PNG

c10.PNG

3.Setting watch point when Insert the line with age 101.

Similar to delete case I am doing this as below.

c11.PNG

c12.PNG

B.Running application:

1.Execute the report in debugger mode.

2.Click on script,Then click on load script and give script name what you created above and enter

c13.PNG

c14.PNG

3.Next we have to set when this script should trigger. For my case I need to monitor changes in internal table so checking Watchpoint Reached and setting watch point my Internal table.

c15.PNG

c16.PNG

4.Click on Start Script ,we can see programme stop if table contains NAME25. Click on Continue Script  programme stops again when delete line with name NAME50, similarly in insert case.

c17.PNG

c18.PNG

c19.PNG

you can watch running of this application in this link https://www.youtube.com/watch?v=_k-T5mlOwZY

To know how to set watch point for Object attributes go through http://scn.sap.com/community/abap/blog/2013/10/25/how-to-create-watch-point-for-object-attribute.

Regards,

Sreenivas.

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply