Logpoints are commonly used for writing a log entry when the relevant ABAP program reaches a certain point.
The two simple examples below show how the resulting log entries are to be interpreted.
Let’s assume that the position to be examined in the program is a DO statement with which squares of numbers are to be issued.
REPORT Z_DEMO_SIMPLE_LP. DATA square TYPE i. ... DO 10 TIMES. square = ipow( base = sy-index exp = 2 ). cl_demo_output=>write( |{ sy-index } { square }| ). ENDDO. ...
As Activity, we select the option User-Defined Logging, and specify the Key Definition, Field Values and Optional Condition as follows:
Due to the condition defined in the example, the result of the log is limited to two entries, which are represented by the key values [8] and [9]. The results display contains as uppermost node the Generation Time to which the values of the key are assigned (through the variable SY-INDEX). For each key value you have, in turn, the defined Field Values (SY-INDEX and SQUARE), whose results are issued in the Field Value column.
The following program demonstrates the call of one and the same routine over two different call paths. With this simple example, you learn how these different call paths are mirrored in the log results and how you can use the log information for the call stack analysis.
REPORT Z_DEMO_CALL_STACK. DO 10 TIMES. CASE sy-index. WHEN 1. PERFORM delegate_call. WHEN OTHERS. PERFORM do_something. ENDCASE. ENDDO. FORM do_something. MESSAGE 'Subroutine sucessfully executed' TYPE 'S'. ENDFORM. FORM delegate_call. PERFORM do_something. ENDFORM.
As Activity we choose the option Log Call Stacks and add the Optional Condition, as follows, in order to restrict the number of result entries:
As our result we get two different stacks, which represent the different call paths. In the first case (SY-INDEX = 1) 3 stack entries are counted, while for the other values (SY-INDEX > 1) 2 entries are counted. This corresponds exactly to the two call chains for the routine called in the example routine. As we limit the log events to 6 by using the condition SY-INDEX < 7 , we get a maximum number of 6 log events per program execution.