Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Figure 14
Figure 15
Figure 16
Figure 17
Next, the rest operation should be set to GET.
Figure 18
Finally, enter the PO username and password for basic authentication.
Figure 19
Figure 20
Figure 21
Figure 22
class lcl_pimoni definition final.
public section.
constants: gc_error type char1 value 'E',
gc_success type char1 value 'S',
gc_ricef_id type zvariable_name value 'PI_MONI_INTERFACE',
gc_maxcount type int4 value 999999999,
gc_filteridoc type string value 'Processing IDoc document with number' ##NO_TEXT,
gc_filterfile type string value 'FILE_SUC_029' ##NO_TEXT,
gc_proxy type srt_lp_proxyclass value 'ZCO_ADAPTER_MESSAGE_MONITORING'.
methods:
constructor importing iv_fdate type sydats
iv_tdate type sydats.
private section.
types: begin of ty_log,
sender_interface type zmessage_interface,
message_key type string,
message_id type string,
sender_name type string,
receiver_name type string,
end of ty_log.
methods:
prepare_data importing iv_fdate type sydats
iv_tdate type sydats
returning value(re_data) type zget_message_list_in_doc,
get_message_count importing iv_fdate type sydats
iv_tdate type sydats
returning value(re_logcount) type zmt_moni_message_count_res,
get_date importing iv_date type sydats
returning value(re_date) type xsddatetime_z,
determine_idoc_file importing it_log type zaudit_log_entry_data_tab
iv_messageid type string
returning value(re_msgid) type string,
conver_time_stamp importing iv_timestamp type xsddatetime_z
returning value(re_time) type syst_uzeit.
endclass.
class lcl_pimoni implementation.
method constructor.
data: is_out type zmt_monitor_log_out,
lt_maindata type table of ty_log,
lt_outputdata type zdt_monitor_log_out_detail_tab.
"Get Sender Interface names from Parameter table
zcl_nka_util=>get_ricef_variables( exporting iv_ricef = gc_ricef_id
importing et_db_vars = data(lt_interface) ).
try.
"Retrive logical port name to get list of messages
data(proxy) = cl_srt_wsp_ws_admin_manager=>get_mapping_targetlp_valuehelp( i_target_proxy = gc_proxy
i_mapping_name = gc_proxy ).
"Instantiate new object to get list of messages
data(lo_monilog) = new zco_adapter_message_monitoring( logical_port_name = value #( proxy[ 1 ]-lp_name optional ) ).
"Retrieve all Error message details from PI, between from date and to date
lo_monilog->get_message_list( exporting input = prepare_data( iv_fdate = iv_fdate
iv_tdate = iv_tdate )
importing output = data(lt_data) ).
"Get only required elements for message processing
lt_maindata = corresponding #( lt_data-response-list-adapter_framework_data ).
if lt_maindata is initial.
message text-003 type gc_success.
return.
endif.
"Get log count details from PI, between from date and to date
loop at get_message_count( iv_fdate = iv_fdate
iv_tdate = iv_tdate )-mt_moni_message_count_res-row_data assigning field-symbol(<lfs_logcount>).
loop at lt_maindata assigning field-symbol(<lfs_data>) where sender_interface-name = <lfs_logcount>-interface
and receiver_name = <lfs_logcount>-receiver_component
and sender_name = <lfs_logcount>-sender_component.
"Get details message for each message
lo_monilog->get_log_entries( exporting input = value zget_log_entries_in_doc( message_key = <lfs_data>-message_key
archive = space
older_than = get_date( iv_tdate ) )
importing output = data(lt_log) ).
"$. Region Filter only error messages and remove duplicate messages
sort lt_log-response-audit_log_entry_data ascending by text_key.
delete adjacent duplicates from lt_log-response-audit_log_entry_data comparing text_key.
"$. Endregion Filter only error messages and remove duplicate messages
"Add details error message to internal table, to be passed as a deep structure
append value zdt_monitor_log_out_detail_mes( msg_key = <lfs_data>-message_id
uid = determine_idoc_file( it_log = lt_log-response-audit_log_entry_data
iv_messageid = <lfs_data>-message_id )
sub_message = value zdt_monitor_log_out_sub_me_tab( for ls_output in lt_log-response-audit_log_entry_data
where ( status = gc_error )
( textkey = ls_output-text_key
msg_type = ls_output-status
msg_text = ls_output-localized_text
date = iv_fdate
time = conver_time_stamp( ls_output-time_stamp ) ) ) ) to lt_outputdata.
endloop.
"Add final data to outbound structure
append value zdt_monitor_log_out_monitorlog( interface_id = value #( lt_interface[ val1 = conv zselection_val1( <lfs_logcount>-interface ) ]-val2 optional )
sender = <lfs_logcount>-sender_component
receiver = <lfs_logcount>-receiver_component
si_name = <lfs_logcount>-interface
error = <lfs_logcount>-error
success = <lfs_logcount>-successfull
schedule = <lfs_logcount>-scheduled
detail_message = lt_outputdata ) to is_out-mt_monitor_log_out-monitorlog.
refresh: lt_outputdata.
endloop.
catch cx_ai_system_fault into data(lv_exc).
message lv_exc->get_text( ) type gc_success.
endtry.
endmethod.
method determine_idoc_file.
"Retrieve IDOC number
loop at it_log assigning field-symbol(<lfs_log>) where text_key cs gc_filteridoc.
re_msgid = <lfs_log>-text_key+37(16).
return.
endloop.
"Retrive File name in file scenario
loop at it_log assigning <lfs_log> where text_key cs gc_filterfile.
re_msgid = <lfs_log>-localized_text+18(40).
return.
endloop.
"If IDOC number or File Name not available, return PI message ID
if re_msgid is initial.
re_msgid = iv_messageid.
endif.
endmethod.
method prepare_data.
"Preperation of input parameters to get message list
re_data = value zget_message_list_in_doc( filter-archive = abap_false
filter-date_type = 4
filter-node_id1 = 0
filter-only_faulty_messages = abap_false
filter-retries = 0
filter-retry_interval = 0
filter-times_failed = 0
filter-was_edited = abap_false
max_messages = gc_maxcount
filter-from_time = get_date( iv_fdate )
filter-to_time = get_date( iv_tdate ) ).
endmethod.
method get_date.
call function 'CACS_DATE_GET_TIMESTAMP'
exporting
i_date = iv_date
importing
e_timestamp = re_date
exceptions
date_not_filled_but_time = 1
date_has_no_valid_format = 2
others = 3.
if sy-subrc <> 0 ##NEEDED.
"This is unlikely to occur.
endif.
endmethod.
method get_message_count.
try .
data(lo_rest) = new zco_si_moni_message_count_out( ).
"Get Error, Success and Schedule message count from PI server
lo_rest->si_moni_message_count_out( exporting output = value zmt_moni_message_count_out( mt_moni_message_count_out-start_time_stamp = iv_fdate
mt_moni_message_count_out-end_time_stamp = iv_tdate )
importing input = re_logcount ).
catch cx_ai_system_fault into data(lv_error).
message lv_error->get_text( ) type gc_success.
endtry.
endmethod.
method conver_time_stamp.
convert time stamp iv_timestamp time zone sy-zonlo
into time re_time.
endmethod.
endclass.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
11 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
3 |