Debugging for Fuco s Training | Debugging | Subroutine

Debugging for Fuco’s

Explanation, tips & trics for debugging in SAP CRM
Gert-Jan Stolmeijer, Business Consultant 01-01-2013

Table of Contents
Introduction Debug screen Debugging Breakpoints and Watch points Show and Change Content Traces Tips & Tricks for efficient debugging Find tables and fields

Introduction Goal and Result of this training • This training is ment for functional consultants with minimal ABAP knowledge • As a prerequisite basic understanding of ABAP coding (Statements. Tables. 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 . Fields.

Introduction Reasons for debugging • Possible scenario’s 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 exit’s (will be handled by Aik) .

Overview debug screen Explanation of the debug screen Program System variables Use the tabs to change the information visible ABAP Coding Toolbox for screen changes Show variables .

Overview debug screen Configuration of the debug screen Toggle between new and old Debugger 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 .

Debugging Start the debugger • 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 which can be started from the GUI • Start debugging after setting breakpoints – When placing a session or external breakpoint the program will stop 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 using Menu -> Administration -> Program -> Debugging .

however the debugger will stay in the main program and will not jump to a procedure/function module (the actual procedure of function module will be executed with this is not visible).Debugging Navigate during debugging • Single-Step (F5) • Execute (F6) – During single step each program line will be visible. – During execute each program line will be visible. When the program calls another procedure/function module you will jump to the coding of these routines. • Return (F7) • Run (to Cursor) (F8) . – The debugger will continue with the program and stops when the program is finished or another breakpoint is reached. – When using return the debugger will jump to a higher level procedure/function module.

Debugging ABAP Stack • An ABAP stack overview shows the order in which routines are called. • Navigation between routines is possible during debugging • The stack overview can be used to detect the orgin of the cause or to detect an usable function module .

Debugging System Variables • On top of the debug screen two system variables are always visible: – SY-SUBRC • 0 • <>0 means minimal 1 records has been found means a problem occured – SY-TABIX • Identifies the record (index) read from the internal table .

Drop this shortcut on the modal window – Create a textfile with following content: Drop this file on the modal window .Debugging Start debugging from a modal window • In some cases a modal window is available from which debugging should be enabled – Create a SAPGUI shortcut of type system command and system command /h.

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 . For example debugging the Webclient or WebUI. – External breakpoint • An external breakpoint can be used when the user and the process are not within the same GUI.Breakpoints Setting session and external breakpoints • SAP provides two different breakpoints: – Session breakpoint • A session breakpoint can be used when the user and the process is within the same GUI.

They will be valid only for that specific line – At . message etc.Breakpoints Setting session and external breakpoints • Breakpoints can be set at: – Line level • This is the standard behavior of placing beakpoints. • Usefull options are ‘Breakpoint at Statement’ – Message (to find any message genereated by SAP) – Select (to find a table for specific data) ....... function modules. • It is possible to place breakpoints a specific statements.

Breakpoints Setting session and external breakpoints • During debugging all parameters of a functionmodule can be saved as test data • This can be usefull to isolate the problem and to have a good test scenario (it saves a lot of typing) .

Breakpoints Finding enhancements spots • All enhancements and badi’s can be found easily using following tric: – – – – Start transaction SE24 Select class CL_EXITHANDLER Set a breakpoint at method GET_INTANCE Now start the process and check all possible enhancements .

Watchpoints Setting watchpoints • 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. The variable changes The variable changes to a certain value .

note down the message identification • Enter the program again in debug mode • Create a watchpoint for variable SY-MSGID with condition SYMSGID = ‘<message>’ or • SY-MSGTY = ‘E’ or ‘W’ or • SY-MSGNO = ‘012’ .Watchpoints Example using watchpoints to check messages • When SAP generates an (error) message.

Show and Change content Show variables • During debugging variables can be displayed and the content can be changed • Double-click on any data element to see the content Data element is a single variable Data element is a table .

Show and Change content Edit variables • (single) variables can be change using the button .

Show and Change content Edit tables • Table (content) can be changed only on line item .

. .Show and Change content Change (SAP) table entries • 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 ...

Activate for Activate for other user or a • Before the problem occurs: current user – – – – Activate the trace Simulate the problem Deactivate the trace Display the trace file specific table Always select SQL and RFC trace . • The performance tace (transaction ST05) is the most usefull trace.Traces Performance Trace • There are different traces available is SAP which can help you finding the location of the issue.

Jump into the specific ABAP code All statements including the data used This column contains the tablenames .Traces Performance Trace • As a result you will get a list of statements including the table names and data used.

try to identify what is causing the problem • Use test data which can be easily recognized during debugging and 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.Tips & Trics for efficient debugging Use this workprocedure for efficient debugging • Always try to minimize the problem for debugging – For a functional point of view. find the location of 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 the function module seperatly • Compare a working situation with the non working situation .

FAQ: Tips and tricks for transfer debugging – SAP Note Number 490932 Data exchange of sales transactions between CRM & R/3 – SAP Note 847964 .Tips & Trics for efficient debugging Debugging the middleware • • Debugging the middleware is more difficult.CRM Service: Debugging BDOCs to R3 . because this process run mainly on the background Following oss notes explains step-be-step how to debug any middleware issue: – SAP Note 656823 .

nl ACOREL Zwanebloemlaan 83 1087 GD Amsterdam T +31 (0)20 468 7150 F +31 (0)20 468 7151 E info@acorel.nl Follow us on: .nl www.Thank you! Gert-Jan Stolmeijer Business Consultant M +31 (0) 6 5799 28 26 E gert-jan.acorel.stolmeijer@acorel.

Sign up to vote on this title
UsefulNot useful