Skip to end of metadata
Go to start of metadata

Author: Andrea Olivieri
Supported Releases: SAP ECC 6.0
Submitted: 05 November 2011

General Notes

You can get a list of all the active checkpoints groups directly from the SAAB transaction by selecting the menu: Activation> Display> ALL
However, if you need to perform this simple but useful check as a scheduled background job, I implemented this simple report.

Text Elements

Selection Texts:

Name

Text

Dictionary

SO_NAME

Object Name

 

SO_USER1

User

X

Text Symbols

Symbol

Text

051

Breakpoint

093

Checkpoint Group

094

Program

095

Class

096

Function Group

09A

System Variant

ADQ

Activation Date

ADT

Current Date

AGL

Global Activation

ASS

Assert

ATM

Current Time

ATQ

Activation Time

AUQ

Activated by User

AUS

Current User

CNM

Object Name

CTY

Object Type

LPT

Logpoint

MAB

Abort

MIN

Inactive

MLG

Log

MSA

Break/Abort

MSL

Break/Log

MST

Break

ABAP Source Code

*&---------------------------------------------------------------------*
*& Report  ZSDN_SHOW_ACT_ID
*&
*&---------------------------------------------------------------------*
* Report Name: SDN: Simple Report 2 display Checkpoint activations
* Created on : 04.11.2011 at 14:20:36 CET
* Created by : Andrea Olivieri
* Company    : Techedge S.p.A
* Notes      : A lot of source code taken from standard program SAPLSAAB
*----------------------------------------------------------------------*

REPORT  zsdn_show_act_id.
TYPE-POOLS: abap.
* Tables ( To support selection screen )
TABLES:  aab_id_act.

*----------------------------------------------------------------------*
*       CLASS lcl_global_activation DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_global_activation DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS mode2name
    IMPORTING mode        TYPE aab_id_mode
    RETURNING value(name) TYPE aab_var_name.
ENDCLASS.                    "lcl_global_activation DEFINITION
*----------------------------------------------------------------------*
*       CLASS lcl_global_activation IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_global_activation IMPLEMENTATION.

  METHOD mode2name.
    CASE mode.
      WHEN 18.
        name = 'ALL_BREAK_LOG'.
      WHEN 34.
        name = 'ALL_BREAK_ABORT'.
      WHEN 20.
        name = 'ALL_LOG_LOG'.
      WHEN 40.
        name = 'ALL_ABORT_ABORT'.
      WHEN OTHERS.
        CLEAR name.
    ENDCASE.

  ENDMETHOD.                                                "mode2name
ENDCLASS.                    "lcl_global_activation IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS lcl_activation DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_activation DEFINITION.

  PUBLIC SECTION.

    TYPES act_text_t TYPE char30.

    CLASS-METHODS is_breakpoint_active
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS get_breakpoint_act
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(act_text) TYPE act_text_t.

    CLASS-METHODS is_logpoint_active
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS get_logpoint_act
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(act_text) TYPE act_text_t.

    CLASS-METHODS is_assert_active
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS is_assert_active_abort
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS is_assert_active_log
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS is_assert_active_stop_abort
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS is_assert_active_stop_log
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(active) TYPE abap_bool.

    CLASS-METHODS get_assert_act
      IMPORTING act_mode TYPE aab_id_mode
      RETURNING value(act_text) TYPE act_text_t.


  PRIVATE SECTION.

    CONSTANTS: bit_pos_breakpoint      TYPE i VALUE 8,
               bit_pos_assert_fg_stop  TYPE i VALUE 7,
               bit_pos_assert_fg_log   TYPE i VALUE 6,
               bit_pos_assert_fg_abort TYPE i VALUE 5,
               bit_pos_assert_bg_log   TYPE i VALUE 4,
               bit_pos_assert_bg_abort TYPE i VALUE 3,
               bit_pos_logpoint        TYPE i VALUE 2.

    CLASS-METHODS is_bit_set
      IMPORTING mode    TYPE aab_id_mode
                bit_pos TYPE i
      RETURNING value(is_set) TYPE abap_bool.

    CLASS-METHODS set_bit
      IMPORTING value   TYPE abap_bool
                bit_pos TYPE i
      CHANGING  mode    TYPE aab_id_mode.

