Entering content frameConceptual documentation Analyzing a Sample SQL Data File Locate the document in its SAP Library structure

When you create an SQL trace file for an application, you can see exactly how the system handles database requests. In a sample application, a report reads and later changes records on the ABAP Dictionary table SFLIGHT using ABAP Open SQL statements. Since the table SBOOK is not buffered, the system first needs to access the database to retrieve the records. In the sections below, the data file from the sample application is examined.

Read Access

The first screen of the SQL Trace data file displays each measured database request the application made. The trace file records when the request occurred and its duration. The ABAP Dictionary table involved in the request is also listed.

A trace file for a read access of the table SFLIGHT might look like this:

This graphic is explained in the accompanying text

 

The system measured several database operations involved in retrieving records from SFLIGHT:

Operation

Function

PREPARE

Prepares the OPEN statement for use and determines the data access method. Since an active cursor with the number 18 is available in the work process's cursor cache, the system does not perform a DECLARE operation. However, the system must prepare the SELECT statement that is used to read the table SFLIGHT.

The system does not issue the field 'MANDT' and 'CARRID' in the SELECT statement a value at this point but instead gives it a database-specific marker.

OPEN

Opens the cursor and specifies the selection result by filling the selection fields with concrete values. In the case of this example, the field 'MANDT' receives the value '000' and the field 'CARRID' receives the value 'LH'. The OPEN operation then creates a set of retrieved records in the database.

FETCH

Moves the cursor through the dataset created by the OPEN operation. The array size displayed beside the fetch data means that the system can transfer a maximum package size of 392 records at one time into the buffered area. The system allocates this space on the application server for the SFLIGHT table.

In the above example, the first FETCH retrieves the maximum number of records from the dataset. Then, the FETCH transfers these records to the program interface.

 

Write Access

An example SQL data file analyzing a request that changes data in the Table D010SINF might look like this:

This graphic is explained in the accompanying text

The example shows the system inserting new records into the table (INSERT). As in the first example, where the system carried out a read-only access, the system needs to prepare the database operations (PREPARE) that change the database records. The PREPARE precedes the other operations.

 

Leaving content frame