<?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: Application Logging in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740333#M1458515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This trick could easily work if it is a custom transaction/program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to log msgs from the user exists (implemented by us) of the standard transactions where the commit is controlled by the stanrdard code and it might not be a good approach to do COMMIT in the user exist/Badis of the standard transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know if I am missing sme thread here and may be there is some alternate trick by which it works in a cleaner way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your time,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Mar 2010 06:57:41 GMT</pubDate>
    <dc:creator>sushil_taneja</dc:creator>
    <dc:date>2010-03-09T06:57:41Z</dc:date>
    <item>
      <title>Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740330#M1458512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     we are trying to use application logging feature provided with ABAP by way of function modules BAL_LOG_ADD/SAVE etc. the results of these are visible in trasnaction SLG1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    In our scenario, we want to keep track of different abnormal situations which a background Job of a user with dialogue operation faces. So these situations could be part of a successful or un-successful transactions i.e. there could be and overall COMMIT or ROLLBACK for each transactions for which the log operations have been carried out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Now the problem is that , the Logs are not getting saved for unsuccessful transactions i.e. where there is no COMMIT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     I need your help to get over this situation so that I able to save the Logs (in standard Log objects which are visiible in  SLG1) even if the business transaction is not committed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Mar 2010 12:52:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740330#M1458512</guid>
      <dc:creator>sushil_taneja</dc:creator>
      <dc:date>2010-03-08T12:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740331#M1458513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have a look here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/70bfbaf6-0d01-0010-9581-815adc6d28e2&amp;amp;overridelayout=true" target="test_blank"&gt;http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/70bfbaf6-0d01-0010-9581-815adc6d28e2&amp;amp;overridelayout=true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Mar 2010 15:26:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740331#M1458513</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2010-03-08T15:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740332#M1458514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As the logs are first stored in memory, you may either use ROLLBACK on the main data then write the log to database and COMMIT, or if the transaction is successful do a unique COMMIT after data + log database updates&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Mar 2010 22:08:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740332#M1458514</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2010-03-08T22:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740333#M1458515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This trick could easily work if it is a custom transaction/program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to log msgs from the user exists (implemented by us) of the standard transactions where the commit is controlled by the stanrdard code and it might not be a good approach to do COMMIT in the user exist/Badis of the standard transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know if I am missing sme thread here and may be there is some alternate trick by which it works in a cleaner way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your time,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sushil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 06:57:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740333#M1458515</guid>
      <dc:creator>sushil_taneja</dc:creator>
      <dc:date>2010-03-09T06:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740334#M1458516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's one thing I don't understand, the standard probably works well. So, why don't you look at the way it works? (debug I mean)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you tell us more about the transaction you use, maybe some people already implemented it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 10:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740334#M1458516</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2010-03-09T10:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740335#M1458517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sushil, I have used this a few times. I just cut and paste some of the important parts of the code I used for the logging. I hope this helps you, or at least points you in a good direction. Good Luck!:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: it_log_message    TYPE zzlog_message OCCURS 0.
DATA: wa_log_message TYPE zzlog_message.
DATA: BEGIN OF gt_inv_rawdata_holder OCCURS 0,
         rec(200) TYPE c,
      END OF gt_inv_rawdata_holder.
DATA: gt_inv_rawdata_error LIKE STANDARD TABLE OF z3isp_inv_raw_tb.
*
*
*
*
IF sy-subrc &amp;lt;&amp;gt; 0.
        MOVE-CORRESPONDING z3isp_inv_raw_tb TO wa_inv_rawdata_error.
        MOVE 'E' TO wa_log_message-msgty.
        CONCATENATE wa_inv_rawdata_error-z3ispmatnr
                    wa_inv_rawdata_error-z3isplocn84
                               INTO wa_log_message-msg_text_1
                               SEPARATED BY space.
        CONCATENATE wa_inv_rawdata_error-z3ispstockroomcd
                    wa_inv_rawdata_error-z3ispmvdt
                                INTO wa_log_message-msg_text_2
                                SEPARATED BY space.
        MOVE wa_inv_rawdata_error-z3ispmvtm TO
                                wa_log_message-msg_text_3.
        MOVE 'Duplicate record' TO wa_log_message-msg_text_4.
        APPEND wa_log_message TO it_log_message.