ENDCLASS.                    "lcl_activation DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_activation IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_activation IMPLEMENTATION.

  METHOD is_breakpoint_active.
    active = is_bit_set( mode = act_mode  bit_pos = bit_pos_breakpoint ).
  ENDMETHOD.                    "is_breakpoint_active

  METHOD get_breakpoint_act.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_breakpoint ) EQ abap_true.
      act_text = 'Break'(mst).
    ELSE.
      act_text = 'Inactive'(min).
    ENDIF.
  ENDMETHOD.                    "get_breakpoint_act

  METHOD is_logpoint_active.
    active = is_bit_set( mode = act_mode  bit_pos = bit_pos_logpoint ).
  ENDMETHOD.                    "is_logpoint_active

  METHOD get_logpoint_act.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_logpoint ) EQ abap_true.
      act_text = 'Log'(mlg).
    ELSE.
      act_text = 'Inactive'(min).
    ENDIF.
  ENDMETHOD.                    "get_logpoint_act

  METHOD is_assert_active.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_stop )  EQ abap_true OR
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_log )   EQ abap_true OR
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_abort ) EQ abap_true OR
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_log )   EQ abap_true OR
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_abort ) EQ abap_true.
      active = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_assert_active

  METHOD is_assert_active_abort.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_abort ) EQ abap_true.
      active = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_assert_active_abort

  METHOD is_assert_active_log.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_log ) EQ abap_true.
      active = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_assert_active_log

  METHOD is_assert_active_stop_abort.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_stop )  EQ abap_true AND
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_abort ) EQ abap_true.
      active = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_assert_active_stop_abort

  METHOD is_assert_active_stop_log.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_stop )  EQ abap_true AND
       is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_log )   EQ abap_true.
      active = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_assert_active_stop_log

  METHOD get_assert_act.
    IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_stop ) EQ abap_true.
      IF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_log ) EQ abap_true.
        act_text = 'Break/Log'(msl).
      ELSEIF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_bg_abort ) EQ abap_true.
        act_text = 'Break/Abort'(msa).
      ELSE.
        act_text = 'Break'(mst).
      ENDIF.
    ELSEIF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_log ) EQ abap_true.
      act_text = 'Log'(mlg).
    ELSEIF is_bit_set( mode = act_mode  bit_pos = bit_pos_assert_fg_abort ) EQ abap_true.
      act_text = 'Abort'(mab).
    ELSE.
      act_text = 'Inactive'(min).
    ENDIF.
  ENDMETHOD.                    "get_assert_act

  METHOD is_bit_set.
    DATA bit_value TYPE i.
    FIELD-SYMBOLS <mode_x> TYPE x.

    ASSIGN mode TO <mode_x> CASTING.
    GET BIT bit_pos OF <mode_x> INTO bit_value.

    ASSERT sy-subrc EQ 0.

    IF bit_value IS NOT INITIAL.
      is_set = abap_true.
    ENDIF.
  ENDMETHOD.                    "is_bit_set

  METHOD set_bit.

    DATA bit_value TYPE i.
    FIELD-SYMBOLS <mode_x> TYPE x.

    IF value IS INITIAL.
      bit_value = 0.
    ELSE.
      bit_value = 1.
    ENDIF.

    ASSIGN mode TO <mode_x> CASTING.
    SET BIT bit_pos OF <mode_x> TO bit_value.

    ASSERT sy-subrc EQ 0.

  ENDMETHOD.                    "set_bit
ENDCLASS.                    "lcl_activation IMPLEMENTATION

*--------------------------------------------------------------------*
*      S E L E C T I O N   S C R E E N
*--------------------------------------------------------------------*

SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE title01.
SELECT-OPTIONS: so_name                               FOR aab_id_act-name.
SELECT-OPTIONS: so_user1                              FOR aab_id_act-username.
SELECTION-SCREEN: END OF BLOCK b01.

*--------------------------------------------------------------------*
*       D A T A   D E C L A R A T I O N
*--------------------------------------------------------------------*
* Types
TYPES: act_breakpoint_t TYPE lcl_activation=>act_text_t,
       act_logpoint_t   TYPE lcl_activation=>act_text_t,
       act_assert_t     TYPE lcl_activation=>act_text_t.

TYPES: BEGIN OF outtab_common_t,
         ct       TYPE lvc_t_scol,
         otype    TYPE aab_objecttype,
         name     TYPE progname,
       END OF outtab_common_t.

TYPES: BEGIN OF outtab_act_t.
        INCLUDE TYPE outtab_common_t.
TYPES:   act_breakpoint TYPE act_breakpoint_t,
         act_logpoint   TYPE act_logpoint_t,
         act_assert     TYPE act_assert_t,
       END OF outtab_act_t.

TYPES: BEGIN OF outtab_act_display_t.
        INCLUDE TYPE outtab_act_t.
TYPES:   order_by  TYPE i,
         username  TYPE xubname,
         server    TYPE msname2,
         act_user  TYPE xubname,
         act_date  TYPE datum,
         act_time  TYPE uzeit,
       END OF outtab_act_display_t.
