Hi folks,
i know there is a standard function to read the syslog, but i was messing around to read it the quick and dirty way.
So i made a little report who reads it.
Assumptions:
1) you know the file where it resides.
2) the structure is the "new" syslog structure of 320 bytes. The old one was 180. It obviously makes a difference.
Here the little hack for you:
REPORT zlogsm21.
PARAMETERS pfile TYPE rlgrap-filename DEFAULT '/usr/sap/SID/DVEBMGS00/log/SLOG00'.
START-OF-SELECTION.
DATA l_str(250) TYPE c.
DATA l_line TYPE rslgentr_new.
DATA lt_log TYPE STANDARD TABLE OF RSLGENTR_NEW.
DATA len TYPE i VALUE 320.
OPEN DATASET pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET pfile INTO l_str ACTUAL LENGTH len MAXIMUM LENGTH len.
IF sy-subrc = 0.
l_line = l_str.
APPEND l_line TO lt_log.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET pfile.
CALL FUNCTION 'HR_IT_SHOW_ANY_TABLE_ON_ALV'
TABLES
table = lt_log
EXCEPTIONS
FB_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Hope you enjoyed it.