Download - Debugging in SAP
-
7/27/2019 Debugging in SAP
1/23
ABAP DebuggingABAP Debugging
Presented by,Presented by,
Sylendra Prasad MSylendra Prasad M
-
7/27/2019 Debugging in SAP
2/23
Agenda for the dayAgenda for the day
DebuggingDebugging An overviewAn overview
ABAP DebuggingABAP Debugging
DebuggingDebugging Getting startedGetting started
Debugging ToolsDebugging Tools
Debugging in BackgroundDebugging in Background
-
7/27/2019 Debugging in SAP
3/23
DebuggingDebugging An overviewAn overview
Stepwise method of finding out errors or bugs.Stepwise method of finding out errors or bugs.
The basic steps involveThe basic steps involve Recognize that the bug existsRecognize that the bug exists
Isolate source of bugIsolate source of bug
Identify cause of bugIdentify cause of bug Determine the fix for the bugDetermine the fix for the bug
Apply the fix and test it.Apply the fix and test it.
Software Debugging is done by special softwareSoftware Debugging is done by special software
called debuggers.called debuggers.
-
7/27/2019 Debugging in SAP
4/23
ABAP DebuggingABAP Debugging
ABAPABAP DebuggerDebugger allowsallows youyou toto interruptinterrupt thethe
runningrunning programprogram afterafter eacheach step,step, allowingallowing youyou toto
checkcheck intermediateintermediate resultsresults andand processingprocessing logiclogic..
DebuggerDebugger cancan bebe calledcalled inin twotwo waysways..
ByBy settingsetting breakbreak pointspoints.. WriteWrite BREAKBREAK--POINTPOINT oror BREAKBREAK statementstatement inin program(static)program(static)
ClickClick STOPSTOP buttonbutton inin thethe toolbartoolbar ofof programprogram (dynamic)(dynamic)
ByBy runningrunning thethe programprogram inin debuggingdebugging modemode..
UsingUsing \\hh
SettingSetting breakbreak pointspoints atat specifiedspecified codecode lineslines..
DoubleDouble clickingclicking toto setset breakbreak pointspoints..
-
7/27/2019 Debugging in SAP
5/23
DebuggingDebugging Getting startedGetting started
To switch on debugging, type /h and press enter.To switch on debugging, type /h and press enter.
Following buttons are used to continueFollowing buttons are used to continue
debugging.debugging.
-
7/27/2019 Debugging in SAP
6/23
1.1. Single step: Used to step through the programSingle step: Used to step through the program
statement by statement.For subroutines, this will gostatement by statement.For subroutines, this will goinside the subroutine. .(F5 key can be used).inside the subroutine. .(F5 key can be used).
2.2. Execute: Similar to single step , but for subroutines,Execute: Similar to single step , but for subroutines,
this completely executes the subroutine,withoutthis completely executes the subroutine,withoutgoing inside the routine.(F6 key can be used).going inside the routine.(F6 key can be used).
3.3. Return: Used to return from a subroutine, or a calledReturn: Used to return from a subroutine, or a called
ro ram to a callin ro ram.ro ram to a callin ro ram.
4.4. Run: Used to process the program until the nextRun: Used to process the program until the next
static or dynamic break point.If no more breakpointsstatic or dynamic break point.If no more breakpoints
are there, this will exit the debugging mode andare there, this will exit the debugging mode and
executes the rest of the program normally(F8 key).executes the rest of the program normally(F8 key).5.5. Watchpoints: Used to interrupt the execution ofWatchpoints: Used to interrupt the execution of
program when variable reaches a particularprogram when variable reaches a particular
value.Will be discussed in detail later.value.Will be discussed in detail later.
-
7/27/2019 Debugging in SAP
7/23
Break pointsBreak points
Causes program execution to stop at thatCauses program execution to stop at that
location and start the debugger.location and start the debugger.
Static BreakStatic Break--point.point. User independent breakpoint:User independent breakpoint:
Using statement BREAKUsing statement BREAK--POINT.POINT.
..
Useful in development phase and removed beforeUseful in development phase and removed before
transported.transported.
Can number the break points to identify them easier.Can number the break points to identify them easier.
User dependent breakpoint:User dependent breakpoint: Interrupted only for a specific user.Interrupted only for a specific user.
Using the statement BREAK .Using the statement BREAK .
Visible in program, but not active when other users use theVisible in program, but not active when other users use the
program.program.
-
7/27/2019 Debugging in SAP
8/23
SAMPLE PROGRAMSAMPLE PROGRAM
Static break points must be removed fromStatic break points must be removed from
program after testing.program after testing.
-
7/27/2019 Debugging in SAP
9/23
Dynamic break point:Dynamic break point:
Done by clicking on STOP button in toolbar ofDone by clicking on STOP button in toolbar of
program.program.
User specific break point.User specific break point.
No need to change the code.No need to change the code.
Can be set even when prog. is locked by any user.Can be set even when prog. is locked by any user.
Deleted when logged off the SAP system.Deleted when logged off the SAP system.
-
7/27/2019 Debugging in SAP
10/23
30 dynamic break points can be set without30 dynamic break points can be set withoutchanging the program code.changing the program code.
Can be set directly in ABAP editor or whileCan be set directly in ABAP editor or while
debugging.debugging. While debugging, break points can be set orWhile debugging, break points can be set or
deleted by double clicking the line of code.deleted by double clicking the line of code.
OROR
-
7/27/2019 Debugging in SAP
11/23
Different methods of using break pointsDifferent methods of using break points
Break points at ABAP Statements:Break points at ABAP Statements:
SelectSelect BreakpointBreakpoint -->Breakpoint at>Breakpoint at --> Statement> Statement
-
7/27/2019 Debugging in SAP
12/23
Break point at Function Modules & SubroutinesBreak point at Function Modules & Subroutines
Similarly, break points can be set for Function Modules, Methods,Similarly, break points can be set for Function Modules, Methods,Exceptions etc.Exceptions etc.
-
7/27/2019 Debugging in SAP
13/23
Saving and Deleting Break pointsSaving and Deleting Break points
Dynamic break points can be saved so that they are still active within the same session.Dynamic break points can be saved so that they are still active within the same session.
Break points will remain active until you delete it or you logoff the system.Break points will remain active until you delete it or you logoff the system.
Break points can be deleted either by double clicking on the break point or selecting the menuBreak points can be deleted either by double clicking on the break point or selecting the menuoptionoption
ChooseChoose-->Create/Delete or>Create/Delete or
ChooseChoose-->Delete all>Delete all
-
7/27/2019 Debugging in SAP
14/23
Watch pointsWatch points
Used to interrupt program, when contents of fieldUsed to interrupt program, when contents of field
or structure change.or structure change.
Can save up to 5 watch points including watchCan save up to 5 watch points including watch
points for strings.points for strings.
an e oca or g o aan e oca or g o a Local watch points valid only in a specified programLocal watch points valid only in a specified program
Global watch points valid only in a specified programGlobal watch points valid only in a specified program
and all the programs it calls.and all the programs it calls.
-
7/27/2019 Debugging in SAP
15/23
Procedure to set Watch pointsProcedure to set Watch points
Choose menu optionChoose menu option BreakpointBreakpoint --> Create watchpoint> Create watchpoint
or the corresponding Pushbuttonor the corresponding Pushbutton
OROR
Provide the program name, variable name ,Provide the program name, variable name ,
relational operator(=,
-
7/27/2019 Debugging in SAP
16/23
So whenever gd_tcodeSo whenever gd_tcode--tcode becomes KO8G, the program execution will betcode becomes KO8G, the program execution will beinterrupted.interrupted.
-
7/27/2019 Debugging in SAP
17/23
Debugging ToolsDebugging Tools
Use the following buttons during debugging.Use the following buttons during debugging.
Contents can be displayed by double clicking onContents can be displayed by double clicking onthe field name while debugging.the field name while debugging.
Fields: can be used to get values of single fields.Fields: can be used to get values of single fields.
-
7/27/2019 Debugging in SAP
18/23
Table: can be used to get internal table values.Table: can be used to get internal table values.
-
7/27/2019 Debugging in SAP
19/23
The internal table data , during debugging, canThe internal table data , during debugging, can
be downloaded to excelsheet, by clicking onbe downloaded to excelsheet, by clicking onSaveSave
as excel worksheetas excel worksheetbutton and giving the number ofbutton and giving the number of
rows to be downloadedrows to be downloaded..
Watch points and Break points: can be used toWatch points and Break points: can be used todisplay them in the main program.display them in the main program.
-
7/27/2019 Debugging in SAP
20/23
Debugging in BackgroundDebugging in Background
Debugging can be done for programs scheduled to runDebugging can be done for programs scheduled to runin background.in background.
Job should be either in Scheduled or Released status.Job should be either in Scheduled or Released status.
After scheduling the program to run in background,After scheduling the program to run in background,
select the job in SM37 and typeselect the job in SM37 and typejdbgjdbg in the commandin the command
area.area.
Now the debugger is activated.Now the debugger is activated.
-
7/27/2019 Debugging in SAP
21/23
-
7/27/2019 Debugging in SAP
22/23
Reference documentsReference documents
SAP Help documentsSAP Help documents
http://www.sappro.com/http://www.sappro.com/ ExperienceExperience
-
7/27/2019 Debugging in SAP
23/23