Download - ABAP Debugging Techniques
![Page 1: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/1.jpg)
ABAP Debugging Techniques
![Page 2: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/2.jpg)
Table of Contents
Need for Debugging Debugging requirement. Initial Set Up Debugging Types. Debugging Screen Single Dimensional structure Two Dimensional structure. System Variables. Break Point. Watch Point. Termination of Batch Job Background Job Overview Dump Analysis Error List Runtime Analysis Debugging of Background Task
![Page 3: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/3.jpg)
Need for Debugging
![Page 4: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/4.jpg)
Need for Debugging
Problem Type Tool
Starting point for analyzing a crashed program/ background job
System Log (SM21)
Runtime Error ABAP Dump Analysis (ST22)
Unexpected Program behavior ABAP Runtime Analysis (SE30)
Finding specific statement, function, method
ABAP Runtime Analysis (SE30)
Performance problem ABAP Runtime Analysis (SE30)
SQL Trace (ST05)
Screen Processing Screen Trace (ST20)
Detailed error analysis source code level
ABAP Debugger
![Page 5: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/5.jpg)
Debugging Requirement
![Page 6: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/6.jpg)
Debugging requirement
• Report.
• Function Module
• User Exit
• Screens – Module Pool Program.
• Standards Programs.
• Background Jobs.
![Page 7: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/7.jpg)
Debugging - Report
![Page 8: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/8.jpg)
USAGE
• Change field values at Runtime, of variable or ITab field for manipulating the logic flow.
• Skip record counts within a loop and arrive at particular iteration of concern.
• To directly pinpoint to a field value of Internal Table.
• Check for proper Data retrieval and Logic flow.
![Page 9: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/9.jpg)
Initial Set UpIdentify relevant variable to locate appropriate point
in code to start debugging.
Menu Bar Utilities Breakpoint Set.
Enter ‘/h’ in command line. (Optional – wherein need to debug incorrect value field on first screen)
Using hard code in ABAP program “BREAK-POINT”
• Execute.
• Control switches to Debugging Mode.
![Page 10: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/10.jpg)
• Single Step (F5): Control passes through each executable statement.
• Execute (F6): Control overruns through each Subroutine, without passing through code within.
• Return (F7): Control skips current subroutine.
• Run (F8): Control runs to next debugging point or reaches the end result of the program.
Debugging Types
![Page 11: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/11.jpg)
Debugging Screen
![Page 12: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/12.jpg)
• Variable/ Field: Contains data.• Structure: Consists Multiple fields.• Work Area: Current line of ITab, contains
multiple fields.
o Process• FIELD button -> enter name in Col Field names
data displayed in Field Contents.• Field Contents can be modified using Change
button.
Single Dimensional structure
![Page 13: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/13.jpg)
• Internal Table: Contents of database table retrieved by ABAP code (selected fields).
o Process• Tables button enter name in Internal table
section OR double click on ITab name Table data displayed below.
• Change field contents: double click on any ITab field leads to Single Field Contents screen use Change button for Runtime changes
Two Dimensional structure
![Page 14: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/14.jpg)
• SY-SUBRC: Successful execution of previous statement System variable providing fruitful information, about confirmation of retrieval statement.
o sy-subrc = 0 successful retrieval of data
o sy-subrc <> 0 unsuccessful retrieval of data
• SY-TABIX: Current line number of internal table.
• SY-DBCNT: Total No of lines processed.
System Variables
![Page 15: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/15.jpg)
• Static Break-point (ex: Break-point and Break-user ID)
• Dynamic Break-Point (Break Point is set at any statement (message, if, etc.), subroutine, function module, method , exception and system exception).
Break Point
Showing all Dynamic Break point options
![Page 16: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/16.jpg)
Ex- Placing Break point at ‘message’
![Page 17: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/17.jpg)
• To directly pinpoint a field of Internal Table having particular value.
• Can be placed for any field of Internal table.
o Features:• Comparison Operator.• Comparison Field Value.• Logical Operator.• Local/ Global data.
Watch Point
![Page 18: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/18.jpg)
• Watch Point is set within a loop with ‘n’ iterations.• Interested to know about processing for 55th iteration
out of 100 records in an Internal table.• Executing F8 until then is time consuming, instead use
Watch Point feature as shown in below screen shot.
![Page 19: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/19.jpg)
Debugging – Background Job
![Page 20: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/20.jpg)
Termination of Batch Job
• Transaction for Batch Job: SM37
• Execute for given User.
• Identify particular Job from the displayed list of Jobs.
• Check for Job Log.
• For the erroneous Message Text note the Message Number and Class.
• Identify the actual message text using SE91.
![Page 21: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/21.jpg)
Background Job Overview
![Page 22: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/22.jpg)
Debugging – Dump Analysis Tool
![Page 23: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/23.jpg)
Dump Analysis
• Transaction : ST22
• Execute for given User/ Program/ Date.
• Provides list of errors for given selection.
• Selection of particular error gives the Runtime Error Description.
![Page 24: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/24.jpg)
List of Errors for given User
![Page 25: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/25.jpg)
Runtime Error
![Page 26: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/26.jpg)
Debugging of Background Task
![Page 27: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/27.jpg)
Debugging of Background Task
Steps: • After ‘/h’ debugging, click on settings and select the option as “In background task don’t execute” .
• After setting the flag save and execute the session.
• To perform background task debugging go to transaction code SM58
![Page 28: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/28.jpg)
![Page 29: ABAP Debugging Techniques](https://reader035.vdocuments.us/reader035/viewer/2022081413/5468295faf795969458b5760/html5/thumbnails/29.jpg)
SM58 tcode screen and execute
Select the background task and do debug LUW from menu bar