Skip to Content
0
Mar 07, 2013 at 06:47 AM

How to catch exception that is not defined in REUSE_ALV function

203 Views

Hi Experts,

I am using REUSE_ALV_GRID_DISPLAY function module. It has a exception parameter PROGRAM_ERROR defined.

But still the FM throws runtime dump when fieldcat is blank.

So is it possible to catch these exceptions in my program and trigger error? This is to avoid dump.

I have tried to enclose the FM within TRY and CATCH but still it is not caught.

TRY

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING
i_callback_program = v_repid
i_structure_name = 'I_STOCK'
it_fieldcat = i_fieldcat
i_callback_user_command = 'USER_COMMAND' "For buton event handlers
i_callback_pf_status_set = 'SET_PF_STATUS' "For ALV toolbar
i_callback_top_of_page = 'TOP_OF_PAGE' "For ALV Header
is_layout = x_layout
i_save = c_x
i_grid_title = v_grid_title
IMPORTING
es_exit_caused_by_user = x_exit
TABLES
t_outtab = i_stock
EXCEPTIONS
program_error = 1
OTHERS = 2.
CATCH cx_root INTO oref.
v_exptext = oref->get_text( ).
ENDTRY.

What am I doing wrong? Is there any solution?

Thanks

Gopal