Skip to content

Commit

Permalink
first draft of SM21 reader
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesKonings committed Oct 30, 2020
1 parent 89f484d commit 5c055f2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/zcl_ale_log_reader_sm21.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,51 @@ ENDCLASS.
CLASS zcl_ale_log_reader_sm21 IMPLEMENTATION.
METHOD zif_ale_log_reader~read.

DATA syslog_filter TYPE REF TO cl_syslog_filter.
DATA datetime_from TYPE rslgtime.
DATA datetime_to TYPE rslgtime.
DATA syslogs_total TYPE rslgentr_new_tab.

datetime_from = sy-datum + '000000'.
datetime_to = sy-datum + '235959'.

syslog_filter = NEW #( ).

syslog_filter->set_filter_datetime(
EXPORTING
im_datetime_from = datetime_from " UTC Time Stamp in Short Form (YYYYMMDDhhmmss)
im_datetime_to = datetime_to " UTC Time Stamp in Short Form (YYYYMMDDhhmmss)
).

DATA(syslog_client) = NEW cl_syslog_sapcontrol_client( ).

TRY.
DATA(servers) = syslog_client->get_server_names( ).
CATCH cx_server_list. " Exception in creating a server list.
ASSERT 1 = 2.
ENDTRY.

LOOP AT servers ASSIGNING FIELD-SYMBOL(<server>).
TRY.
DATA(syslogs_server) = syslog_client->read_syslog( iv_hostname = <server>-name ).
syslogs_total = VALUE #( BASE syslogs_total ( LINES OF syslogs_server ) ).
CATCH cx_ai_system_fault. " Application Integration: Technical Error
ASSERT 1 = 2.
ENDTRY.
ENDLOOP.


LOOP AT syslogs_total ASSIGNING FIELD-SYMBOL(<syslog>).

logs = VALUE #( BASE logs ( level = '1'
header_text = <syslog>-slgtype
item_text = <syslog>-slgdata ) ).

ENDLOOP.




ENDMETHOD.

ENDCLASS.

0 comments on commit 5c055f2

Please sign in to comment.