Anda di halaman 1dari 46

IBM Global Business Services

Advanced features of ABAP debugger

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Objectives

Upon Completing the course the participant will be able to

Use the advanced features of ABAP debugging

Debug SAPscripts, Smartforms and ALV Layout

Access runtime SAP and ABAP memory through debugging

Debug a background job

Set and use additional parameters during debugging

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Course Outline
Advanced features of ABAP debugger

Split screen debugging


Search in internal table during debugging
Debugging from a pop-up screen
Display Unicode alignment bytes during debugging
Saving and loading of different sessions
Downloading of internal tables into Excel files
Accessing Higher level variables/ Internal Tables
Debugging in Loops
Debugging Remote Function Call
Navigation

Debugging Sapscript, Smartforms and ALV layout


Debug a SAPscript
Debug a Smartform
Debug a ALV Report

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Course Outline (Contd)


SAP and ABAP Memory
To view data in SAP memory during debugging
To view data in ABAP memory during debugging

Debugging a Background Job


How to debug a background job

Different settings and their use during debugging


How to Use of System Debugging
How to use Update debugging
Use other settings during debugging

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Split Screen Debugging (the New Debugger)

Difference between a Classic Debugger and a Split Screen Debugger

Classic Debugger is used for releases up to 6.40 and the Split Screen Debugger is
used for the releases after 6.40

The New Debugger is executed in one session while the application to be analyzed
uses a separate external session.

The Classic Debugger runs in the same session, where the application is analyzed
and so it is shown in the same window.

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Split Screen Debugging (the New Debugger)

Make settings for the new Debugger

After executing the transaction, choose the Menu path Utilities - > Settings. In the User
Specific Settings, choose the Debugging tab in the ABAP Editor

Debugging Tab

New Debugger
Radio Button

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Split Screen Debugging (the New Debugger)

Some Advantages of the New Debugger

Two tables are shown


simultaneously

Internal tables can be edited


easily

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Split Screen Debugging (the New Debugger)

Limitations of the new Debugger

It is not possible to set Watch Points in the New Debugger.

Debugging special types (http, BSP, RFC, update task) are not possible in the new
Debugger

Display of System areas are not possible in New Debugger

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Search in internal table during debugging

In Debug Mode, give the Internal table name and press the Find Button.

Find Button
Internal Table name

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Search in internal table during debugging


Put the values

10

Advanced Debugging

The required row is


highlighted

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging from a Pop-Up Screen

It is not possible to debug in a normal way from a pop-up screen since the
transaction code cannot be given. So to debug from a pop-screen

Create a SAP GUI shortcut on the desktop.

Edit the shortcut and edit it to Type = System Command and Command = /h.

Edit Type and Command

11

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging from a Pop-Up Screen

Drag and Drop the short cut on the pop-up screen. Now it is possible to debug
from the pop-up screen.

Put the Icon in the Pop-Up Screen

12

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Display Unicode alignment bytes during debugging

While in the debugger, use menu option Goto->Display Data Object->


System Information to display the Unicode fragment view for a structure
with mixed data types
13

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Saving and Loading of different sessions


After giving the Break-Points, go to the Menu Debugging- Sessions
Give the Name and the Expiration in the Next Screen to save the
breakpoints

14

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Downloading of internal tables into Excel files

Press the Table Button and give internal table name


and press the Save Excel Worksheet Button

15

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Downloading of internal tables into Excel files

Give the file name and path to save the internal table

16

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Accessing higher level variables/Internal tables

While coding in an exit, you


want to know the values
contained in the internal
table XKOMV of the SAP
program SAPLV61A.
But you do not have access
to that internal table. So
how do you see the values
in the debugger??

Enter internal name with its calling


program name in format shown

17

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Accessing higher level variables/Internal tables

If required, we can
define a field-symbol
and gain access to
this table field values
from an ABAP
program

Double-click on the internal table


name to see values stored in it

18

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging in Loops

Set a break point within Loop, where


program needs to be stopped.

19

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging in Loops

Go to Break Point Tab. Enter the


Number of Counts (99) against the
variable name

20

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging in Loops

Press continue button, program will


stop after the above mentioned loop
passes plus one i.e. 100th record.

21

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Failed
transactional
RFC calls
normally get
logged in SM58

Debugging Remote Function Calls


Go to Transaction SM58 (Transactional RFC)

Press Execute .

From the list displayed


select your relevant
record for the failed RFC

22

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging Remote Function Calls


Follow this Menu path in
SM58 after selecting the
relevant line

You reach the debugging


screen and proceed for
debugging as normal

23

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Navigation

Go To Statement

Go To Control
Current Control

24

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Navigation
But It is not possible to go to a statement of a previous Event which has
already been executed.

Navigation From Line


85 to Line 74 is not
possible

25

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a SAP Script


