Hi Folks,
once the log is read, like i did in my previous post, then it is easy to write it back to where it belongs.
Here is some really trivial coding, that runs on ECC 6 EHP6.
Again the syslog record size must be 320 and not 180.
The date time is a string in the format "AAAAMMDDHHMMSS00" ( ends with zero zero )
So 2014091523593000 means 2014/09/15 23:59:30
You trust me that it works just fine don't you?
Cheers!
REPORT zzsyslog2.
DATA l_line TYPE rslgentr_new.
PARAMETERS pfilein TYPE rlgrap-filename DEFAULT '/usr/sap/SID/DVEBMGS00/log/SLOG00'.
PARAMETERS pfileout TYPE rlgrap-filename DEFAULT '/tmp/SLOG00OUT'.
PARAMETERS pUNAME TYPE SY-UNAME DEFAULT SY-UNAME.
select-options PDATTIM FOR L_LINE-SLGDATTIM.
START-OF-SELECTION.
DATA l_str(512) TYPE c.
DATA lt_log TYPE STANDARD TABLE OF rslgentr_new.
DATA len TYPE i VALUE 320.
DATA l_log TYPE string.
OPEN DATASET pfilein FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET pfilein 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 pfilein.
DELETE lt_log WHERE slguser = puname
and SLGDATTIM IN PDATTIM.
len = 320.
OPEN DATASET pfileout FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT lt_log INTO l_line.
TRANSFER l_line TO pfileout LENGTH len NO END OF LINE .
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDLOOP.
CLOSE DATASET pfileout.