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

How to catch the exception CX_SY_REF_IS_INITIAL

Former Member
0 Likes
6,661

hi

my code

element = l_document->find_from_name( name = period ).
 str = element->get_attribute( name = dechu ).

and i don't have the field dechu so i have a dump with OBJECTS_OBJREF_NOT_ASSIGNED_NO

CX_SY_REF_IS_INITIAL

how i can catch this exception ?

thanks

serge

1 ACCEPTED SOLUTION
Read only

Former Member
2,313

Hi

Declare a reference variable for the exception class.

data : lref_excep type ref to to CX_SY_REF_IS_INITIAL.

try.

element = l_document->find_from_name( name = period ).

str = element->get_attribute( name = dechu ).

catch CX_SY_REF_IS_INITIAL into lref_execp.

l_msg = lref_execp->get_text().

  • now display the error message l_msg.

endtry.

click the below link for detailed documentation...

http://help.sap.com/saphelp_47x200/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm

Regards,

Vara

2 REPLIES 2
Read only

Former Member
0 Likes
2,313

example

try.

element = l_document->find_from_name( name = period ).

catch CX_SY_REF_IS_INITIAL.

.. code with what you want to do goes here ..

endtry.

try.

str = element->get_attribute( name = dechu ).

catch CX_SY_REF_IS_INITIAL.

.. code with what you want to do goes here ..

endtry.

Read only

Former Member
2,314

Hi

Declare a reference variable for the exception class.

data : lref_excep type ref to to CX_SY_REF_IS_INITIAL.

try.

element = l_document->find_from_name( name = period ).

str = element->get_attribute( name = dechu ).

catch CX_SY_REF_IS_INITIAL into lref_execp.

l_msg = lref_execp->get_text().

  • now display the error message l_msg.

endtry.

click the below link for detailed documentation...

http://help.sap.com/saphelp_47x200/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm

Regards,

Vara