* Internal tables and work areas
DATA: lt_act    TYPE TABLE OF aab_id_act,
      it_outtab TYPE STANDARD TABLE OF outtab_act_display_t,
      gv_title       TYPE lvc_title.

INITIALIZATION.
  SELECT SINGLE MAX( ddtext ) FROM dd02t INTO title01 WHERE tabname    = 'AAB_ID_ACT'
                                                        AND ddlanguage = sy-langu. "#EC *

*--------------------------------------------------------------------*
*       D A T A   S E L E C T I O N
*--------------------------------------------------------------------*
START-OF-SELECTION.

  SELECT * FROM aab_id_act INTO TABLE lt_act
    WHERE name      IN so_name AND
          username  IN so_user1 .

  IF sy-subrc <> 0.
    MESSAGE i333(s1) WITH 'Nothing found...Bye!'(e01).
    RETURN.
  ENDIF.

  PERFORM fill_outtab.
*--------------------------------------------------------------------*
*        A L V   P R O C E S S I N G
*--------------------------------------------------------------------*
END-OF-SELECTION.
  PERFORM alv.
*&---------------------------------------------------------------------*
*&      Form  FILL_OUTTAB
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM fill_outtab .

  DATA: ls_act    TYPE aab_id_act,
        ls_outtab LIKE LINE OF it_outtab,
        l_object  TYPE trobjtype,
        wa_color  TYPE lvc_s_scol.

* loop at object list
  LOOP AT lt_act INTO ls_act.

*** determine object name & type ***
    IF ls_act-is_program IS INITIAL.
      IF ls_act-name IS NOT INITIAL. "Checkpoint Group
        ls_outtab-otype    = 'Checkpoint Group'(093).
        ls_outtab-name     = ls_act-name.
        ls_outtab-order_by = 2.
      ELSE.                          "System Variant
        ls_outtab-otype    = 'System Variant'(09a).
        ls_outtab-name     = lcl_global_activation=>mode2name( ls_act-actmode ).
        ls_outtab-order_by = 1.
      ENDIF.
    ELSE.
      CALL METHOD cl_aab_variant=>get_obj_from_tech_name
        EXPORTING
          im_tech_name = ls_act-name
        IMPORTING
          ex_name      = ls_outtab-name
          ex_object    = l_object.
      CASE l_object.
        WHEN 'PROG'. "program
          ls_outtab-otype    = 'Program'(094).
          ls_outtab-order_by = 3.
        WHEN 'CLAS'. "class
          ls_outtab-otype    = 'Class'(095).
          ls_outtab-order_by = 4.
        WHEN 'FUGR'. "function group
          ls_outtab-otype    = 'Function Group'(096).
          ls_outtab-order_by = 5.
      ENDCASE.
    ENDIF.

    ls_outtab-username = ls_act-username.
    ls_outtab-server   = ls_act-server.
    ls_outtab-act_user = ls_act-act_user.

*** color for own activations ***
    IF ls_outtab-username EQ sy-uname.                      "#EC *
      wa_color-color-col = 6. "red
      wa_color-fname     = 'USERNAME'.
      INSERT wa_color INTO TABLE ls_outtab-ct.
    ENDIF.

    CONVERT TIME STAMP ls_act-act_tstamp TIME ZONE sy-zonlo INTO
       DATE ls_outtab-act_date TIME ls_outtab-act_time.

    ls_outtab-act_breakpoint = lcl_activation=>get_breakpoint_act( ls_act-actmode ).
    ls_outtab-act_logpoint   = lcl_activation=>get_logpoint_act( ls_act-actmode ).
    ls_outtab-act_assert     = lcl_activation=>get_assert_act( ls_act-actmode ).

*** color for non-inactive settings ***
    IF lcl_activation=>is_breakpoint_active( ls_act-actmode ) EQ abap_true.
      wa_color-color-col = 3. "yellow
      wa_color-fname = 'ACT_BREAKPOINT'.
      INSERT wa_color INTO TABLE ls_outtab-ct.
    ENDIF.
    IF lcl_activation=>is_logpoint_active( ls_act-actmode ) EQ abap_true.
      wa_color-color-col = 3.
      wa_color-fname = 'ACT_LOGPOINT'.
      INSERT wa_color INTO TABLE ls_outtab-ct.
    ENDIF.
    IF lcl_activation=>is_assert_active( ls_act-actmode ) EQ abap_true.
      wa_color-color-col = 3.
      wa_color-fname = 'ACT_ASSERT'.
      INSERT wa_color INTO TABLE ls_outtab-ct.
    ENDIF.

    INSERT ls_outtab INTO TABLE it_outtab.
    CLEAR ls_outtab.
  ENDLOOP.

  SORT it_outtab BY order_by name.
