debugging 22

Upload: kumargnb

Post on 03-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Debugging 22

    1/26

    Debugging for FucosExplanation, tips & trics for debugging in SAP CRM

    Gert-Jan Stolmeijer, Business Consultant

    01-01-2013

  • 7/28/2019 Debugging 22

    2/26

    Table of Contents

    Introduction

    Debug screen

    Debugging

    Breakpoints and Watch points

    Show and Change Content

    Tips & Tricks for efficient debugging

    Traces

    Find tables and fields

  • 7/28/2019 Debugging 22

    3/26

    This training is ment for functional consultants with minimalABAP knowledge

    As a prerequisite basic understanding of ABAP coding(Statements, Tables, Fields, ABAP-OO) is needed

    As a result the consultant should be able to: Functional debugging in SAP CRM/SAP ERP and WebUI

    Find and analyse simple problems due to ABAP coding

    Test solutions/specifications with the debugger

    Find tables and fields

    IntroductionGoal and Result of this training

  • 7/28/2019 Debugging 22

    4/26

    Possible scenarios when debugging is needed: SAP CRM generates an error message

    SAP CRM Functionality not working as expected

    A specification is needed with the preferred solution

    A shortdump is generated

    A table entry should be changed Finding possible user exits (will be handled by Aik)

    IntroductionReasons for debugging

  • 7/28/2019 Debugging 22

    5/26

  • 7/28/2019 Debugging 22

    6/26

    Overview debug screenConfiguration of the debug screen

    Close the windows

    Open new windows and select object

    Change object in current windows

    Open windows in full screen

    Swap windows vertical and horizontal

    Swap content of windows

    Tools (dependent on content) for search and

    saving

    Toggle

    between

    new and old

    Debugger

  • 7/28/2019 Debugging 22

    7/26

    Start debugging from the SAP CRM GUI menu Menu -> System -> Utilities -> Debug Screen

    Directly from Transaction Screen with /h Debug Screen

    /ha Debug ABAP

    /hs Debug System

    This is used when you want to debug a specific process whichcan be started from the GUI

    Start debugging after setting breakpoints

    When placing a session or external breakpoint the program willstop and open the debug screen

    Start debugging directly from function module/program Select

    Start debugging from SM50

    When a process is running you can debug this process usingMenu -> Administration -> Program -> Debugging

    DebuggingStart the debugger

  • 7/28/2019 Debugging 22

    8/26

    Single-Step (F5) During single step each program line will be visible. When theprogram calls another procedure/function module you will jumpto the coding of these routines.

    Execute (F6) During execute each program line will be visible, however the

    debugger will stay in the main program and will not jump to a

    procedure/function module (the actual procedure of functionmodule will be executed with this is not visible).

    Return (F7) When using return the debugger will jump to a higher level

    procedure/function module.

    Run (to Cursor) (F8)

    The debugger will continue with the program and stops when theprogram is finished or another breakpoint is reached.

    DebuggingNavigate during debugging

  • 7/28/2019 Debugging 22

    9/26

    An ABAP stack overview shows the order in which routines arecalled.

    Navigation between routines is possible during debugging

    The stack overview can be used to detect the orgin of thecause or to detect an usable function module

    DebuggingABAP Stack

  • 7/28/2019 Debugging 22

    10/26

    On top of the debug screen two system variables are alwaysvisible:

    SY-SUBRC

    0 means minimal 1 records has been found

    0 means a problem occured

    SY-TABIX Identifies the record (index) read from the internal table

    DebuggingSystem Variables

  • 7/28/2019 Debugging 22

    11/26

    In some cases a modal window is available from whichdebugging should be enabled

    Create a SAPGUI shortcut of type system command and systemcommand /h. Drop this shortcut on the modal window

    Create a textfile with following content:

    Drop this file on the modal window

    DebuggingStart debugging from a modal window

  • 7/28/2019 Debugging 22

    12/26

    SAP provides two different breakpoints: Session breakpoint

    A session breakpoint can be used when the user and the process is

    within the same GUI.

    External breakpoint

    An external breakpoint can be used when the user and the process

    are not within the same GUI. For example debugging the Webclientor WebUI, debugging the transfer between CRM and ECC

    Setting user for an external breakpoint can be done using Utilities ->Settings -> ABAP Editor -> Debugging

    Breakpoint can be activated :

    From the ABAP workbench

    During debugging

    BreakpointsSetting session and external breakpoints

  • 7/28/2019 Debugging 22

    13/26

    Breakpoints can be set at: Line level

    This is the standard behavior of placing beakpoints. They will be valid

    only for that specific line

    At .......

    It is possible to place breakpoints a specific statements, function

    modules, message etc.

    Usefull options are Breakpoint at Statement

    Message (to find any message genereated by SAP)

    Select (to find a table for specific data)

    BreakpointsSetting session and external breakpoints

  • 7/28/2019 Debugging 22

    14/26

    During debugging all parameters of a functionmodule can besaved as test data

    This can be usefull to isolate the problem and to have a goodtest scenario (it saves a lot of typing)

    BreakpointsSetting session and external breakpoints

  • 7/28/2019 Debugging 22

    15/26

    All enhancements and badis can be found easily usingfollowing tric:

    Start transaction SE24

    Select class CL_EXITHANDLER

    Set a breakpoint at method GET_INTANCE

    Now start the process and check all possible enhancements

    BreakpointsFinding enhancements spots

  • 7/28/2019 Debugging 22

    16/26

    Watchpoint can be used to stop the program when: A specific variable changes

    A specific variable changes to a certain value

    Watchpoints can be helpfull when an error occurs only for a

    specific situation or at a certain value.

    WatchpointsSetting watchpoints

    The variablechanges

    The variable

    changes to acertain value

  • 7/28/2019 Debugging 22

    17/26

    When SAP generates an (error) message, note down themessage identification

    Enter the program again in debug mode

    Create a watchpoint for variable SY-MSGID with condition SY-MSGID = or

    SY-MSGTY= E or W or SY-MSGNO= 012

    WatchpointsExample using watchpoints to check messages

  • 7/28/2019 Debugging 22

    18/26

    During debugging variables can be displayed and thecontent can be changed

    Double-click on any data element to see the content

    Show and Change contentShow variables

    Data elementis a table

    Data elementis a singlevariable

  • 7/28/2019 Debugging 22

    19/26

    (single) variables can be change using the button

    Show and Change contentEdit variables

  • 7/28/2019 Debugging 22

    20/26

    Table (content) can be changed only on line item

    Show and Change contentEdit tables

  • 7/28/2019 Debugging 22

    21/26

    Using debugging it is possible to change table entries of(standard) SAP tables

    As a prerequisite the table must contain at least one entry

    Open the table with se16

    Select the entry which should be changed

    Activate the debugger and press enter Change variable code to ....

    Show and Change contentChange (SAP) table entries

  • 7/28/2019 Debugging 22

    22/26

    There are different traces available is SAP which can help youfinding the location of the issue.

    The performance tace (transaction ST05) is the most usefulltrace.

    Before the problem occurs:

    Activate the trace Simulate the problem

    Deactivate the trace

    Display the trace file

    TracesPerformance Trace

    Always select

    SQL and RFC

    trace

    Activate for

    other user or a

    specific table

    Activate for

    current user

  • 7/28/2019 Debugging 22

    23/26

    As a result you will get a list of statements including the tablenames and data used.

    TracesPerformance Trace

    This column

    contains the

    tablenames

    All statements

    including the

    data used

    Jump into thespecific ABAP

    code

  • 7/28/2019 Debugging 22

    24/26

    Always try to minimize the problem for debugging For a functional point of view, try to identify what is causing the

    problem

    Use test data which can be easily recognized during debuggingand tracing

    When simulating the problem use data which can be traced as

    unique data

    Try to locate the problem using a trace file

    ST05 (based on the tables or function modules used, find the locationof the issue)

    Try to locate the problem on subroutine level

    Using debugging with F6 try to find which routine give the wrong result

    Try to isolate the problem

    If the problem can be located at a function module, you can test thefunction module seperatly

    Compare a working situation with the non working situation

    Tips & Trics for efficient debuggingUse this workprocedure for efficient debugging

  • 7/28/2019 Debugging 22

    25/26

    Debugging the middleware is more difficult, because this processrun mainly on the background

    Following oss notes explains step-be-step how to debug anymiddleware issue:

    SAP Note 656823 - FAQ: Tips and tricks for transfer debugging

    SAP Note Number 490932 Data exchange of sales transactionsbetween CRM & R/3

    SAP Note 847964 - CRM Service: Debugging BDOCs to R3

    Tips & Trics for efficient debuggingDebugging the middleware

  • 7/28/2019 Debugging 22

    26/26

    ACORELZwanebloemlaan 83

    1087 GD Amsterdam

    T +31 (0)20 468 7150

    F +31 (0)20 468 7151

    E [email protected]

    www.acorel.nl

    Follow us on:

    Thank you!

    Gert-Jan Stolmeijer

    Business Consultant

    M +31 (0) 6 5799 28 26

    E [email protected]

    http://www.linkedin.com/companies/acorelhttp://www.twitter.com/acorelhttp://www.facebook.com/acorel