In this example, the data is retrieved for the key figure "Last Rating" for all monitoring objects. Grouping is done by:
- Context Type
- Monitoring Object ID
additional filtering is done for the field "Timestamp":
*&---------------------------------------------------------------------* *& Report ZABR_API *& Test Report for Unified Reporting API *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* report zabr_api. 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. " 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: In this case it is the Current(Last Rating) from the data store. lo_kf = lo_catalog->get_key_figure( iv_key_figure_id = |EVENTS/LAST_RATING| ). if lo_kf is bound. " Let us choose the dimension for reporting 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. " Let us choose the dimension for reporting ls_sfc-chanm = cl_ags_bpm_rep_kfg_abs=>c_in_chars-c0sm_context_type. append ls_sfc to lt_sfc. clear ls_sfc. " 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-compop = 'BT'. ls_range-sign = 'I'. ls_range-low = '20151007000000'. ls_range-high = '20151007235959'. append ls_range to lt_range. clear ls_range. " Get the data lo_kf->get_data( exporting it_sfc = lt_sfc * it_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 error handling here endtry.