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.

5

Debugger Scripting

Finally, I would be remiss not to ment ion that SAP expects you to write your

debugger information to trace files as op posed to the application log, and the

Script Wizard gives you assorted write trace options to achieve this.

5.4 Summary

This chapter started by acknowledging that sitting in front of the debugger is like

death and taxes—always with us—and can be quite boring and time consuming.

The very next time you are in the debugger—it could be tomorrow, it could be in

10 minutes—take a step back, look at wh at you are doing from the outside, and

see if you are doing the same steps again and again. If so, debugger scripting can

probably help you.

If looking at the list of options the Script Wizard provides makes you feel the paradox

of choice—there is so much you can do that you don’t know where to start

and so end up not using debugger scripting at all—worry not. Here are some tips

for how debugger scripting can be used in the real world:

왘 Tracing every line executed by a program

This is the exampl e you see most often in stan dard SAP examples about the

debugger script. There are a variety of predefined debugger scripts supplied by

SAP, and one of them is RSTPDA_SCRIPT_STATEMENT_TRACE, which only has one

command in the SCRIPT method. What this does is to write to a trace file every

single line of every single program that gets executed, in the order those lines

gets executed.

You can take a copy of such predefined scripts and change them any way you

want, so you can have the result list filtered by breakpoints or watchpoints or

by any custom criteria you can think of.

왘 Skipping authority checks

When I’m presenting at SAP conferences, I often have a quick (or not so quick)

drink with SAP expert Brian O’Neill from Nevada. He wrote a blog post on SCN

in which he gave an example of a common tedious problem when debugging.

Sometimes, the programmer may not have authorization for everything in the

program being tested. To get around this, traditionally you had to stop at every

AUTHORITY-CHECK statement and if the check failed then set SY-SUBRC manually

to zero so you could continue. This ge ts boring in a hurry. With a debugger

222

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

Saved successfully!

Ooh no, something went wrong!