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

Catching an exception when calling a method

Former Member
0 Likes
2,240

My program has the following code in it:



  TRY.
      lv_request = me->get_request( ).
    CATCH cx_sy_ref_is_initial  INTO lv_error.

  ENDTRY.

When I run the code the method get_request short dumps with OBJECTS_OBJREF_NOT_ASSIGNED. Why is that? Cant I simple catch this exception and continue processing.

get_request is an inherited method and I can not change the code in it. But I do want to thandle the exception but cant seem to find a way.

Any ideas?

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
1,006

Hi,

what class are we talking about? Probably your method GET_REQUEST calls another method which raises this exception. The exception CX_SY_REF_IS_INITIAL belongs to class CX_DYNAMIC_CHECK. These exceptions have to be handled or explicitly forwarded. It looks like this is not done in method GET_REQUEST.

Cheers

3 REPLIES 3
Read only

mvoros
Active Contributor
0 Likes
1,007

Hi,

what class are we talking about? Probably your method GET_REQUEST calls another method which raises this exception. The exception CX_SY_REF_IS_INITIAL belongs to class CX_DYNAMIC_CHECK. These exceptions have to be handled or explicitly forwarded. It looks like this is not done in method GET_REQUEST.

Cheers

Read only

Former Member
0 Likes
1,006

The method get_request on is IF_BSP_APPLICATION (not sure which concrete implementation).

Anyway, you have answered my question. Unless the exception is explicitly being 'forwarded' then I cant handle it myself.

Thank you.

Alon

Read only

mvoros
Active Contributor
0 Likes
1,006

Hi,

what class are we talking about? Probably your method GET_REQUEST calls another method which raises this exception. The exception CX_SY_REF_IS_INITIAL belongs to class CX_DYNAMIC_CHECK. These exceptions have to be handled or explicitly forwarded. It looks like this is not done in method GET_REQUEST.

Cheers