ENDFORM.                    " FILL_OUTTAB
*&---------------------------------------------------------------------*
*&      Form  ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM alv .
  DATA: gr_table     TYPE REF TO cl_salv_table,
        gr_display   TYPE REF TO cl_salv_display_settings,
        gr_functions TYPE REF TO cl_salv_functions,
        gr_columns   type ref to cl_salv_columns_table.


  CHECK NOT it_outtab IS INITIAL.

  gv_title = 'SDN: Simple report to get a list of all active checkpoints'(tit).

  TRY.
*     Create ALV table
      cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = it_outtab ).
*     Set zebra layout
      gr_display = gr_table->get_display_settings( ).
*     Display all standard function
      gr_functions = gr_table->get_functions( ).
      gr_functions->set_all( abap_true ).
      gr_columns = gr_table->get_columns( ).
      gr_columns->set_color_column( 'CT' ).
      gr_columns->set_optimize( abap_true ).

      perform set_columns_technical using gr_columns.

*     Display table
      gr_table->display( ).

    CATCH cx_salv_msg.
      WRITE: / 'Exception CX_SALV_MSG'.                     "#EC NOTEXT
    CATCH cx_salv_not_found.
      WRITE: / 'Exception CX_SALV_NOT_FOUND'.               "#EC NOTEXT
    CATCH cx_salv_data_error.
      WRITE: / 'Exception CX_SALV_DATA_ERROR'.              "#EC NOTEXT
    CATCH cx_salv_existing.
      WRITE: / 'Exception CX_SALV_EXISTING'.                "#EC NOTEXT
  ENDTRY.
ENDFORM.                    " ALV
*&--------------------------------------------------------------------*
*&      Form  set_columns_technical
*&--------------------------------------------------------------------*
*       Form colunms setting
*---------------------------------------------------------------------*
FORM set_columns_technical USING ir_columns TYPE REF TO cl_salv_columns_table.

  DATA: lr_column TYPE REF TO cl_salv_column.
  DATA : lv_text   TYPE scrtext_l,
         lv_text_m TYPE scrtext_m,
         lv_text_s TYPE scrtext_s.

  TRY.
      lr_column ?= ir_columns->get_column( 'OTYPE' ).
      MOVE  'Object Type'(CTY) to: lv_text, lv_text_m, lv_text_s.
      lr_column->set_long_text( lv_text ).
      lr_column->set_medium_text( lv_text_m ).
      lr_column->set_short_text( lv_text_s ).
      CLEAR : lv_text, lv_text_m, lv_text_s.

      lr_column ?= ir_columns->get_column( 'NAME' ).
      MOVE  'Object Name'(CNM) to:  lv_text, lv_text_m, lv_text_s.
      lr_column->set_long_text( lv_text ).
      lr_column->set_medium_text( lv_text_m ).
      lr_column->set_short_text( lv_text_s ).
      CLEAR : lv_text, lv_text_m, lv_text_s.

      lr_column ?= ir_columns->get_column( 'ACT_BREAKPOINT' ).
      MOVE  'Breakpoint'(051) TO : lv_text, lv_text_m, lv_text_s.
      lr_column->set_long_text( lv_text ).
      lr_column->set_medium_text( lv_text_m ).
      lr_column->set_short_text( lv_text_s ).
      CLEAR : lv_text, lv_text_m, lv_text_s.

      lr_column ?= ir_columns->get_column( 'ACT_LOGPOINT' ).
      MOVE  'Logpoint'(lpt) TO : lv_text, lv_text_m, lv_text_s.
      lr_column->set_long_text( lv_text ).
      lr_column->set_medium_text( lv_text_m ).
      lr_column->set_short_text( lv_text_s ).
      CLEAR : lv_text, lv_text_m, lv_text_s.

      lr_column ?= ir_columns->get_column( 'ACT_ASSERT' ).
      MOVE  'Assert'(ass) TO : lv_text, lv_text_m, lv_text_s.
      lr_column->set_long_text( lv_text ).
      lr_column->set_medium_text( lv_text_m ).
      lr_column->set_short_text( lv_text_s ).
      CLEAR : lv_text, lv_text_m, lv_text_s.

      lr_column ?= ir_columns->get_column( 'ORDER_BY' ).
      lr_column->set_technical( if_salv_c_bool_sap=>true ).

    CATCH cx_salv_not_found.                            "#EC NO_HANDLER
    CATCH cx_sy_dyn_call_illegal_type.                  "#EC NO_HANDLER
  ENDTRY.

endform.