Está en la página 1de 29

ABAP Debugging Techniques

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
Need for Debugging
Need for Debugging

Problem Type Tool


Starting point for analyzing a System Log (SM21)
crashed program/ background job
Runtime Error ABAP Dump Analysis (ST22)
Unexpected Program behavior ABAP Runtime Analysis (SE30)
Finding specific statement, ABAP Runtime Analysis (SE30)
function, method
Performance problem ABAP Runtime Analysis (SE30)
SQL Trace (ST05)
Screen Processing Screen Trace (ST20)
Detailed error analysis source ABAP Debugger
code level
Debugging Requirement
Debugging requirement

• Report.
• Function Module

• User Exit

• Screens – Module Pool Program.

• Standards Programs.

• Background Jobs.
Debugging - Report
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.


Initial Set Up
Identify 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.


Debugging Types
• 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 Screen
Single Dimensional structure
• 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.
Two Dimensional structure

• 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
System Variables
• 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.


Break Point
• 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).
Showing all Dynamic Break point options
Ex- Placing Break point at ‘message’
Watch Point

• 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 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.
Debugging – Background Job
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.


Background Job Overview
Debugging – Dump Analysis Tool
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.
List of Errors for given User
Runtime Error
Debugging of Background Task
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
SM58 tcode screen and execute

Select the background task and do debug LUW


from menu bar

También podría gustarte