Haltepunkte sichern

Kennen Sie das Problem, dass Sie bei einer komplexen Fehlersuche viele Haltepunkte mühsam neu setzen müssen, da diese nicht gespeichert werden können? Mit dem folgenden Programm können Sie die aktuellen Haltepunkte sichern und zu einem späteren Zeitpunkt wieder aktivieren.

Beschreibung

… folgt in Kürze…

Status

Den Status “LIST” legen Sie bitte mit Doppelklick auf “LIST” an (SET PF-STATUS).


Status “LIST”

Die einzelnen Funktionen können Sie den folgenden Funktionstasten zuweisen:

  • SAVE: F11
  • DELETE: SHIFT-F2
  • ACTIVATE: STRG-F3

Quellcode

****************************************
*** TESTED WITH SAP R/3 Release 4.6C ***
****************************************
REPORT zz_haltepunkte_sichern NO STANDARD PAGE HEADING.
**INCLUDE lsdbgtop.
*FUNCTION-POOL SDBG MESSAGE-ID SY.

TYPES: flag,
       bp_kind TYPE i,
* must correspond to SAVBR_BREAKPOINT in abdebug.c
       BEGIN OF savbr_breakpoint,
         bp_kind     TYPE bp_kind,
         program     LIKE sy-repid,
         cont_offset TYPE i,
       END   OF savbr_breakpoint.

CONSTANTS: c_true  TYPE flag VALUE ‘X’,
           c_false TYPE flag VALUE space,
* must correspond to BpKindComp in abstruc.h
           c_bp_kind_cont_wait TYPE bp_kind VALUE 1.

DATA cont LIKE rcont OCCURS 0 WITH HEADER LINE.
TYPES: ty_bpid(40).

DATA:
  t_breakpoints TYPE savbr_breakpoint OCCURS 30 WITH HEADER LINE,
  t_bpids       TYPE STANDARD TABLE OF ty_bpid,
  t_mainprog    TYPE STANDARD TABLE OF syrepid,
  l_mainprog    TYPE syrepid,
  t_bp_extern   LIKE breakpoint OCCURS 0 WITH HEADER LINE,
  l_answer      TYPE c,
  l_bpid        TYPE ty_bpid,
  l_breakpoint_db_id(40),
  l_breakpoint_db_id2(52),
  t_cuax        TYPE STANDARD TABLE OF syucomm,
  BEGIN OF t_bp_full OCCURS 0,
    mainprog    TYPE syrepid,
    progname    TYPE syrepid,
    line        TYPE i,
  END OF t_bp_full.

PARAMETERS: p_user TYPE syuname DEFAULT sy-uname OBLIGATORY.

START-OF-SELECTION.

  SET PF-STATUS space.

  CONCATENATE p_user ‘MyBreakPoints’ INTO l_breakpoint_db_id.
  IMPORT t_bpids FROM DATABASE indx(z7) ID l_breakpoint_db_id.

  PERFORM liste.

AT LINE-SELECTION.

  CHECK NOT l_bpid IS INITIAL.

  CLEAR t_cuax.

  IF l_bpid = ‘Aktuell aktive Breakpoints’.
    CALL ‘DEBUG_CNTL’
         ID ‘MODE’        FIELD ‘R’
         ID ‘BREAKPOINTS’ FIELD t_breakpoints[].
    APPEND ‘ACTIVATE’ TO t_cuax.


    PERFORM convert2extern.
  ELSE.
    APPEND ‘SAVE’ TO t_cuax.
    IF p_user <> sy-uname.
      APPEND ‘DELETE’ TO t_cuax.
    ENDIF.
    CONCATENATE p_user l_bpid INTO l_breakpoint_db_id2.
    IMPORT t_bp_full FROM DATABASE indx(z7) ID l_breakpoint_db_id2.
  ENDIF.

  SET PF-STATUS ‘LIST’ EXCLUDING t_cuax.

  WRITE: / l_bpid COLOR COL_POSITIVE.

  LOOP AT t_bp_full.

    WRITE: / t_bp_full-mainprog,
             t_bp_full-progname,
             t_bp_full-line.
  ENDLOOP.

