Page tree
Skip to end of metadata
Go to start of metadata

In this example, the data is retrieved from the metric store for the key figure "Total Number of Messages" for the application log monitor.

Grouping is done using the following fields:

  • Alert Text
  • Rating
  • Parameter Set ID
  • System ID
  • Monitoring Object ID
  • Timestamp

filtering is done by timestamp

*&---------------------------------------------------------------------*
*& Report Z_DEMO_CCMS
*&
*&---------------------------------------------------------------------*
*& Collect data from CCMS MTE node
*&
*&---------------------------------------------------------------------*

report  z_demo_ccms.

start-of-selection.

  data lx_ags_bpm     type ref to cx_ags_bpm.
  data lo_catalog     type ref to if_ags_bpm_rep_cat.
  data lo_kf          type ref to if_ags_bpm_rep_key_figure.
  data lt_sfc         type if_ags_bpm_rep_key_figure=>tt_sfc.
  data ls_sfc         like line of lt_sfc.
  data lt_sfk         type if_ags_bpm_rep_key_figure=>tt_sfk.
  data ls_sfk         like line of lt_sfk.
  data lt_range       type if_ags_bpm_rep_key_figure=>tt_range.
  data ls_range       like line of lt_range.
  data lr_data        type ref to data.

  field-symbols <t_data> type standard table.

  try.

      data lv_kf_id type if_ags_bpm_key_fig=>ty_long_id.

      lv_kf_id = 'MS/OTHER/other'.

      " Get the key figure catalog
      lo_catalog = cl_ags_bpm_rep_service=>get_key_figure_catalog( ).

      "Get the key figure by the unique key figure ID: MTE
      lo_kf = lo_catalog->get_key_figure(
          iv_key_figure_id =     lv_kf_id
      ).

      if lo_kf is bound.

        " Let us choose the dimension for reporting

        " Alert Text
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_alerttext.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

        "Rating
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_rating.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

        "Parameter Set ID
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_p_set_id.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

        "System ID
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_sid.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

        "Monitoring Object ID
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_mon_obj_id.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

        "Timestamp
        ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_tihms.
        append ls_sfc to lt_sfc.
        clear ls_sfc.

* "Measured Value (in this case the MAX value)
* ls_sfk-kyfnm = cl_ags_bpm_rep_kfg_abs=>c_in_measures-c0sm_max.
* append ls_sfk to lt_sfk.
* clear ls_sfk.


        " Let us specify the date range condition as a filter
        ls_range-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_tihms.
        ls_range-sign = 'I'.
        ls_range-compop = 'GE'.
        ls_range-low = '20170119100000'.
        append ls_range to lt_range.
        clear ls_range.

        " Get the data
        lo_kf->get_data(
          exporting
            it_sfc        = lt_sfc
            it_sfk        = lt_sfk
            it_range      = lt_range
          importing
* et_data_descr =
            et_data       = lr_data
        ).

        " Consume the data in your application: In this case the ALV output
        if lr_data is not initial.
          assign lr_data->* to <t_data>.

          data lt_fieldcatalog type slis_t_fieldcat_alv.
          data ls_fieldcatalog type slis_fieldcat_alv.
          data ls_dim          type if_ags_bpm_rep_dim=>ts_dim.
          data lt_dim          type if_ags_bpm_rep_dim=>tt_dim.

          " Get characteristics of the Key Figure ( X axis )
          lt_dim = lo_kf->get_characteristics( ).
          loop at lt_sfc into ls_sfc.
            ls_fieldcatalog-fieldname = ls_sfc-chanm.
            append ls_fieldcatalog to lt_fieldcatalog.
            clear ls_fieldcatalog.
          endloop.
          refresh lt_dim.

          " Get key figure measure technical name ( Y axis )
          lt_dim = lo_kf->get_measures( ).
          loop at lt_dim into ls_dim.
            ls_fieldcatalog-fieldname = ls_dim-name.
            append ls_fieldcatalog to lt_fieldcatalog.
            clear ls_fieldcatalog.
          endloop.

          call function 'REUSE_ALV_GRID_DISPLAY'
            exporting
              it_fieldcat   = lt_fieldcatalog
            tables
              t_outtab      = <t_data>
            exceptions
              program_error = 1
              others        = 2.

        endif.

      endif.

    catch cx_ags_bpm into lx_ags_bpm.
      " Implement the error handling here
  endtry.
  • No labels