Run Time Analysis in ABAP


Run Time Analysis in  ABAP helps to identify problems during the execution of a program. It is done as shown.

BREAK-POINT
Basic form
BREAK-POINT.
Additions:

1. ... f

2. ... AT NEXT APPLICATION STATEMENT


The BREAK-POINT is a debugging aid. When you run a program normally, it is interrupted at the statement, and the system automatically starts the debugger, allowing you to display the contents of any fields in the program and check how the program continues.If the program is running in the background or in an update task, the system generates a Syslog message.


If a COMMIT WORK statement occurs in a SELECT loop, the database cursor is lost. This causes a run time error in the next loop pass when the system tries to read the next line of the table.Since debugging sometimes generates automatic COMMIT WORKs (non-production client or not debugging in debugging mode), it can be difficult to debug SELECT loops because BREAK-POINT statements within the loop can so easily lead to runtime errors.

You can set dynamic breakpoints in the Debugger without having to change the ABAP program. Such breakpoints are only valid for the user that set them, and are deleted when the user logs off.

Addition 1

... f

Effect

If the program is not running in dialog mode (background, update task), the contents of field f are output along with the system log message.

Addition 2

... AT NEXT APPLICATION STATEMENT

This addition is for internal use only. Changes and further developments, which may be incompatible, are possible at any time, and without notice or warning.

Effect

This statement is only relevant to system programs (program attributes, status "S"), or system modules, subroutines, or function modules (names begin with "%_") .If system debugging is not switched on, the program is not interrupted until it reaches a statement that is not in a system program (or module, subroutine, or function module).If system debugging is switched on, the program is interrupted at the statement itself.When system debugging is switched off, BREAK-POINT statements in system programs are ignored at runtime unless you use the AT NEXT APPLICATION

STATEMENT addition.


GET RUN TIME FIELD
Basic form 5
GET RUN TIME FIELD f.

Effect

Relative runtime in microseconds. When you first call GET RUN TIME, the field f is set to zero (initialized). Each subsequent call places the runtime since the first call into the field f. f must have type I.

The ABAP statements between two GET RUN TIME statements are known as the performance section, and the time between the two calls is known as the measurement interval.You can use SET RUN TIME CLOCK RESOLUTION to set the measurement accuracy. The default setting is high accuracy.


Example

Runtime measurement for the MOVE statement

DATA: T1 TYPE I,
T2 TYPE I,
TMIN TYPE I.

DATA: F1(4000), F2 LIKE F1.

TMIN = 1000000.
DO 10 TIMES.
GET RUN TIME FIELD T1.
MOVE F1 TO F2.
GET RUN TIME FIELD T2.
T2 = T2 - T1.
IF T2 < tmin =" T2."> Interval...').


Variant 1
SET RUN TIME CLOCK RESOLUTION HIGH.
Effect
GET RUN TIME uses high accuracy with a short measurement interval to measure the runtime.
Variant 2
SET RUN TIME CLOCK RESOLUTION LOW.
Effect
GET RUN TIME uses low accuracy with a long measurement interval to measure the runtime.

Note

Run time errors:

• SET_RUN_TIME_CLOCK_ERROR : After GET RUN TIME, you may no longer use SET RUN TIME CLOCK RESOLUTION.



SET RUN TIME ANALYZER ON/OFF Variants:

1. SET RUN TIME ANALYZER ON.
2. SET RUN TIME ANALYZER OFF.

Effect

These statements only work if you are executing a program using runtime analysis. If you select the Particular units option, the system only measures the statements that occur between SET RUN TIME ANALYZER ON and SET RUN TIME ANALYZER OFF.



You should remove these statements from your source code when you have finished measuring run time. This ensures that other users can define their own runtime monitoring criteria as well.

Variant 1

SET RUN TIME ANALYZER ON.

Effect

Starts writing performance data.
The return code is set as follows:
SY-SUBRC = 1:
The runtime analysis is not active, or the performance data file is not open for writing.
SY-SUBRC = 0:
All other cases.

Variant 2

SET RUN TIME ANALYZER OFF.
Effect
Stops writing performance data.

Example

DO 3 TIMES.

PERFORM NOT_TO_BE_MEASURED.

SET RUN TIME ANALYZER ON.
PERFORM TO_BE_MEASURED.
SET RUN TIME ANALYZER OFF.

PERFORM NOT_TO_BE_MEASURED.

ENDDO.

FORM NOT_TO_BE_MEASURED. ENDFORM.
FORM TO_BE_MEASURED. ENDFORM.


You can also start and stop measurement dynamically:

1. From the menu:• System → Utilities → Runtime analysis → Switch on • System → Utilities → Runtime analysis → Switch off
1. In the command field • /RON • /ROFF

RELATED POSTS

ABAP ENHANCEMENTS
SAP Authorization and ALE
Authorization and implementation of SAP
Mysap marketplace an introduction

No comments :

Post a Comment