Tuesday, September 8, 2015

SLG1 Logging setup


First, we need to crete Object 'ZCMS' and then below code need to be put for Logging


REPORT  ZRKTEST11.
DATA: lc_log TYPE REF TO CL_EZLOG.

CREATE OBJECT LC_LOG
  EXPORTING
    MSGOBJECT = 'ZCMS'
    APPENDMODE = '1'
    INTERNAL = 'X'.

  CALL METHOD LC_LOG->ADDMSG
    EXPORTING
      MSGTY    = 'S'
      MSGID    = 'ZC'
      MSGNO    = '002'
      MSGV1    = 'Test by Rajesh'
      MSGV2    = '2nd var'
      MSGV3    = '3rd'      .

  CALL METHOD LC_LOG->SAVE
    EXCEPTIONS
      EMPTY       = 1
      FAILED      = 2
      others      = 3.
  IF SY-SUBRC <> 0.
  ENDIF.
  FREE lc_log.

No comments:

Post a Comment