Endif.
*
*
*
*
*send the already collected error messages in it_log_message
*to App Log SLG1 Object Name ZISPINVRAW
  CALL FUNCTION 'ZIU_MESSAGE_LOGGING'
       EXPORTING
            i_log_object            = c_obj_zxiproxy
            i_extnumber             = l_ext_number
       TABLES
            t_log_message           = it_log_message
       EXCEPTIONS
            log_header_inconsistent = 1
            logging_error           = 2
            OTHERS                  = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MOVE 'X' TO flg_applog_issue.
  ENDIF.
  commit work.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 17:59:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740335#M1458517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T17:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740336#M1458518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How come code always looke like this? I cut and pasted it right in my replay. Highlighted it, and selected "code"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oh well, here is the FM I call I tried several times to get it to display properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FUNCTION ziu_message_logging.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_LOG_OBJECT) TYPE  BALOBJ_D
*"     REFERENCE(I_EXTNUMBER) TYPE  STRING
*"  TABLES
*"      T_LOG_MESSAGE STRUCTURE  ZZLOG_MESSAGE
*"  EXCEPTIONS
*"      LOG_HEADER_INCONSISTENT
*"      LOGGING_ERROR
*"----------------------------------------------------------------------

  CONSTANTS: c_message TYPE syst-msgid VALUE 'ZMESSAGE',
             c_999 TYPE syst-msgno VALUE '999'.

  DATA:
  l_log_handle TYPE balloghndl,
  l_s_log TYPE bal_s_log,
  l_dummy TYPE string,
  l_ext_no TYPE bal_s_log-extnumber,
  l_s_mdef TYPE bal_s_mdef.


*  IF t_log_message[] IS NOT INITIAL.
    l_s_log-object = i_log_object.
    l_ext_no = i_extnumber.
    l_s_log-extnumber = l_ext_no.

* Create the log with header data
    CALL FUNCTION 'BAL_LOG_CREATE'
         EXPORTING
              i_s_log                 = l_s_log
         IMPORTING
              e_log_handle            = l_log_handle
         EXCEPTIONS
              log_header_inconsistent = 1
              OTHERS                  = 2.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      CASE sy-subrc.
        WHEN 1.
          RAISE log_header_inconsistent.
        WHEN OTHERS.
          RAISE logging_error.
      ENDCASE.
    ENDIF.
    l_s_mdef-log_handle = l_log_handle.
* Set the default value
    CALL FUNCTION 'BAL_GLB_MSG_DEFAULTS_SET'
         EXPORTING
              i_s_msg_defaults = l_s_mdef
         EXCEPTIONS
              others = 0.
* Loop the message table and write the messages into the log
    LOOP AT t_log_message.
* Use the message type ZMESSAGE and msg no 999
* Issue the message in a dummy variable
      MESSAGE ID c_message TYPE t_log_message-msgty NUMBER c_999
      WITH t_log_message-msg_text_1 t_log_message-msg_text_2
      t_log_message-msg_text_3 t_log_message-msg_text_4
      INTO l_dummy.
* The parameters set by message statement will be used
* Add the message in the log
      PERFORM msg_add.
    ENDLOOP.
* save logs in the database
    CALL FUNCTION 'BAL_DB_SAVE'
         EXPORTING
              i_save_all       = 'X'
         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.
*  ENDIF.
endfunction.
*--------------------------------------------------------------------
* FORM MSG_ADD
*--------------------------------------------------------------------
* Add the message to the log
*-------------------------------------------------------------------*
FORM msg_add.
  DATA:
  l_s_msg TYPE bal_s_msg.
* define data of message for Application Log
  l_s_msg-msgty = sy-msgty.
  l_s_msg-msgid = sy-msgid.
  l_s_msg-msgno = sy-msgno.
  l_s_msg-msgv1 = sy-msgv1.
  l_s_msg-msgv2 = sy-msgv2.
  l_s_msg-msgv3 = sy-msgv3.
  l_s_msg-msgv4 = sy-msgv4.

* 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 =
  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.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Tom Matys on Mar 9, 2010 1:15 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Mar 2010 18:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740336#M1458518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-09T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Application Logging in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740337#M1458519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sushil,&lt;/P&gt;&lt;P&gt;any solution for your topic till now ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Nov 2015 13:23:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/application-logging-in-abap/m-p/6740337#M1458519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-11-05T13:23:42Z</dc:date>
    </item>
  </channel>
</rss>

