<?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 How to CORRECTLY process errors , catch exceptions, generate messages. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925854#M1484962</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;As my programs miss this functionality (error processing , catch exceptions , generate messages) I would like to learn how to correctly use these things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody give me few examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. what kind of messages should be generated if execution of FM has failed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b. raise and process exceptions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c. how to pick up the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 May 2010 10:23:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-05T10:23:28Z</dc:date>
    <item>
      <title>How to CORRECTLY process errors , catch exceptions, generate messages.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925854#M1484962</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;As my programs miss this functionality (error processing , catch exceptions , generate messages) I would like to learn how to correctly use these things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody give me few examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. what kind of messages should be generated if execution of FM has failed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b. raise and process exceptions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c. how to pick up the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 10:23:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925854#M1484962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-05T10:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to CORRECTLY process errors , catch exceptions, generate messages.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925855#M1484963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;a. what kind of messages should be generated if execution of FM has failed&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error messages/ Exceptions are generated if a FM has failed. For ex: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = l_flname
      filetype                = 'ASC'
      write_field_separator   = '#'
    TABLES
      data_tab                = it_excel_dwnld
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above FM you can see the 22 exceptions which can arise while downloading a file is being failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;b. raise and process exceptions&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF sy-subrc &amp;lt;&amp;gt; 0.
    FORMAT COLOR COL_NEGATIVE.
    CASE sy-subrc.
      WHEN 1.
        v_msg = file_write_error.
ENDCASE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Displays messages on screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;how to pick up the error&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can double click on the error and diagonise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 10:33:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925855#M1484963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-05T10:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to CORRECTLY process errors , catch exceptions, generate messages.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925856#M1484964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is a REPORT program, and you want to generate ERROR messages,&lt;/P&gt;&lt;P&gt;collect all the Error message text in an Internal Table like below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      wa_bdcmsgtab-pernr    = p_summary-pernr.
      "Employee Name
      wa_bdcmsgtab-empname  = p_summary-empname.
      "Employee Personnel Subarea
      wa_bdcmsgtab-psub     = p_summary-psub.
      "Get message text
      wa_bdcmsgtab-msg      = 'No data for BDC upload'(r29).
      "Build BDC Message table
      APPEND wa_bdcmsgtab TO it_bdcmsgtab.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then display the Internal table as an ALV pop-up or as an REPORT Output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A single message can be displayed using MESSAGE statement like below:&lt;/P&gt;&lt;P&gt;    lets say you hv to handle FM error messages:&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;then use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  case sy-subrc.
  when '0'.
    MESSAGE i003 WITH 'Error in displaying top-of-page'(i01).
  when '1'.
       MESSAGE i003 WITH 'Error in displaying header''(i01).
  endcase.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ags.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ags on May 5, 2010 4:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 10:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925856#M1484964</guid>
      <dc:creator>agnihotro_sinha2</dc:creator>
      <dc:date>2010-05-05T10:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to CORRECTLY process errors , catch exceptions, generate messages.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925857#M1484965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suggest search in articles, etc., for "class-based exception handling".  It's discussed in newer ABAP manuals, such as &lt;U&gt;ABAP Objects&lt;/U&gt; and &lt;U&gt;Official ABAP Programming Guidelines&lt;/U&gt; as well as others.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 11:30:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925857#M1484965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-05T11:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to CORRECTLY process errors , catch exceptions, generate messages.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925858#M1484966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for CLASS based Exception handling:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data OREF type ref to CX_ROOT. "For exception handling
TRY .
            modify zht_dbtab FROM TABLE it_dbtab.
          CATCH cx_sy_open_sql_db INTO oref.
            IF sy-subrc NE 0.
              ROLLBACK WORK.
            ENDIF.
        ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use IF_MESSAGE~GET_TEXT method of Oref to get text of the ERROR message&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ags.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 11:38:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-correctly-process-errors-catch-exceptions-generate-messages/m-p/6925858#M1484966</guid>
      <dc:creator>agnihotro_sinha2</dc:creator>
      <dc:date>2010-05-05T11:38:53Z</dc:date>
    </item>
  </channel>
</rss>

