<?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: CATCH SYSTEM-EXCEPTIONS file_access_errors in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040210#M86249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might be able to use the system exception....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Catch system-exception DATASET_CANT_OPEN = 1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2005 18:14:06 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-11-15T18:14:06Z</dc:date>
    <item>
      <title>CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040207#M86246</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;I use this Exception for checking a file-open like this:&lt;/P&gt;&lt;P&gt;CATCH SYSTEM-EXCEPTIONS file_access_errors = 8.&lt;/P&gt;&lt;P&gt;      OPEN DATASET par_file FOR INPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;ENDCATCH.&lt;/P&gt;&lt;P&gt;if sy-subrc = 8 ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it doesn't work.&lt;/P&gt;&lt;P&gt;System: 4.6c.&lt;/P&gt;&lt;P&gt;I have heard, that these kind of exceptions won't work &lt;/P&gt;&lt;P&gt;in my release.&lt;/P&gt;&lt;P&gt;Is this true?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 17:56:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040207#M86246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T17:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040208#M86247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is not a system exception.  There is a list of [system exceptions, this is as of 46c|http://wiki.sdn.sap.com/wiki/x/Y4BMCg].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your cases, you would just check sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
OPEN DATASET par_file FOR INPUT IN TEXT MODE.
if sy-subrc = 8 ....
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:09:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040208#M86247</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040209#M86248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you do an F1 on 'CATCH', you'll what exceptions can be caught. I didn't see this in either our 4.6C or 4.7 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:11:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040209#M86248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T18:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040210#M86249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might be able to use the system exception....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Catch system-exception DATASET_CANT_OPEN = 1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:14:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040210#M86249</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040211#M86250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your answer.&lt;/P&gt;&lt;P&gt;I have tried allready DATASET_CANT_OPEN and&lt;/P&gt;&lt;P&gt;DATASET_READ_ERROR and so on ...&lt;/P&gt;&lt;P&gt;But nothing works as it should.&lt;/P&gt;&lt;P&gt;Sy-subrc is allways 0!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the point is!&lt;/P&gt;&lt;P&gt;If I try DATASET_CANT_OPEN I will get SY-subrc = 0.&lt;/P&gt;&lt;P&gt;So I am starting DO. ...READ... ENDDO&lt;/P&gt;&lt;P&gt;And when I try there to catch DATASET_READ_ERROR &lt;/P&gt;&lt;P&gt;during the loop a dump occurs! Of course SY_SUBRC == 0,&lt;/P&gt;&lt;P&gt;but in fact it isn't.&lt;/P&gt;&lt;P&gt;If I don't use CATCH/ENDCATCH sy-subrc = 8. Which is ok!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it is a release problem? (4.6c)&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:30:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040211#M86250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T18:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040212#M86251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I always just check sy-subrc when opening a file.  It always works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: begin of ifile occurs 0,
      rec(150),
      end of ifile.

parameters: path(99) type c lower case default '/QDLS/ALH/PACKS.DAT'.

open dataset path for input in text mode.
if sy-subrc &amp;lt;&amp;gt; 0.
  write:/ 'File can not be opened'.
endif.

do.
  read dataset path into ifile-rec.
  if sy-subrc eq 0.
    append ifile.
  else.
    exit.
  endif.
enddo.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:37:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040212#M86251</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040213#M86252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was the first, what I hve done.&lt;/P&gt;&lt;P&gt;Otherwise I would'nt bother You &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I used all possible Exceptions include &lt;/P&gt;&lt;P&gt;File_access_errors (this was my last try)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using CATCH/ENDCATCH very often. And it works all the time; except the File-Accessing-Eceptions &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michaeö&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:37:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040213#M86252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T18:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040214#M86253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Of course, as soon as i posted last, my program does work and i am now getting the system exception.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:39:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040214#M86253</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040215#M86254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, I own You some points &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, I agree to you, I will do it in the old fashioned way. &lt;/P&gt;&lt;P&gt;If sy-subrc ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it would be very interesting to know, why it doesn't work &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:40:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040215#M86254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T18:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040216#M86255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, here is the modified code.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: begin of ifile occurs 0,
      rec(150),
      end of ifile.

parameters: path(99) type c lower case
           default '/usr/sap/TST/SYS/Data1.txt'.

open dataset path for input in text mode.
if sy-subrc ne 0.
  write:/ 'File can not be opened'.

else.

  do.
    read dataset path into ifile-rec.
    if sy-subrc eq 0.
      append ifile.
    else.
      exit.
    endif.
  enddo.


endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040216#M86255</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040217#M86256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is now also working for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: begin of ifile occurs 0,
      rec(150),
      end of ifile.

parameters: path(99) type c lower case
           default '/usr/sap/TST/SYS/Data1.txt'.

open dataset path for input in text mode.
&amp;lt;b&amp;gt;
catch system-exceptions dataset_cant_open = 1.&amp;lt;/b&amp;gt;
  do.
    read dataset path into ifile-rec.
    if sy-subrc eq 0.
      append ifile.
    else.
      exit.
    endif.
  enddo.
&amp;lt;b&amp;gt;endcatch.&amp;lt;/b&amp;gt;

&amp;lt;b&amp;gt;if sy-subrc = 1.
write:/ 'File could not be opened'.
endif&amp;lt;/b&amp;gt;.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Put the CATCH around the do loop when reading the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please make sure to award points for helpful answers and mark you posts as solved when answered completely.  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:43:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040217#M86256</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040218#M86257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:50:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040218#M86257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-15T18:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: CATCH SYSTEM-EXCEPTIONS file_access_errors</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040219#M86258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem,  Again, I never did it this way before, but definitly will in the future.  Thanks for teaching me something new.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2005 18:51:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/catch-system-exceptions-file-access-errors/m-p/1040219#M86258</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-15T18:51:50Z</dc:date>
    </item>
  </channel>
</rss>

