Once we had the task to find out if there is any modification when executing a report. Since we knew that there is the table SMODILOG where all modifications (non Z/Y which are edited in the system) are listed, but we had no chance to find out which of these objects are loaded/executed while running the report.

After some brainstorming we came up with the idea to use a debugger script to compare each executed include/method with the entries in SMODILOG to find modified entries. Unfortunately we were not able to compare that on line level (since SMODILOG does not contain the changed lines), but finding the modified objects were good enough for us.

First we needed to create the debugger script which is used to compare the include of each executed line against SMODILOG. See the tutorial on the SAP blog how to create the debugger script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
CLASS lcl_debugger_script DEFINITION INHERITING FROM cl_tpda_script_class_super.

  PUBLIC SECTION.
    METHODS: 
      init REDEFINITION,
      script   REDEFINITION,
      end      REDEFINITION,
      prologue REDEFINITION.

  PRIVATE SECTION.
    TYPES: BEGIN OF t_include,
             name TYPE smodilog-obj_name,
           END OF t_include.

    DATA: lt_smodilog TYPE HASHED TABLE OF smodilog
                      WITH UNIQUE KEY obj_name sub_name int_name.
    DATA: lt_includes TYPE TABLE OF t_include.

ENDCLASS.   

CLASS lcl_debugger_script IMPLEMENTATION.
  METHOD prologue.
    " generate abap_source (source handler for ABAP)
    super->prologue( ).
  ENDMETHOD.                    

  METHOD init.
    SELECT *
      FROM smodilog
      INTO TABLE lt_smodilog
      WHERE operation EQ 'MOD'.

  ENDMETHOD.  

  METHOD script.
    DATA: ls_custom TYPE tpda_trace_custom.

    TRY.
        DATA(lf_include) = abap_source->include( ).
        IF NOT line_exists( lt_includes[ name = lf_include ] ).
          READ TABLE lt_smodilog WITH KEY obj_name = lf_include
                                          sub_name = lf_include
                                 TRANSPORTING NO FIELDS.
          IF sy-subrc EQ 0.
            APPEND VALUE #( name = lf_include )
              TO lt_includes.

          ENDIF.

        ENDIF.

      CATCH cx_root.
        RETURN.

    ENDTRY.

  ENDMETHOD.

  METHOD end.
    DATA: ls_custom TYPE tpda_trace_custom.

    SORT lt_includes.
    DELETE ADJACENT DUPLICATES FROM lt_includes.

    LOOP AT lt_includes ASSIGNING FIELD-SYMBOL(<s_include>).
      ls_custom-value = <s_include>-name.
      trace->add_custom_info( p_trace_entry = ls_custom ).

    ENDLOOP.

  ENDMETHOD.                    
  
ENDCLASS.    

After running the script you get a list of includes with modifications which have been executed while running the debugger script.