Abap Debugging Basic
-
Upload
attila-sandor -
Category
Documents
-
view
877 -
download
86
description
Transcript of Abap Debugging Basic
![Page 1: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/1.jpg)
SPS102: ABAP DEBUGGING
Kasama RuangrongEMIT|SAS|SPS26-Oct-2007
Based on a Presentation byJohn C Benson(1st Edition) June 06
Mike Bradshaw(2nd) June 06Kylie Sng Yen Leng(3rd) Oct19, 07
![Page 2: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/2.jpg)
Agenda
23.04.08. -2-
1. Debugging Overview
2. Debugging Components
3. Breakpoints
4. Displaying Data Values
5. Changing Data Values
6. Watchpoints
7. ABAP Dump(ST22)
8. Tips & Tricks
![Page 3: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/3.jpg)
1. Debugging Overview (DM1)
23.04.08. -3-
Components
Breakpoint
Watchpoint
DebugData Values
Component
Breakpoint
Data Value Watchpoint
OVERVIEW
![Page 4: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/4.jpg)
1. Debugging Overview (DM1)
23.04.08. -4-
ABAP Program: Y_ABAP_DEBUG_DEMO
or
Transaction: Y_ABAP_DEBUG_DEMO
Selection Screen:
![Page 5: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/5.jpg)
1. Debugging Overview (DM1)
ABAP Debug Screen
23.04.08. -5-
![Page 6: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/6.jpg)
2. Debugging Components (DM1)
23.04.08. -6-
• Basic understanding of the ABAP Debug Components
Components
![Page 7: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/7.jpg)
2. Debugging Components (DM1)
Description Icon Fkey Action
Single Step <F5> go to the next instruction regardless of program level
Execute <F6> go to next instruction in the current program level
Return <F7> return to the calling program level
Continue <F8> continue execution to the next breakpoint or complete processing.
23.04.08. -7-
Execution within the Debugger
![Page 8: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/8.jpg)
2. Debugging Components (DM1)
23.04.08. -8-
Execution Flow within the ABAP Debugger
• Demonstrating the use of within the program execution levels.
• Breakpoint in the program executing the Perform.
• Breakpoint in the Perform.
• Breakpoint in the Function Module
![Page 9: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/9.jpg)
2. Debugging Components (DM1)
23.04.08. -9-
Display Options within the ABAP Debugger
• Display program lines before and after the current line to be executed.
or
• Display the current line to be executed.
• Increase Program Section Size
• Display the current Call or Program Level
![Page 10: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/10.jpg)
2. Debugging Components (DM1)
23.04.08. -10-
Display Options within the ABAP Debugger (cont’d)
• or Reset the ABAP Debug Display.
• Cancel Execution.
![Page 11: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/11.jpg)
3. Breakpoints (DM3)
23.04.08. -11-
• Setting Breakpoints
Breakpoint
![Page 12: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/12.jpg)
3. Breakpoints (DM3)
23.04.08. -12-
Start the ABAP Debugger Before Start of Execution
• Enter “/h” in the Command Line:
or
Menu Path: System>Utilities>Debug ABAP
Bottom of the Screen:
• SE38>Select the Debug ICON:
![Page 13: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/13.jpg)
3. Breakpoints (DM3)
23.04.08. -13-
Breakpoints
• Initial Breakpoints are set using SE38/SE39 or SE37.
With the line highlighted click the on the toolbar to set the breakpoint.
Click again to delete
![Page 14: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/14.jpg)
3. Breakpoints (DM3)
23.04.08. -14-
Breakpoints (cont’d)
• The complete list of breakpoints can be displayed/deleted in SE38 (Utilities>Breakpoint>Display).
![Page 15: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/15.jpg)
3. Breakpoints (DM3)
23.04.08. -15-
Breakpoints (cont’d)
• Breakpoints can be added or deleted during the debug session.
Double click on a line to add or delete a breakpoint.
![Page 16: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/16.jpg)
3. Breakpoints (DM3)
23.04.08. -16-
Breakpoints (cont’d)
• Displaying all breakpoints during a debug session.
Breakpoints can be deleted in the breakpoint list by double clicking .
![Page 17: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/17.jpg)
3. Breakpoints (DM3)
23.04.08. -17-
Breakpoints (cont’d)
• Display a dropdown list to deactivate or reactivate breakpoints for the current execution.
indicates a deactivated breakpoint.
![Page 18: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/18.jpg)
3. Breakpoints (DM3)
23.04.08. -18-
Breakpoints (cont’d)
• Breakpoints added or deleted during a debug session can be saved for subsequent executions.
Initial execution
Subsequent executions after saving the
deletion of the original breakpoint and the setting of a new breakpoint in a
previous debug session.
![Page 19: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/19.jpg)
3. Breakpoints (DM3)
23.04.08. -19-
Breakpoints (cont’d)
• Breakpoints are only active for the user that sets the breakpoints.
• Breakpoints are active for all sessions within a user logon.
• Breakpoints are not active for additional user logons.
![Page 20: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/20.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -20-
• Displaying Data Values in Fields, structure & Internal Tables
• Changing Data Values
Data Values
![Page 21: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/21.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -21-
• Displaying the Output List in the ABAP Debugger
• is added to the execution task bar after output has been created.
• Click on to display the current Output List.
![Page 22: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/22.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -22-
• Displaying Data Values
Standard System Values
![Page 23: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/23.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -23-
Displaying Data Values (cont’d)
• Single Fields
• Type or double click the single field.
• Double click the field to display the field attributes.
![Page 24: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/24.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -24-
Displaying Data Values (cont’d)
• Structures
• Type or double click the structure name.
• Double click the structure name to display the values for each structure field.
• Double click the structure field to display its attributes.
![Page 25: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/25.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -25-
Displaying Data Values (Cont’d)
• Internal Tables
• Type or Double Click the Internal Table Name
• Hit <Enter> to display the internal table contents
Current Values in the Table Header
![Page 26: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/26.jpg)
4. Displaying Data Values (DM2+DM4)
Icon Table Field
First
Previous
Next
Last
23.04.08. -26-
Displaying Data Values (Cont’d)
• Parsing the Internal Table:
• Table Paging:
• Finding a Record:
Icon Page
First
Previous
Next
Last
Icon In Table
Find
Find Next
![Page 27: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/27.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -27-
Displaying Data Values (Cont’d)
• Internal Tables (Cont’d)
• Fields can be excluded from the internal table display. Highlight the fields to be excluded, depress <Delete>, then depress <Enter>.
• To redisplay all fields, click on .
![Page 28: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/28.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -28-
Displaying Data Values (Cont’d)
• Download Internal Tables (Cont’d)
![Page 29: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/29.jpg)
4. Displaying Data Values (DM2+DM4)
23.04.08. -29-
Displaying Data Values (Cont’d)
• Download Internal Tables (Cont’d)
![Page 30: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/30.jpg)
5. Changing Data Values (DM5)
23.04.08. -30-
• Changing Data Values
• Display the fields in the ABAP Debugger
• Overtype the field value and select to make the change to the field value.
![Page 31: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/31.jpg)
5. Changing Data Values (DM5)
23.04.08. -31-
• Changing Data Values (cont’d)
• Display the Internal table in the ABAP Debugger
• To change the Value, place cursor at the column & click “Change”. Press Enter to confirm changes.
![Page 32: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/32.jpg)
5. Changing Data Values (DM5)
23.04.08. -32-
• Changing Data Values (cont’d)
• To insert a new row into the Internal Table. Click on the “Insert”. Press Enter to confirm the changes.
![Page 33: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/33.jpg)
5. Changing Data Values (DM5)
23.04.08. -33-
• Changing Data Values (cont’d)
• To add a new record at the END of the Internal Table. Click on the “Append”. Press Enter to confirm the changes.
![Page 34: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/34.jpg)
5. Changing Data Values (DM5)
23.04.08. -34-
• Changing Data Values (cont’d)
• To remove an record. Place your cursor at that row. Click on “Delete”. Press Enter to confirm the changes.
![Page 35: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/35.jpg)
5. Changing Data Values (DM5)
23.04.08. -35-
• Changing Data Values (cont’d)
• To remove a record, place your cursor at record and click on the “Delete”.
![Page 36: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/36.jpg)
6. Watchpoints (DM6)
23.04.08. -36-
• Setting Watchpoint
Watchpoint
![Page 37: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/37.jpg)
6. Watchpoints (DM6)
23.04.08. -37-
Watchpoints
• Uses an ABAP field to create a conditional breakpoint while in the ABAP Debugger
![Page 38: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/38.jpg)
6. Watchpoints (DM6)
23.04.08. -38-
Watchpoint (Cont’d)
• Displaying and changing the watchpoints that have been set in the ABAP Debugger.
is used to change the watchpoint condition.
is used to delete the watchpoint.
![Page 39: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/39.jpg)
7. ABAP Dump (ST22)
23.04.08. -39-
ABAP DUMP ANALYSIS (ST22)
![Page 40: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/40.jpg)
7. ABAP Dump (ST22)
23.04.08. -40-
ABAP Dump Analysis
• An ABAP Dump occurs when the program intentionally triggers a dump when current conditions cannot be handled.
Examples: Divide by ZeroNumeric field too small for the result (field overflow)Timeout
• Use transaction ST22 to view and analyze an ABAP Dump.
![Page 41: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/41.jpg)
7. ABAP Dump (ST22)
23.04.08. -41-
ABAP Dump Analysis (cont’d)
Summary of What Happened!
Where it Happened!
Click here to View the code
![Page 42: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/42.jpg)
7. ABAP Dump (ST22)
23.04.08. -42-
ABAP Dump Analysis (cont’d)
Contents of System Variables!
Contents of Chosen Variables!
![Page 43: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/43.jpg)
7. ABAP Dump (ST22)
23.04.08. -43-
ABAP Dump Analysis (cont’d)
Where it has been and
where it is!
• The program was at line 197 in the Form “DEMO_07” which was called from line 77 in the Event “Start_of_Selection”.
• IMPORTANT : Please kindly save the short dump into a file and send to SPS for analysis.
![Page 44: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/44.jpg)
8. Tips & Tricks
23.04.08. -44-
Tips & Tricks
![Page 45: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/45.jpg)
8. Tips & Tricks
23.04.08. -45-
To Debug Dialog Screen• Save the below into a .txt on the desktop (can be any name).
[FUNCTION] Command=/H Title=Debugger Type=SystemCommand
![Page 46: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/46.jpg)
8. Tips & Tricks
23.04.08. -46-
To Debug Dialog Screen (cont’d)• Drag and drop the above file onto the Dialog screen.
• Debugging will be activated.
![Page 47: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/47.jpg)
8. Tips & Tricks
23.04.08. -47-
To Debug Background job• Transaction SM37• Function code JDBG
• Transaction SM66 > Debugging
![Page 48: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/48.jpg)
8. Tips & Tricks
23.04.08. -48-
Transaction Codes• AL21 – ABAP Program Analysis
![Page 49: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/49.jpg)
8. Tips & Tricks
23.04.08. -49-
Transaction Codes (cont’d)• SE30 – ABAP Runtime Analysis
Click here for more analysis
![Page 50: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/50.jpg)
8. Tips & Tricks
23.04.08. -50-
Transaction Codes (cont’d)• SE93 – Maintain Transaction (good for finding the program name).
![Page 51: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/51.jpg)
ABAP Debugging Summary
23.04.08. -51-
Potential Pitfalls
• Running code in the debugger is not exactly the same as normal execution.
• The debugger may perform commits which can cause: - Abends the code by breaking the database cursor (Select/Endselect). - Inadvertently commits changes to the database that would otherwise be rolled
back.
• Timing is changed in the debugger: - Problems related to the timing and sequence of database updates may
not show up when in the debugger.
• Restarting without leaving the debugger completely may retain prior information in global memory that would normally be refreshed.
• Record locks are not released within an appropriate timeframe thereby impacting other processing.
• A limited number of processes are available in production so try to avoid extended debug sessions.
• Start a secondary session to be able to terminate a runaway session.
![Page 52: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/52.jpg)
ABAP Debugging Summary
23.04.08. -52-
Summary
• The debugger can be useful to isolate hard to locate problems.
• The debugger changes the environment so some problems are very difficult or impossible to debug.
• Breakpoints and watchpoints help to get to the suspected problem area faster.
• Variables can be changed to create tests and bypass checks, but debug with replace is not normally used or allowed in production.
![Page 53: Abap Debugging Basic](https://reader033.fdocuments.us/reader033/viewer/2022061114/546074cbb1af9ff0588b52fb/html5/thumbnails/53.jpg)
SPS102: Revisions
23.04.08. -53-
1. Debugging Overview
2. Debugging Components
3. Breakpoints
4. Displaying Data Values
5. Changing Data Values
6. Watchpoints
7. ABAP Dump(ST22)
8. Tips & Tricks