14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Coding the INIT and END Methods 5.3

"No point going on

me->break( ).

ENDTRY.

ENDMETHOD."init

Listing 5.7 INIT Method

The INIT method only runs once when the debugger script executes, so this is the

best place for creating the application log. Note that the instance of the application

log is called APPL_LOG and is a member variable of the superclass of the

debugger script class you’re running (put more simply, you don’t have to create a

variable for the application log).

You then need to set some watchpoints so that the debugger script executes the

SCRIPT method every time one of the two va riables you’re interested in changes

(Figure 5.8 and Figure 5.9).

Figure 5.8 Laughing Example: Watchpoint Settings

Figure 5.9 Laughing Example: Trigger Settings

Next, when the SCRIPT method runs, you need to find out which of the watchpoints

has triggered, interrogate the cu rrent variable values, and finally write

some information to the log. At each stage, you use the Script Wizard to import a

template into your code, and the result comes out looking like Listing 5.8.

METHOD script.

* Local Variables

DATA: ld_current_line TYPE i,

ld_current_number TYPE sy-tabix,

217

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!