Anda di halaman 1dari 3

19/11/2013

ABAP Debugger - ABAP Development - SCN Wiki


Getting Started New sletters

Welcome, Guest

Login

Register

Store

Search the Community

Products

Services & Support

About SCN

Downloads

Industries

Training & Education

Partnership

Developer Center

Lines of Business

University Alliances

Events & Webinars

Innovation

ABAP Development / FAQ

ABAP Debugger
Added by Guest, last edited by Sandra Rossi on May 28, 2010

The 2 debuggers
Classic ABAP Debugger
New ABAP Debugger

Frequently Asked Questions


How do I debug running background processes or asynchronous processes?
How do I debug completed background process?
How do I debug Updates/System code?
Why does it give a dump w hen I put a break-point in betw een SELECT and ENDSELECT? (classic debugger only)
How do I enter the debugger (/H) from modal dialogs? (popup w indow s)
How do I sw itch betw een the Classic and New Debugger?
Why debugger don't stop at my break-point?
How to debug tRFC function module

How do I debug running background processes or asynchronous processes?


In transaction SM50 (process overview ), you can select a background process and choose Program/Mode -> Program -> Debugging from the menu.
An alternative w orkaround, w hich allow s you to step into a particular piece of code is to place a piece of code in a endless DO-ENDDO, w here you can change a variable to step out of the DO at a
particular point in your code. This allow s you to hold the process at that point and debug it from SM50 as described above. An implementation of this exists in function module C160_HOLD_FOR_DEBUG,
w hich w ill enter the endless loop if a particular environment variable is set, thereby allow ing you to control its behaviour. (Further instructions are found in the comments in subroutine
INC14Z_HOLD_FOR_DEBUG of include LC14ZFCB).

How do I debug completed background process?


You can do this only after the job has finished execution. This w ill simulate the exact background scenario w ith the same selection screen values as used in the job and sy-batch set to 'X'.
Use SM37 to get list of jobs, put the cursor on the job, type JDBG in the command line ( no '/' ), and press ENTER
You are in debug mode now . Step through SAP program (press F7 couple of times) until you get to code you need.
Note: though running interactively, you can see that sy-batch = 'X'.

How do I debug Updates/System code?


Both options are available from the menu in debugging. Choose Settings -> System/Update Debugging to activate either before proceeding.

Why does it give a dump when I put a break-point in between SELECT and ENDSELECT? (classic debugger only)
A breakpoint in SELECT loops can cause an exception through loss of the database cursor. The reason for this is that during debugging a database commit is triggered and hence the cursor is lost.

How do I enter the debugger (/H) from modal dialogs? (popup windows)
In modal dialogs, the okcode field w here you usually enter /H is protected. You must use a SAPGUI shortcut, as explained in this w iki:

How do I switch between the Classic and New Debugger?


From w ithin the ABAP w orkbench, select the Utilities->Settings Menu
Select the ABAP Editor Tab
Select the Debugging tab w ithin the ABAP Editor Tab
Select the Classic Debugger or New Debugger radio button

Why debugger don't stop at my break-point?


