Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ABAP Trace
1
Course Contents (current Highlighted)
Debugger II Updates
Syslog
2
Overview (1)
OK,
Abap Trace,
But, How...What...
The Runtime Analyzer is specifically designed for tuning individual reports and
transactions. For broader tuning efforts on the system or database level, you should use
the Performance Trace (ST05) function.
3
Overview (2)
OK,
How could this be useful? What is my benefit?
Flow Hierarchy:
4
Understanding the Measurement (1)
What is measured?
How do they
ABAP statements that are potentially expensive in terms of CPU time. do it?
The most significant of these are:
DB accesses: Select, Exec SQL,
Modul. Units: Module, CALL Function, CALL SCREEN, CALL Transaction,
CALL Dialog
Internal Tables: Append, Collect, Sort, Read Table, Read Dataset
Datatransfer: Transfer, Assign
Others: EXPORT .. TO ..., IMPORT ... TO ..., Rollback, ...
SET PF-STATUS, SET TITLEBAR, MESSAGE
How is it measured?
During runtime analysis, the system measures the statements listed above.
The system stores these measurements in a performance data file.
You can evaluate the file immediately or at a later time.
The system subtracts the CPU consumption needed to measure data from the
overall CPU consumption.
To be able to use the tool at the right time you need to know what can be traced
To be able to evaluate the results you need to know how the measurement is done
5
Understanding the Measurement (2)
In real productive environment you will very often see the problem that the file size of the
trace file exceeds the allocated space on the system.
6
Understanding the Measurement (3)
memory consumption
Reliable
7
ABAP/4 Trace: How To Run It – TRACE ALL
And now,
How do I use
1. Specify type and name of the program the SE30?
2.
Set the filters according
to the information you
want to measure:
3.
Execute
2. Set the filters in your variant according to the information you want to be measured
8
ABAP/4 Trace: How To Run It – TRACE ALL
TMP
Change Do not forget !
Execute
9
ABAP/4 Trace: How To Run It - TRACE ALL
10
ABAP/4 Trace: How To Run It - TRACE ALL
11
ABAP/4 Trace: How To Run It - TRACE ALL
1)
Enter your data
and continue with ENTER
2)
Choose
SORG = 3020
3)
Receive the
I-message
and continue
12
ABAP/4 Trace: How To Run It - TRACE ALL
/nSE30
13
ABAP/4 Trace: How To Run It - TRACE ALL
ANALYZE or CHOOSE
from all available
performance files
14
ABAP/4 Trace: How To Run It - TRACE ALL
Note:
The percentage values for execution times are
depending on the recorded statements
The central focus is the colored bar chart, that shows the total execution time.
We notice that the main resource consumption is caused by the ABAP statements and not
the database load.
If a time segment exceeds 50% of total execution time, the appropriate bar appears in red
to signify an alert situation.
This alert bar is not a bible it serves only as an indicator where to start from. Depending on
the execution time and other circumstances the result may still be that the program will not
get changed.
15
ABAP/4 Trace: How To Run It - TRACE ALL
Run the trace for VA01 without analyzing it! Analysis will be done later.
First run: With the default options plus internal tables plus memory use. TASK
Aggregation: NONE.
Second run: With the default options. Aggregation: NONE.
Third run: With modularization units and screens only. Aggregation: NONE
Fourth run: With the default options. Aggregation: FULL
Get three more sessions, select the 4 different trace files and display the
runtime analysis overview screen.
Make sure that the recording has been successful (file size > 0)
Check the availability of the call hierarchy
Compare the file size of the recordings. What are your findings?
Don‘t bother analyzing the details. That will be covered later on.
16
ABAP/4 Trace: How To Run It - TRACE ALL
17
ABAP/4 Trace: Be Aware of Trace File Size
The size of the trace file strongly depends on the amount of data that is included
18
ABAP/4 Trace: How To Run It - TRACE ALL
Solution
Did you notice that the size of the trace file increased every time?
Note:
Don‘t stick to much to the overview screen it will vary depending on the trace options.
This is only intended to give you an indication if you most likely should start with ABAP or
SQL Analysis, if you are dealing with performance problems.
If you are interested in performance, always execute the whole transaction once before
you start tracing. Otherwise the times for loading and generating may lead to unexpected
results and guide your analysis in wrong direction.
19
ABAP/4 Trace: How To Run it –
TRACE PARTICULAR UNITS
And now,
How do I trace a
particular unit?
3. Execute
20
ABAP/4 Trace: How To Run it –
TRACE PARTICULAR UNITS
21
ABAP/4 Trace: How To Run It –
TRACE PARTICULAR UNITS
22
ABAP/4 Trace: How To Run It –
TRACE PARTICULAR UNITS
/nSE30
23
ABAP/4 Trace: How To Run It –
TRACE PARTICULAR UNITS
Run the trace for VA01 without analyzing it! Analyzing will be done later.
Start the actual recording on the second screen. TASK
Run SE30.
Select the default statements plus Internal tables.
Choose Aggregation NONE.
Use the following data:
Order Type : TA
Sales Organisation:0001
Distribution Channel: 01
Division: 01
<ENTER>
Sold-to-party: 3063
Purch. Order no.: 1
Item: 1
Material: T-HM123
<ENTER>
SORG: 3020
Don‘t bother analyzing the details. That will be covered later on.
24
ABAP/4 Trace: How To Run It –
TRACE PARTICULAR UNITS
Solution
25
ABAP/4 Trace – Understanding The Analysis
SE30
initial screen
Display filter
Hit list Table hit list Group hit list Call hierarchy Table hit list
You can branch to the ABAP Editor from the hit list, the group hit list and the call hierarchy.
You can navigate into the dictionary directly from the table hit list.
26
ABAP/4 Trace – Understanding The Analysis
Hit list F5
The times displayed here depend on the selection in the display filter.
The hit list shows you which statements were the most expensive and is sorted by gross
time in descending order. The value in the number column tells you how many times the
statement was called.
27
ABAP/4 Trace – Understanding The Analysis
Gross
This time includes the time
Hit list F5 needed to complete the
processing of all called programs,
functions, forms or any other
modularization unit Net
This time is exactly the time
spend in this mudularization unit.
Sort according to
the NET times and
check for the most
expensive call
(ABAP or SQL)
Continue with particular unit
trace using specific options
or SQL trace for the
statement!
28
ABAP/4 Trace – Understanding The Analysis
29
ABAP/4 Trace – Understanding The Analysis
Call hierarchy F8
No sort option,
since you want to Memory requested
analyze the
by each program
structure!!!!
Option „Memory management‘‘ not
required for this output
The call hierarchy allows you to display a more precise list showing the chronological flow
of your transaction or report. Subroutine calls are intended to increase the readability.
The functions displayed in the column ‘call hierarchy’ are specified by the program that
called them and by the level in the call hierarchy.
30
ABAP/4 Trace – Understanding The Analysis
The table hit list contains a list of the relevant database tables, the number of accesses and
the time required for each and the short description and the buffer method used in the SAP
system.
With a double click you can obtain more detailed information about the database accesses
of one specific table.
If you want to see the exact context of a particular statement, you can branch to a source
code display.
The source code you see is a simple listing with numbered lines, with the cursor positioned
in the line containing the specific statement.
31
ABAP/4 Trace: How To Read It
Check the table hit list for partial buffering and the flow hierarchy for select single
Double- click
Or
Search the hierarchy
Goto the table hit list and look for a table that is defined to be partially buffered
Here you can double click to get an overview on the origin of the statements in the
source code
You can directly branch into the source code from there
Goto the hierarchy and search for the table name and check if the select single is used
when it should be used
32
ABAP/4 Trace: How To Read It
The first 4 contain an error message and the 5th (particular units…) a warning message.
33
ABAP/4 Trace: How To Read It
Do the select statements take advantage of the the partial buffering whenever
possible?
(use the table hit list and the hierarchy)
The first 4 contain an error message and the 5th (particular units…) a warning message.
34
ABAP/4 Trace: How To Proceed With Analysis
Analyze the fourth trace created for VA01 (the one tracing
particular units)
Find the reason, why the E-message (E382) is being raised. TASK
Find the message in the call hierarchy.
Check the entries that are preceding the message statement in the trace file.
Navigate to the source Code and get an idea what is going on.
Create a breakpoint at relevant statements and verify your understanding. Make use of
the debugger.
What is the result of the select statement on MARA?
Optional:
Find the reason for the I-message (I101). Proceed as with the E-message.
What happens directly before the message? Get the name of the internal table and also
the call level in the hierarchy.
Navigate to the source code and create a breakpoint to verify that the read is
responsible for raising the I-message.
Search the call hierarchy for previous operations on this internal table. Use Call
hierarchy AND Debugger to understand what is going on technically.
The first 4 contain an error message and the 5th (particular units…) a warning message.
35
ABAP/4 Trace: How To Read It
Hint:
Use the overall hit list to search for the most expensive processing
Use the table hit list to identify the most expensive table access
36
ABAP/4 Trace: How To Read It
Solution
Almost the same amount of time is spend in the db access as in the abap processing. We
will have to have a look into both areas.
37
ABAP/4 Trace: How To Read It
Solution
ABAP processing:
Table access:
Fetch DF14L
38
ABAP/4 Trace: How To Read It
Solution
You may set a breakpoint directly from SE30 and start the
transaction again to get directly to the point of interest
39
Tips&Tricks:
Download the Trace File for Later Analysis
Safe trace on your PC
as an unconverted file (.txt)
Load file into Excel
40
Tips&Tricks:
Create an Excel From the Trace File
41
Tips&Tricks:
Analyse Runtime Consumption at the Levels
42
ABAP/4 Trace: Specialties
Batches
Variants
Updates
43
ABAP/4 Trace: Specialties - Batches
44
ABAP/4 Trace: Specialties - Batches
Restrictions:
Step 1:
note 192277 1)Report is running in Batch
Record a session
Input Mode (SY-BINPT)
SHDB
2)No Particular Unit Trace
(only function trace)
3)No Spool List in SM37
->use the debugger
F5 Session name
45
ABAP/4 Trace: Specialties - Batches
Step 1:
Record a session
Program to be traced
46
ABAP/4 Trace: Specialties - Batches
Continue:
4.0 4.6
47
ABAP/4 Trace: Specialties - Batches
Step 2:
Generate a session Continue:
F8: Overview
F8
4.6
4.0
48
ABAP/4 Trace: Specialties - Batches
Step 3:
Run the session to create the trace
SM35 SM35
4.0 4.6
F2:process session
You must choose Background destination otherwise the program will be processed in the
Dialog work process!
49
ABAP/4 Trace: Specialties - Batches
Step 4:
Find the the trace (User, Transaction)
SE30
50
ABAP/4 Trace: Specialties - Batches
Check:
Is there a difference?
Where can you find it?
51
ABAP/4 Trace: Specialties - Batches
Solution
52
ABAP/4 Trace – SE30: Specialties - Variants
53
ABAP/4 Trace – SE30: Specialties - Variants
Step 1:
Create the transaction variant
SHD0
Tip:
How to create the variant
1)SHD0
On 4.6: Use Transaction: ZV1_CW_ASYNCH_ERR 2)Your transaction
3)Type in any name for the
variant
4)Use the create button
5)Choose a short text
6)Button Screen entries
54
ABAP/4 Trace – SE30: Specialties - Variants
Step 1:
Create the transaction variant
SAVE: CTRL+S
55
ABAP/4 Trace – SE30: Specialties - Variants
56
ABAP/4 Trace – SE30: Specialties - Variants
Solution
The first screen is Number ‚100‘. This is defined in the transaction, therefore we do not see
any setting in the program
TIP: It might be a good idea to run the SQL trace at the same time
57
ABAP/4 Trace: Specialties – Update
TIP
Especially helpful when
Trace an aborted update request working on Problems
when you cannot
Goto SE30 run the transaction again
Start the measurement of SM13 (with particular units)
List the aborted request
Switch the trace on
And trace the request by using the test functionality in SM13
Note: After the test has finished the system will automatically perform a rollback.
There will be no change in the actual data of the DB.
Question:
In what kind of process will your trace run?
Dialog....
Why?
Tracing the full run you use the debugging mode in a dialog work process
Tracing the aborted update request will run in dialog mode as well. This is only a
simulation!
58
ABAP/4 Trace – Configuration / Troubleshooting
SE38 RSPARAM
In case of any problems check the file size quota and the space available in the directory.
RSPARAM:
Never really hered before? This report lists the current parameter setting in the system
RSPARAM1 would only list the variables that are used. This functionality is provided in
REPARAM as an option.
59
ABAP/4 Trace - program analysis made easier
Administration changed:
If you can not change the select anymore for testing:
-productive system: set to not changeable?
-authority check: s_develop?
Tips & Tricks offers the developer help and guidelines in the ABAP/4 runtime analyzer for
efficient ABAP/4 programming. The examples take into account performance critical
aspects of ABAP/4 programming, such as: database access, string manipulation, internal
table processing.
Every example is shown in two variants. You can measure the runtime for both, so that the
differences can be seen immediately.
Be aware that there is only a significant comparision possible if the amount of data is
typically for the application tested
60
Summary
61
Copyright 2009 SAP AG
All Rights Reserved
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein
may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries,
eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+,
POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex,
MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other
countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos
are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and
services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries.
Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only.
National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only,
without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group
products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed
as constituting an additional warrant.
62