+ All Categories
Home > Documents > ABAP Debugging Techniques

ABAP Debugging Techniques

Date post: 13-Nov-2014
Category:
Upload: chksapstuff
View: 4,324 times
Download: 82 times
Share this document with a friend
29
ABAP Debugging Techniques
Transcript
Page 1: ABAP Debugging Techniques

ABAP Debugging Techniques

Page 2: 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

Page 3: ABAP Debugging Techniques

Need for Debugging

Page 4: ABAP Debugging Techniques

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

Debugging Requirement

Page 6: ABAP Debugging Techniques

Debugging requirement

• Report.

• Function Module

• User Exit

• Screens – Module Pool Program.

• Standards Programs.

• Background Jobs.

Page 7: ABAP Debugging Techniques

Debugging - Report

Page 8: ABAP Debugging Techniques

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

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

• 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

Debugging Screen

Page 12: ABAP Debugging Techniques

• 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

• 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

• 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

• 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

Ex- Placing Break point at ‘message’

Page 17: ABAP Debugging Techniques

• 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

• 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

Debugging – Background Job

Page 20: ABAP Debugging Techniques

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

Background Job Overview

Page 22: ABAP Debugging Techniques

Debugging – Dump Analysis Tool

Page 23: ABAP Debugging Techniques

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

List of Errors for given User

Page 25: ABAP Debugging Techniques

Runtime Error

Page 26: ABAP Debugging Techniques

Debugging of Background Task

Page 27: ABAP Debugging Techniques

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
Page 29: ABAP Debugging Techniques

SM58 tcode screen and execute

Select the background task and do debug LUW from menu bar


Recommended