Application Development and Automation 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: 
Read only

Submit report => raise exception class

Former Member
0 Likes
668

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?

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
Read only

former_member194669
Active Contributor
0 Likes
602

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

Read only

0 Likes
602

Hello,

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
602

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

Read only

Former Member
0 Likes
602

solved my own