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: 

Submit report => raise exception class

Former Member
0 Kudos

Hello experst,

i have to call a report from one of my programs. In this report it can happen that an error occors. So there i call


      RAISE EXCEPTION TYPE zcx_exceptionmng
        EXPORTING t100_msgid = 'QY'
                            t100_msgno = '051'.

The code of the calling program looks like this:


try.
  submit z_test and return
          with p_backgr = 'X'
          with p_lot = '12312'
catch zcx_exceptionmng into oref.
endtry.

I wonder because the catch doens´t work. I get a system dump UNCAUGHT_EXCEPTION.

What´s my mistake?

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

Try something this way


RAISE EXCEPTION TYPE zcx_exceptionmng
        EXPORTING t100_msgid = 'QY'
                            t100_msgno = '051'.
if SY-SUBRC = 4.
Exce = 4.
export exce to memory id 'ZEX'.
endif.

then


submit z_test and return
          with p_backgr = 'X'
          with p_lot = '12312'

import exce from memory id 'ZEX'.
if exce is not initial.
 " Do your error handling

0 Kudos

Hello,

i know this possibility with sap memory, but is there no way to catch an exception by submitting a report?

SuhaSaha
Advisor
Advisor
0 Kudos

Since you are using AND RETURN addition the SUBMITted report is called in a new internal session with a separate LUW.

Because of which you are not able to handle the EXCEPTION raised in the called program in the calling program.

You can use aRs' solution as a workaround.

BR,

Suhas

Former Member
0 Kudos

solved my own