AT USER-COMMAND.


  CASE sy-ucomm.

    WHEN ‘SAVE’.
      IF NOT t_bp_full[] IS INITIAL.
        l_bpid = ‘Mein Haltepunkt’.
        CALL FUNCTION ‘POPUP_TO_GET_VALUE’
             EXPORTING
                  fieldname           = ‘NAME1’
                  tabname             = ‘ADDR1_DATA’
                  titel               = ‘Beschreibung’
                  valuein             = l_bpid
             IMPORTING
                  answer              = l_answer
                  valueout            = l_bpid
             EXCEPTIONS
                  fieldname_not_found = 1
                  OTHERS              = 2.
        IF sy-subrc = 0 AND l_answer = space.
          COLLECT l_bpid INTO t_bpids.
          EXPORT t_bpids   TO DATABASE indx(z7) ID l_breakpoint_db_id.
          CONCATENATE p_user l_bpid INTO l_breakpoint_db_id2.
          EXPORT t_bp_full TO DATABASE indx(z7) ID l_breakpoint_db_id2.
          MESSAGE s420(sy).
          PERFORM liste.
        ENDIF.
      ENDIF.

    WHEN ‘DELETE’.
      READ TABLE t_bpids WITH KEY l_bpid TRANSPORTING NO FIELDS.
      IF sy-subrc = 0.
        DELETE t_bpids INDEX sy-tabix.
        EXPORT t_bpids TO   DATABASE indx(z7) ID l_breakpoint_db_id.
        CONCATENATE p_user l_bpid INTO l_breakpoint_db_id2.
        DELETE FROM DATABASE indx(z7) ID l_breakpoint_db_id2.
      ELSE.
*** Aktive Breakpoints
        LOOP AT t_bp_full.
          CALL FUNCTION ‘RS_DELETE_BREAKPOINT’
               EXPORTING
                    index    = t_bp_full-line
                    mainprog = t_bp_full-mainprog
                    program  = t_bp_full-progname.
        ENDLOOP.
      ENDIF.
      MESSAGE s413(sy).
      PERFORM liste.

    WHEN ‘ACTIVATE’.

      LOOP AT t_bp_full.

        CALL FUNCTION ‘RS_SET_BREAKPOINT’
             EXPORTING
                  index        = t_bp_full-line
                  program      = t_bp_full-progname
                  mainprogram  = t_bp_full-mainprog
             EXCEPTIONS
                  not_executed = 1
                  OTHERS       = 2.
      ENDLOOP.
      PERFORM liste.

  ENDCASE.

*&———————————————————————*
*&      Form  liste
*&———————————————————————*
FORM liste.

  sy-lsind = 0.

  l_bpid = ‘Aktuell aktive Breakpoints’.
  WRITE: / l_bpid HOTSPOT ON COLOR COL_TOTAL.
  HIDE l_bpid.

  IF sy-subrc = 0.
    LOOP AT t_bpids INTO l_bpid.
      WRITE: / l_bpid HOTSPOT ON.
      HIDE l_bpid.
    ENDLOOP.
  ENDIF.
  CLEAR l_bpid.

ENDFORM.                    ” liste

*———————————————————————*
*       FORM convert2extern                                           *
*———————————————————————*
FORM convert2extern.


  CLEAR t_bp_full[].
  CLEAR t_mainprog.
  LOOP AT t_breakpoints.
    COLLECT t_breakpoints-program INTO t_mainprog.
  ENDLOOP.

  LOOP AT t_mainprog INTO l_mainprog.

    CALL FUNCTION ‘SYSTEM_DEBUG_BREAKPOINTS’
         EXPORTING
              main_program = l_mainprog
         TABLES
              breakpoints  = t_bp_extern
         EXCEPTIONS
              generate     = 01.

    LOOP AT t_bp_extern.
      t_bp_full-mainprog = l_mainprog.
      t_bp_full-progname = t_bp_extern-program.
      t_bp_full-line     = t_bp_extern-line.
      APPEND t_bp_full.
    ENDLOOP.

  ENDLOOP.

ENDFORM.

 

Enno Wulff
Letzte Artikel von Enno Wulff (Alle anzeigen)