easy steps of de-bugging

28
By Prasanna Balaji K 27.12.2012 (Version 1.0) Reviewed By : Sathish Subburaj Easy Steps of De-bugging

Upload: ragini-palluru

Post on 29-May-2017

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Easy Steps of de-Bugging

By

Prasanna Balaji K

27.12.2012

(Version 1.0)

Reviewed By : Sathish Subburaj

Easy Steps of De-bugging

Page 2: Easy Steps of de-Bugging

ABAP Debugger

• ABAP Debugger is a tool used to execute and analyze programs line by line.

• Using it we can check the flow logic of a program and display runtime values of the variables.

• By setting breakpoints, we can stop a program during its execution and this will  display the contents of the table and variable being used by the program.

• A maximum of 30 breakpoints can be set in the ABAP debugger.

Page 3: Easy Steps of de-Bugging

Types of Debuggers

Classic ABAP debugger• The Classic ABAP Debugger, with its old user interface and

its limitations to debug certain types of ABAP program is now not in use by many new and old ABAP developers.

New ABAP debugger• The New ABAP Debugger, with its state of the art and

flexible user interface, can be used to debug all types of ABAP programs. It provides many new features which improve our efficiency of debugging, both in ABAP support and development

Page 4: Easy Steps of de-Bugging

Certain ways to get into debugger

Certain ways to get into debugger

Page 5: Easy Steps of de-Bugging

Ways to Get Into The Debugger

1) In the ABAP Editor (SE38)

On the initial screen:• Enter the program

name.• Choose  Program-

>Execute->Debugging .

Page 6: Easy Steps of de-Bugging

Ways to Get Into The Debugger

2) In the ABAP Editor (SE38)

In the source text display:• Choose  Program->Test-

>Debugging .

Page 7: Easy Steps of de-Bugging

Ways to Get Into The Debugger

3) In the Object Navigator (SE80)

• Select the program to be tested with a double-click.

•  Program->Test->Debugging

Page 8: Easy Steps of de-Bugging

Ways to Get Into The Debugger

4) In the Object Navigator (SE80)

• Select the Function Module to be tested with a double-click.

• Function Module->Test-> Function Module Test->Debugging

Page 9: Easy Steps of de-Bugging

Ways to Get Into The Debugger

5) In the Object Navigator (SE80)

• Select the Method to be tested with a double-click.

• Method->Test/Execute->Execute Method->Debugging

Page 10: Easy Steps of de-Bugging

Ways to Get Into The Debugger

6) In the transaction maintenance (SE93)

• Enter a transaction code.• Choose  Transaction

Code->Test->Debugging .

Page 11: Easy Steps of de-Bugging

Ways to Get Into The Debugger

7) In the job overview (SM37)

• Select an inactive job.• Enter jdbg in the

command line of the system function bar.

Page 12: Easy Steps of de-Bugging

Ways to Get Into The Debugger

8) In the ABAP Editor (SE38)

• In the main window of an application, you can enter ‘/h’ in the command field of the system function bar.

• You can also select relevant options in the menu bar.

Page 13: Easy Steps of de-Bugging

How to reach into particular loop (Watch point with condition)

• The Create watchpoint dialog box appears when the pushbutton ‘Create watchpoint’ is clicked.

• Enter the program and the name of the field for which you want to set the watchpoint.

• Now the program will stop when the condition specified in watch point is reached.

Page 14: Easy Steps of de-Bugging

Table Configuration

• Internal table contents will be displayed by clicking on ITAB.

• Click settings button to configure the table.

• Fields displayed can be rearranged with arrow buttons as shown in the figure.

• Also fields can be suppressed from display.

Page 15: Easy Steps of de-Bugging

How to find the route path of the cause ( using Desktop 2 )

• Desktop 2 tab will display all the event types such as method, function, form & modules used in the program.

• Also it displays inside which Include & program the event has been used.

Page 16: Easy Steps of de-Bugging

Statement Debugging

• By pressing the Step Size button you can activate the statement debugging.

• ‘Step size’ is used to find which condition got failed in the statement.

Page 17: Easy Steps of de-Bugging

Statement Debugging

•  The debugger will execute the sub conditions of long IF statement separately one after another.

• By pressing the Step Size button again you return to a normal line stepping in the debugger.

Page 18: Easy Steps of de-Bugging

Fastest way to skip the code using F5,6,7,8

• F5 - Step by Step debugging

• F6 - Skips loops and Subroutines

• F7 - Skips the loop or subroutine and returns to the last cursor point.

• F8 - Execute and come out of debugging

Page 19: Easy Steps of de-Bugging

Navigate to source code & view

• There is an option for navigate to editor in Breakpoint tab.

• By clicking this, it will navigate to the program where breakpoint is set.

• And a message will be displayed as ‘New window opened for source code display’.

Page 20: Easy Steps of de-Bugging

Altering Table Content

• If we want to add a data to the table or alter table content while debugging, Services of the tool can be used.

• It consists of many services.

• We can select the option in which our table has to be altered.

Page 21: Easy Steps of de-Bugging

Debugger Scripting

• Debugger scripting helps to trace and implement our own custom breakpoints and watchpoints.

• Select script tab->Load Script->Enter Script name in pop up window.

• Select statement where and all breakpoints has to be set.

Page 22: Easy Steps of de-Bugging

Debugger Scripting

• For example, if we want to set breakpoint on particular keyword such as SELECT, DELETE, MODIFY etc which is used in multiple lines of the program, it requires time if we set line by line.

• So in this case, we prefer DEBUGGER SCRIPTING. It has the option to set breakpoints on all script used in the program.

Page 23: Easy Steps of de-Bugging

Finding Error Message Stack

• Take a message id details of an error message displayed during program execution.

• In debugger screen, Goto breakpoints-> breakpoint at-> breakpoint at message.

• A pop up window shown in the figure will be displayed.

• Enter message id details-> Enter, it will take you to the program line where error occurred.

Page 24: Easy Steps of de-Bugging

Debugger Variant

• Once we sign off the session, the breakpoints we set will get deleted.

• So we can save breakpoints by Debugger->Debugger session->save.

• This will exist till we delete the breakpoints manually.

Page 25: Easy Steps of de-Bugging

Skip Breakpoints

• Inside Breakpoint tab, there is an option to skip breakpoints.

• Breakpoints will be skipped with the counts in skip counter.

• If skip counter is left blank, it won’t skip any breakpoints.

Page 26: Easy Steps of de-Bugging

Debugging A Pop Up Window

• A pop up window cannot be debugged using ‘/h’ command or by selecting any other menus.

• So click and drag a txt file into the pop up window with the functions shown in the figure.

Page 27: Easy Steps of de-Bugging

How to end the debugging

• Enter ‘/hx’ in the command field to end debugging.

Page 28: Easy Steps of de-Bugging

Thank You

Thank You