title: Catch errors of SUBMIT statement
body: <p>I have a number of ABAP programs which are called dynamically using <code>submit</code>. To make sure it'll run, I do a syntax check first.</p>
  
  <pre><code>syntax-check for program programName message error line location word word.
  if ( sy-subrc = 0 ).
    submit (programName) exporting list to memory and return.
  endif.
  </code></pre>
  
  <p>The issue I have though is due to a logical error. One of the programs ends up trying to divide a number by zero. I don't know why or if I can fix that error, but what I'd like to do is gracefully be able to tell my application an error has happend instead of bringing the entire application to a halt. </p>
  
  <p>For arguments sake, let's say the program is:</p>
  
  <pre><code>report.
  data(holeInEarth) = 1 / 0.
  </code></pre>
  
  <p>I've tried using a try catch block but if an error occurs nothing happens.</p>
  
  <pre><code>try.
      submit (programName) exporting list to memory and return.
  catch cx_root into (err).
      ...do something with err...
  endtry.
  </code></pre>
  
  <p>I also tried using <code>catch system-exceptions</code>.</p>
  
  <pre><code>catch system-exceptions others = 1.
      submit (programName) exporting list to memory and return.
  endcatch.
  </code></pre>
  
  <p>Running the report in the background isn't an option because I need the result. Is there a way to catch errors from this statement?</p>