‎2007 Oct 04 7:30 AM
Hi experts,
I am trying to catch the exception CX_SY_REF_IS_INITIAL.
The current syntax are as below :-
DATA: lr_view_manager TYPE REF TO cl_bsp_wd_view_manager
, lr_cucobdc TYPE REF TO cl_crm_ic_cucobdc_impl.
lr_view_manager ?= zl_2007_ic_tools_impl=>get_view_manager( ).
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' ).
Currently the statement
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' ). is pointing to nothing.
Can anyone show me how to write the codes.
Regards,
JH
‎2007 Oct 04 7:35 AM
Hi
refer this link:
http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
Regards
shiva
‎2007 Oct 04 7:35 AM
Hi
refer this link:
http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
Regards
shiva
‎2007 Oct 04 7:45 AM
Hi Shiva,
I've tried the syntax but there are still error. Can you tell me whether this is correct?
TRY
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' )
CATCH cx_sy_ref_is_initial.
ENDTRY
Thanks,
JH
‎2007 Oct 04 7:38 AM
Hi,
DATA: lr_view_manager TYPE REF TO cl_bsp_wd_view_manager
, lr_cucobdc TYPE REF TO cl_crm_ic_cucobdc_impl.
TRY.
lr_view_manager ?= zl_2007_ic_tools_impl=>get_view_manager( ).
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' ).
CATCH CX_SY_REF_IS_INITIAL.
" Code here to handle the exception
ENDTRY.
Regards,
Sesh
‎2007 Oct 04 7:57 AM
Hi Sesh,
I tried the syntax but this error pops out.
TRY.
lr_view_manager ?= zl_2007_ic_tools_impl=>get_view_manager( )
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' )
CATCH CX_SY_REF_IS_INITIAL.
If sy-subrc = 0.
ENDTRY.
"out-field?=method" can only be specified once.-----
Can you please advice.
Regards,
JH
‎2007 Oct 04 8:44 AM
Hi,
TRY.
lr_view_manager ?= zl_2007_ic_tools_impl=>get_view_manager( ). " Dot is missing here
lr_cucobdc ?= lr_view_manager->get_custom_controller( 'CuCoBDC' ). " Dot is missing here
CATCH CX_SY_REF_IS_INITIAL.
If sy-subrc = 0.
ENDTRY.
Regards,
Sesh
‎2007 Oct 04 10:08 AM
hI
PARAMETERS number TYPE i.
DATA: result TYPE p LENGTH 8 DECIMALS 2,
oref TYPE REF TO cx_root,
text TYPE string.
TRY.
IF ABS( number ) > 100.
RAISE EXCEPTION TYPE cx_demo_abs_too_large.
ENDIF.
PERFORM calculation USING number
CHANGING result
text.
CATCH cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
CATCH cx_root INTO oref.
text = oref->get_text( ).
ENDTRY.
IF NOT text IS INITIAL.
WRITE / text.
ENDIF.
WRITE: / 'Final result:', result.
FORM calculation USING p_number LIKE number
CHANGING p_result LIKE result
p_text LIKE text
RAISING cx_sy_arithmetic_error.
DATA l_oref TYPE REF TO cx_root.
TRY.
p_result = 1 / p_number.
WRITE: / 'Result of division:', p_result.
p_result = SQRT( p_number ).
WRITE: / 'Result of square root:', p_result.
CATCH cx_sy_zerodivide INTO l_oref.
p_text = l_oref->get_text( ).
CLEANUP.
CLEAR p_result.
ENDTRY.
ENDFORM.
please see this link for detailed explaination of the TRY & ENDTRY ...
http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
<b>REWARD IF USEFULL</b>