<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing custom program errors to SLOG in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043480#M87186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Indrade,&lt;/P&gt;&lt;P&gt;Is it your first post in SDN ? Welcome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for your problem try the following procedure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Refresh memory&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH'
    EXPORTING
*   I_AUTHORIZATION                =
      i_refresh_all                  = 'X'
*   I_T_LOGS_TO_BE_REFRESHED       =
    EXCEPTIONS
      not_authorized                 = 1
      OTHERS                         = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Create a Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* define some header data of this log
  l_s_log-extnumber    = pu_ext_number.
  l_s_log-aluser       = sy-uname.
  l_s_log-alprog       = sy-repid.
  l_s_log-object       = pu_object.
  l_s_log-subobject    = pu_subobject.

* create a log
  CALL FUNCTION 'BAL_LOG_CREATE'
       EXPORTING
            i_s_log                 = l_s_log
       IMPORTING
            e_log_handle            = pc_log_handle
       EXCEPTIONS
            log_header_inconsistent = 1
            OTHERS                  = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Add a message to the Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA:
    l_s_msg      TYPE bal_s_msg,
    l_log_handle TYPE balloghndl.

* define data of message for Application Log
  l_s_msg-msgty         = pu_msgty.
  l_s_msg-msgid         = pu_msgid.
  l_s_msg-msgno         = pu_msgno.
  l_s_msg-msgv1         = pu_msgv1.
  l_s_msg-msgv2         = pu_msgv2.
  l_s_msg-msgv3         = pu_msgv3.
  l_s_msg-msgv4         = pu_msgv4.
  l_s_msg-probclass     = pu_probclass.
  l_s_msg-context-value = pu_context.
  GET TIME STAMP FIELD l_s_msg-time_stmp.
* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =&amp;gt;EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
            i_log_handle  = l_log_handle
            i_s_msg       = l_s_msg
       EXCEPTIONS
            log_not_found = 0
            OTHERS        = 1.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Save Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'BAL_DB_SAVE'
       EXPORTING
            i_t_log_handle   = p_t_log_handle
       EXCEPTIONS
            log_not_found    = 1
            save_not_allowed = 2
            numbering_error  = 3
            OTHERS           = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please remember to reward points if the answer is useful, and to close the post when your problem is solved&lt;/P&gt;&lt;P&gt;Regards, Manuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Dec 2005 10:35:28 GMT</pubDate>
    <dc:creator>manuel_bassani</dc:creator>
    <dc:date>2005-12-14T10:35:28Z</dc:date>
    <item>
      <title>Writing custom program errors to SLOG</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043479#M87185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for a way to put errors from custom program ( which would run as job) to system log, which should be visible via SM21. Can any of you help me with a function module with which I can achieve it ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 10:26:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043479#M87185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T10:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Writing custom program errors to SLOG</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043480#M87186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Indrade,&lt;/P&gt;&lt;P&gt;Is it your first post in SDN ? Welcome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for your problem try the following procedure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Refresh memory&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH'
    EXPORTING
*   I_AUTHORIZATION                =
      i_refresh_all                  = 'X'
*   I_T_LOGS_TO_BE_REFRESHED       =
    EXCEPTIONS
      not_authorized                 = 1
      OTHERS                         = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Create a Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* define some header data of this log
  l_s_log-extnumber    = pu_ext_number.
  l_s_log-aluser       = sy-uname.
  l_s_log-alprog       = sy-repid.
  l_s_log-object       = pu_object.
  l_s_log-subobject    = pu_subobject.

* create a log
  CALL FUNCTION 'BAL_LOG_CREATE'
       EXPORTING
            i_s_log                 = l_s_log
       IMPORTING
            e_log_handle            = pc_log_handle
       EXCEPTIONS
            log_header_inconsistent = 1
            OTHERS                  = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Add a message to the Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA:
    l_s_msg      TYPE bal_s_msg,
    l_log_handle TYPE balloghndl.

* define data of message for Application Log
  l_s_msg-msgty         = pu_msgty.
  l_s_msg-msgid         = pu_msgid.
  l_s_msg-msgno         = pu_msgno.
  l_s_msg-msgv1         = pu_msgv1.
  l_s_msg-msgv2         = pu_msgv2.
  l_s_msg-msgv3         = pu_msgv3.
  l_s_msg-msgv4         = pu_msgv4.
  l_s_msg-probclass     = pu_probclass.
  l_s_msg-context-value = pu_context.
  GET TIME STAMP FIELD l_s_msg-time_stmp.
* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =&amp;gt;EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
            i_log_handle  = l_log_handle
            i_s_msg       = l_s_msg
       EXCEPTIONS
            log_not_found = 0
            OTHERS        = 1.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Save Log&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL FUNCTION 'BAL_DB_SAVE'
       EXPORTING
            i_t_log_handle   = p_t_log_handle
       EXCEPTIONS
            log_not_found    = 1
            save_not_allowed = 2
            numbering_error  = 3
            OTHERS           = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please remember to reward points if the answer is useful, and to close the post when your problem is solved&lt;/P&gt;&lt;P&gt;Regards, Manuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 10:35:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043480#M87186</guid>
      <dc:creator>manuel_bassani</dc:creator>
      <dc:date>2005-12-14T10:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Writing custom program errors to SLOG</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043481#M87187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;using this FM RSLG_READ_FILE you can read the log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 10:40:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043481#M87187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T10:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Writing custom program errors to SLOG</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043482#M87188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have found the function module RSLG_WRITE_SYSLOG_ENTRY with which we can write SYSLOG entries. Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2005 09:31:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/writing-custom-program-errors-to-slog/m-p/1043482#M87188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-20T09:31:58Z</dc:date>
    </item>
  </channel>
</rss>

