The ABAP application server is home to a collection of powerful runtime and error analysis tools that can assist you in accelerating ABAP programs on SAP HANA. When used correctly, they make it easier to identify potential areas of optimization, implement changes, and test such changes.
7Runtime and Error Analysis with SAP HANA
In the previous chapters, you learned about the various ABAP options available to you in relation to accessing the SAP HANA database. In addition to the already-familiar process of using SQL (Open SQL, including enhancements, and Native SQL) to access tables in the database, you learned various new ways to model and implement views and database procedures, as well as how to use ABAP to access these objects.
If you intend to develop a new application or to optimize an existing application for use with SAP HANA, you may be wondering which approach to adopt and which tools can support the undertaking. In this chapter, we’ll provide you with an overview of the runtime and error analysis tools available. In particular, we’ll focus on correct usage of these tools within the context of optimizing database accesses. As a result, we won’t discuss any other usage scenarios (e.g., system administration) or configuration options in detail here. As an ABAP developer, you’re already familiar with some of the tools that can be used for this purpose: For example, the SQL trace (Transaction ST05), ABAP runtime analysis (Transaction SAT), and the SAP Code Inspector. Therefore, we won’t describe their use in any detail. Basic information about these tools is available in ABAP Performance Tuning by Hermann Gahm (SAP PRESS, 2009). If needed, check out the SAP training course BC490, in which you learn how to use the analysis tools. This chapter focuses on the new SAP HANA-specific analysis options that are available within these tools.
In this chapter, we’ll use very simple examples to demonstrate the capabilities of and differences between each tool. Then, building upon this, we’ll demonstrate the correct use of these tools (either individually or in combination) within the context of a fictitious optimization project for an overall scenario, which we’ll discuss in Chapter 8.
7.1Overview of the Tools Available
Before we introduce each tool, we’ll provide an overview of all the tools available and classify them according to their usage scenario and primary user role. This overview also contains the release requirements for ABAP. We’ve classified the tools under the categories listed in Table 7.1.
Category |
Purpose |
Roles |
---|---|---|
Troubleshooting |
To identify and resolve functional problems |
|
ABAP code analysis |
To identify those parts of the ABAP program with potential for optimization |
|
Runtime statistics and traces |
To perform a detailed analysis of the runtime associated with an individual request (e.g., the runtime associated with a dialog step) |
|
System-wide SQL analyses |
|
|
SQL Performance Optimization |
To plan and perform an optimization |
|
Table 7.1Categorizing Runtime and Error Analysis Tools
If you optimize implementations on SAP HANA by transferring calculations to the database, this may lead to new sources of error. Within error analysis, our primary goal is to introduce you to the options available in relation to analyzing (and avoiding) program terminations associated with database accesses. In particular, we’ll discuss testing, analyzing, and debugging SQL statements and SQLScript procedures from ABAP programs.
A static code analysis provides clues about which parts of the ABAP program have potential for optimization. This is known as a static analysis because no runtime data is incorporated into it (e.g., the frequency with which a program or function is called within a particular period), and no dynamic calls are analyzed (e.g., SQL statements that are first generated at runtime). For the code analysis, SAP NetWeaver AS ABAP has a Code Inspector (Transaction SCI), which provides a set of checks that can be grouped into check variants. You can use the ABAP Test Cockpit (Transaction ATC) or the Code Inspector to perform these checks in the development environment. To ensure efficient ABAP programming, some new or improved checks have been added to ABAP 7.4.
AS ABAP contains a number of runtime analysis tools for a database request (or a sequence of requests). The statistic records (Transaction STAD) provide a simple overview of database times and are a useful starting point. The ABAP trace (Transaction SAT) provides detailed analysis options for individual statements. The new ABAP profiler in the ABAP development environment in Eclipse, which provides additional functions such as graphical representations, is also based on this infrastructure. In Chapter 3, we introduced you to the SQL trace (Transaction ST05), which also provides other useful runtime analysis functions. Single transaction analysis (Transaction ST12) is a special tool that combines Transactions STAD, SAT, and ST05 into one interface.
In SAP HANA, special tools are available for analyzing an individual SQL statement or a more complex SQLScript implementation. The explain plan provides information about the execution plan for an SQL statement, while SAP HANA Plan Visualizer (PlanViz) visualizes the execution plans for SQL statements and combines them with additional runtime information.
In Chapter 3, Section 3.2.5, we introduced you to the Database Administration Cockpit (DBA Cockpit; Transaction DBACOCKPIT). In addition to managing and configuring the database, the DBA Cockpit also provides some SQL performance analysis functions through, for example, the SQL cache and expensive SQL statement trace.
To determine a detailed SQL profile for applications within an SAP system, a new tool, the SQL Monitor (Transaction SQLM), is available as of AS ABAP 7.4. This tool monitors the production system and provides valuable performance optimization data.
The runtime check monitor is also new. You can use it to record specific SQL statements.
You can use the new SQL performance tuning worklist tool (Transaction SWLT) to combine the data from the SQL Monitor with the results of a code analysis and therefore make plans toward achieving a promising optimization. In the following sections, we’ll explain how to use each of these tools.