(or step by step, or step into, at a CALL statement, doesn't go into the called procedure)
Many reasons:
Context

Explanation

Solution

User exit

you try to debug a user exit (CMOD transaction)

Make sure you have activated both the function module AND the user exit

wiki.scn.sap.com/wiki/display/ABAP/ABAP+Debugger

1/3

19/11/2013

ABAP Debugger - ABAP Development - SCN Wiki

(CMOD)
Update task

the code is called in an update task (CALL FUNCTION

enter /h and activate Update debugging, run the program. When the update debugging starts, press F9 key and enter the

... IN UPDATE TASK) and you did not activate the

name of the function module to add the break-point. Note: a break-point added before the update debugging starts is

Update debugging and you didn't set the break-point

ignored

after the update debugging has been started


Asynchronous

the code runs in asynchronous (aRFC, w orkflow ) or

Set an external break-point (see Note 668256 - Using HTTP/external debugging and Note 751872 - Problem analysis

(aRFC, HTTP)

in HTTP (BSP, WebDynpro, BI query, etc.) or is called

w ith HTTP or external debugging)

from other systems or clients (RFC)

External break-points are valid only 2 hours. Solution: add them again.
As explained in note 868830 - Cannot debug an RFC in a HTTP session, if you are currently debugging HTTP, you can't
go into a called RFC function module (even synchronous). The w orkaround is to set an external breakpoint in the called
RFC function module, or sw itch to classic debugger (if the button is available). Note: you don't need an external
breakpoint (step into w orks) if the ICF service option "GUI connection" is set to "Yes".

Background

it runs in background

job

SM37, select the job and use JDBG okcode, the job w ill starts interactively w ith sy-batch = 'X' (see Note 573128 Debugging programs in the background)

tRFC

it runs in tRFC (CALL FUNCTION ... IN BACKGROUND

See How to debug tRFC in the FAQ below

TASK)
run under

it runs under a different user, or in another client

you must both set break-points and run code w ithin same client and w ith same user

different user
or client
system

you set the break-point in a System program (program

enter /h and activate System debugging, run the program

program

status "System") and you did not activate the System

you may have to reenter /h and reactivate System debugging if break-point don't w ork again

debugging
program not

the program w as already running and you didn't

restarted

restart it and the Session Break-Point Immediately

Exit program and start it again

Active setting is off. This option is available in SE38,


menu Utilities | Settings | ABAP Editor | Debugging
Little bugs in

or you encountered one of the bugs since 7.0 (as I

enhancement

could see in SAPKB70013), because of some implicit

framew ork

enhancement options

Little bugs in

or you added a break-point in a Local Test Class

local test

(AUnit). Debug doesn't w ork very w ell (as I could see

classes

in SAPKB70013)

no break

the code is not called!

enter /h and add a break-point at the beginning of a form, function module or method by using F9 key and entering its name

A w orkaround is to call a procedure outside the test class and add a break-point in that procedure

add a break-point at an upper level or use SE30 to trace calls to make sure the procedure is called

because no
call

How to debug tRFC function module


Say YYYY does CALL FUNCTION 'XXXX' IN BACKGROUND TASK ..., and you w ant to debug XXXX
add breakpoint in YYYY before the CALL FUNCTION
start YYYY
w hen you reach the breakpoint, select menu Settings, Display/Change debugger settings, select the flag "tRFC (In Background Task): Block Sending". This flag means that, w hen the commit w ork occurs,
the background task (FMs + parameters) is stored into database but not executed.
run SM58
Select the background task, and choose menu edit + debug LUW, the "background task" w ill start interactively and the debugger w ill stop at predefined points by sap, and in FM XXXX automatically.

abap

debugger

1 Child Page
Soft breakpoint at statement

1 Comment

wiki.scn.sap.com/wiki/display/ABAP/ABAP+Debugger

2/3

19/11/2013

ABAP Debugger - ABAP Development - SCN Wiki

Guest

How to use 'Goto statement' to do backward debugging in ABAP ?


Scenario:
At the time debugging code for investigation, issue fixing or other purpose, there can be a situation that test data is hard to reproduce (1st case) or w e w ant debug a particular routine / FM
w ithin a loop for w hich there is only one record in internal table. And accidentally developer has pressed F6 than F5 and you missed that chance!

Challenge:
The pain is that now either w e have to run behind functional to get another test data (1st case) or have patience to go step by step again to reach that particular loop (2nd case).

Solution:
The 'Goto Statement' option in debugging can save us this effort. It is possible to go back to the previous statement after you position the cursor and click 'Goto statement' menu entry; program
control w ill move to the statement and debugging w ill start from that point.

Goto statment available in Classic Debugger menu:


Debugger -> Control -> Goto Statement

Goto statment available in New Debugger menu:


Debugger -> Control -> Goto Statement

Contact Us
Privacy

SAP Help Portal


Terms of Use

Legal Disclosure

wiki.scn.sap.com/wiki/display/ABAP/ABAP+Debugger

Copyright

Follow SCN

3/3

Anda mungkin juga menyukai