Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Watchpoint + Class Attributes

Former Member
0 Likes
4,874

Hey there,

I'm trying to create a watchpoint for a private attribute in one of my classes, but I'm not sure why I'm not being able to do it. Take a look in the following code:


REPORT zwatchpoint_test.

CLASS lcl_watchpoint DEFINITION.

  PUBLIC SECTION.

    METHODS stop.

  PRIVATE SECTION.

    DATA: t_sbook TYPE TABLE OF sbook,

          wa_sbook LIKE LINE OF t_sbook.

ENDCLASS.                    "lcl_watchpoint DEFINITION

CLASS lcl_watchpoint IMPLEMENTATION.

  METHOD stop.

    SELECT *

      FROM sbook

      INTO TABLE me->t_sbook.

    LOOP AT me->t_sbook INTO me->wa_sbook.

      WRITE 'Breakpoint Here!'.

    ENDLOOP.

  ENDMETHOD.                    "stop

ENDCLASS.                    "lcl_watchpoint IMPLEMENTATION

DATA: watchpoint TYPE REF TO lcl_watchpoint.

START-OF-SELECTION.

  CREATE OBJECT watchpoint.

  watchpoint->stop( ).

What I want to do is set a watchpoint for attribute "WA_SBOOK", whenever field WA_SBOOK-PASSNAME reaches some value (ex.: 'Amelie Buchholm').

Steps to reproduce my issue:

  1. Copy-paste this sample code into SE38
  2. Put a breakpoint at line WRITE 'Breakpoint Here'
  3. Execute
  4. Clear the breakpoint
  5. Try to create a watchpoint for WA_SBOOK-PASSNAME = 'Amelie Buchholm' (or whatever name that exists in SBOOK table)

(If you don't have data in SBOOK on your system, run program SAPBC_DATA_GENERATOR )

What am I missing? I keep getting the 'area of validity varies', even if I try to set the watchpoint as an object attribute...

Thank you!

1 ACCEPTED SOLUTION
Read only

UweFetzer_se38
Active Contributor
0 Likes
3,801

The regular watchpoint works for me (NW 7.40 SP 7), it stops at the desired value.

The regular watchpoint works for me (NW 7.40 SP 7), it stops at the desired value.

10 REPLIES 10
Read only

fred_verheul
Active Contributor
0 Likes
3,801

It works (at least creating the watchpoint works) as long as you don't try to impose an additional condition on it...

Looks like it has something to do with the fact that the free conditions are assumed to have global variables in them, while you are using an object attribute.

I get more strange behavior whenever I first define the watchpoint on an object (says WATCHPOINT CREATED), navigate to the right tab in de debugger to watch my ...-points, and try to change the watchpoint by (only then!) adding a condition: I get the message WATCHPOINT CREATED, but the watchpoint is actually deleted...

But I don't think what you want to achieve is possible to be honest.

Sorry...

Read only

0 Likes
3,801

Problem is I really wanted to impose a condition to the Watchpoint. Thanks for the try anyway!

Maybe this is something related the AS ABAP version? I'm in 7.31 ...

Read only

0 Likes
3,801

Yeah, me too (SP10).

Read only

SimoneMilesi
Active Contributor
0 Likes
3,801

Hello Mauricio.

I tried your code and followed your instructions but my watchpoints works correctly

Read only

0 Likes
3,801

Hey Simone, could you please confirm if you're in an AS ABAP with version greater than 7.31 ? Maybe this thing only works in 7.4+ .

I've tried 2 different systems (7.31 / 7.02) and the error persists.

Thank you!

Read only

custodio_deoliveira
Active Contributor
3,801

Hi Mauricio,

Not exactly what you asked for, but I think will do the trick. Instead of creating a watch-point I added a condition to the break-point and it worked like a charm:

Cheers,

Custodio

Read only

0 Likes
3,801

Cool, thanks! Works here too 😉

Read only

0 Likes
3,801

That also worked for me! Thanks man!

Regards!

Read only

UweFetzer_se38
Active Contributor
0 Likes
3,802

The regular watchpoint works for me (NW 7.40 SP 7), it stops at the desired value.

Read only

0 Likes
3,801

Bingo! So that only works on 7.4+.