Friday, April 1, 2016

SLG1 Application logging


First go to SLG0 tcode, and setup Object 'ZCMS'

then put below code in your program

Check if CL_EZLOG exists in system - If not, use other way of setting up logs in http://sapist.blogspot.co.uk/2016/04/slg1-logging-program.html


DATA: lc_log TYPE REF TO CL_EZLOG.
  
* Start of CMS Logging
  CREATE OBJECT LC_LOG
    EXPORTING
      MSGOBJECT  = 'ZCMS'
      APPENDMODE = '1'
      INTERNAL   = 'X'.



    CALL METHOD LC_LOG->ADDMSG
      EXPORTING
        MSGTY = sy-msgty
        MSGID = sy-msgid
        MSGNO = sy-msgno
        MSGV1 = sy-msgv1
        MSGV2 = sy-msgv2
        MSGV3 = sy-msgv3.




  CALL METHOD LC_LOG->SAVE
    EXCEPTIONS
      EMPTY  = 1
      FAILED = 2
      others = 3.

  FREE lc_log.


Now, you can see in SLG1 - messages if any

No comments:

Post a Comment