Go to SE71 and open the layout desired. Select menu Utilities -> Activate
Debugger or execute the ABAP Program 'RSTXDBUG'

Go to Form Debugger

26

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a SAP Script


SAP Script form debugger appears.

27

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a SAP Script

To trace in a SAP Script give all the values * and press the Trace on/off
button. Print Layout is appeared.

28

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a SAP Script


Click the Back Button and SAPscript debugger trace report will be displayed

29

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a Smart Form


Execute the transaction SMARTFORMS give the Form Name and Execute
it to get the Function Module which is generated

30

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a Smart Form


Error, message ID and number
appears as an output

31

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a Smart Form


.

To get the Error,


execute the Function
Module in Debug Mode
and set the Breakpoint
at Raise statement

Press F8 to check the type of formatting


or internal error and observe the message
number and tally the same with the initial
message number displayed.

32

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a Smart Form


Again Press F8 or Continue button. As the breakpoint has been set at the
raise error statement now proceed by single step debugging or F5 to locate
the function module SSFRT_READ_ERROR .

33

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debug a Smart Form


Delete all the break-points and put the break-point at CASE L_ERRORERRNUMBER(2) statement

Delete Break Point

Create Break Point

34

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging an ALV Report


Debugging an ALV Report can be done only in the list format

In the Function Module, set I_INTERFACE_CHECK = X

35

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging an ALV Report


Execute the ALV Report to see the result

The Fieldcatalogue, Layout and the errors are shown in screen

36

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

SAP and ABAP Memory


How to get SAP Memory and ABAP Memory during debugging

In the debug Mode, go to this path

37

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging a Background Job

(1) Set a breakpoint in


the code to be debugged
in background

(2) Schedule the job via SM36. While


scheduling go to the Start Conditions tab &
press the Date-Time button
(3) Set the start of execution time to a little
late than the system time

Then go to Job Step and select your


programs name and the variant name.
Then Save the job.
38

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Debugging a Background Job

(1) Go to job overview


and select the job

(2) Enter the command


jdbg and press enter

(4) Press F8 and


you stop at your
break-point set.
Carry on normal
debugging now

(3) Debugging
screen appears

39

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

How to Use System debugging


How to switch on System debugging?
(2) Save the settings by
clicking on the Save
button in the debugger
(3) Press continue to
complete execution

(1) You are in Debug Mode.


Press the Settings button
and check the checkbox as
shown

40

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

How to use Update Debugging


Update function modules do not run in the same user session as the program that
is currently running in the ABAP Debugger. These function modules are therefore
not included in debugging. Only if you select the Update Debugging option can you
display and debug them after the COMMIT WORK
(1) Example: Go to transaction CJ20N
(Project Builder)
(2) Change the Applicant Number, switch on
Debugging using /H and Save

Update Function Module


CJVB_MLST_POST is
called somewhere on save
whose properties are shown
41

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

How to use Update Debugging

How to switch on Update debugging?


(1) In debugging mode, use Menu
path Settings - > Update debugging
(2) In Debugger Settings tab, tick
Update Debugging checkbox

(4) Another SAP


debugger session
also opens up to
take you into the
update task
function module

(3) Press F8 and


continue execution.
Success message
appears in the same SAP
session window

42

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Use of Other Settings during Debugging


Checkbox in Debugger: In background task Do not process
When to use this setting in
the Debugger?
One example: Debugging
transactional RFC calls
done during sending IDOC
to external system using
ALE technology

Send a material to another


server via ALE using the
standard transaction BD10
Switch on Debug Mode
using /H and press execute

43

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Use of Other Settings during Debugging


(3) Press continue to
complete execution

(2) Save the settings by


clicking on the Save
button in the debugger

(1) Now you are in Debug


Mode. Press the Settings
button and check the
checkbox as shown

On completion of program execution, IDocs should get created in the database


44

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Use of Other Settings during Debugging


Now go to SM58 list which will look something like this:

(1) Note the Status text


Transaction Recorded
means execution is delayed
(2) To Debug RFC, now
Follow menu path:
EDIT->DEBUG LUW

(3) Then you reach the


debugging screen and
proceed for debugging as
normal

45

Advanced Debugging

08/17/15

2007 IBM Corporation

IBM Global Business Services

Summary
There are several advanced features of the ABAP Debugger
There is also a new version of ABAP debugger available in later SAP releases
It is possible to debug Sap Scripts, Smartforms and ALV reports
RFC debugging can be done via two different methods, via SM58 or using a
special setting in the ABAP Debugger
It is possible to debug background jobs
It is possible to debug popups appearing during SAP screen navigations
Several special settings in the debugger have been discussed such as Update
Debugging, System Debugging and Background Debugging
It is possible to display and access the SAP memory, ABAP memory and also
SAP buffer data from the ABAP debugger

46

Advanced Debugging

08/17/15

2007 IBM Corporation

Anda mungkin juga menyukai