ABAP Debugging Techniques

download ABAP Debugging Techniques

of 23

description

ABAP techniques

Transcript of ABAP Debugging Techniques

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

  • Need for Debugging

  • 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

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

  • 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

  • Debugging Screen

  • Variable/ Field: Contains data.

    Structure: Consists Multiple fields.

    Work Area: Current line of ITab, contains multiple fields.

    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

  • Internal Table: Contents of database table retrieved by ABAP code (selected fields).

    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

  • SY-SUBRC: Successful execution of previous statement System variable providing fruitful information, about

    confirmation of retrieval statement.

    sy-subrc = 0 successful retrieval of data

    sy-subrc 0 unsuccessful retrieval of data

    SY-TABIX: Current line number of internal table.

    SY-DBCNT: Total No of lines processed.

    System Variables

  • Break Point is set within a loop with 10,000 iterations.

    Interested to know about processing for 900th iteration.

    Executing F8 until then is time consuming, instead use

    Break Point feature.

    Features:

    Skip record counts within a loop.

    Specify the record number for processing to be checked.

    Break Point

  • To directly pinpoint a field of Internal Table having particular value.

    Can be placed for any field of Internal table.

    Features:

    Comparison Operator.

    Comparison Field Value.

    Logical Operator.

    Local/ Global data.

    Watch Point

  • 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