‎2007 Feb 02 1:27 PM
Hi,
i'm having the following code which ends in a LOAD_PROGRAM_NOT_FOUND runtime error, even with the TRY-ENDTRY and CATCH-ENDCATCH solution.
On purpose i have tested it with a non-existing reportname, but i expected the program (TRY, CATCH) to handle the error in a smooth way.
TRY.
SUBMIT (l_progname)
AND RETURN
VIA JOB p_jobname NUMBER p_jobcount
TO SAP-SPOOL
SPOOL PARAMETERS p_print_parms
ARCHIVE PARAMETERS p_arc_parms
WITHOUT SPOOL DYNPRO.
PERFORM write_error_message.
* CATCH cx_root INTO lc_error.
CATCH CX_SY_PROGRAM_NOT_FOUND into lc_error.
ENDTRY.
IF lc_error IS NOT INITIAL.
l_error_text = lc_error->get_text( ).
WRITE: l_error_text.
g_subrc = 25.
EXIT.
ENDIF.
Any suggestions ?
regards,
Hans
‎2007 Feb 02 1:40 PM
‎2007 Feb 02 1:29 PM
Hi hans,
Try without the braces:
SUBMIT l_progname
Regards,
Ravi
‎2007 Feb 02 1:35 PM
The braces are required, because i want not to start report L_PROGNAME but the dynamically filled (L_PROGNAME).
‎2007 Feb 02 1:39 PM
HI,
Are you sure, if you are getting the value of the program in L_PROGNAME?
Keep an breakpoint and see if you are getting the program name.
Or, may be the program name is not correct.
Regards,
ravi
‎2007 Feb 02 1:37 PM
Hello Hans,
you might put your logic in a RFC-enabled module then you survive any short dump. Else you might try first an dynamic assign to any (even non existing) global variable within the report and check with LOAD REPORT PART pghead.
Regards
Klaus
‎2007 Feb 02 1:40 PM
‎2007 Feb 02 1:49 PM
That approach will miss programs with syntax-errors.
Regards
klaus
‎2007 Feb 02 1:49 PM
Of course, the solution provided by Rich does work. Also in my case.
But i want that the SAP's exception handler (try,catch) to handle the error. Just the way it works for other runtime errors.
‎2007 Feb 02 1:52 PM
Hello Hans,
no there is no way to achieve that. Check the online docu section 'not catchable' there are only 2 strategies avoid or try in seperate RFC-task.
Regards
klaus
‎2007 Feb 02 1:56 PM
As suggested by RICH , LOAD_PROGRAM_NOT_FOUND cannot be caught by TRY ..CATCH as it is not a system exception