Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CATCH...ENDCATCH not working with SUBMIT.

0 Kudos

Hello SAPients.

I have this code:

catch system-exceptions others = 1.

submit (lvc_progid) via selection-screen.

endcatch.

but the error is not catched, I always get a short dump when program doesn't exist, I also tried this:

catch system-exceptions LOAD_PROGRAM_NOT_FOUND = 1.

submit (lvc_progid) via selection-screen.

endcatch.

but when I syntax check the program I get the error "system-exception" expected, not "LOAD_PROGRAM_NOT_FOUND".

What am I doing wrong?

Thank you in advance for your help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try this:

TRY.

submit (lvc_progid) via selection-screen.

CATCH LOAD_PROGRAM_NOT_FOUND.

ENDTRY.

3 REPLIES 3

Former Member
0 Kudos

Try this:

TRY.

submit (lvc_progid) via selection-screen.

CATCH LOAD_PROGRAM_NOT_FOUND.

ENDTRY.

0 Kudos

I think the TRY statement doesn't exists in 4.6C. I get the error message Statement "TRY" is not defined. Please check your spelling.

0 Kudos

The LOAD_PROGRAM_NOT_FOUND is not a system exception. This is the reason for the sytax error.

If you are not on newer version of SAP, then the TRY statement will not be avaialbe for you. You can try this code. It checks the report name against the report program table.



report zrich_0001.

data: xtrdir type trdir.

data: report(30) type c value 'ZTEST'.

select single * from trdir
         into xtrdir
                 where name = report.
if sy-subrc = 0.
  submit (report) via selection-screen.
else.
  message e001(00) with 'Program does not exists'.
endif.

Regards,

Rich Heilman