Skip to Content
0
Former Member
Nov 27, 2009 at 04:22 AM

cast to subclass error.

60 Views

Hi, Buddy:

componet: ICCMP_BT_BUTTON

view: BUTTONBAR

method: EH_ONROUTE

-


method EH_ONROUTE.

data: lr_cucobt type ref to CL_ICCMP_CUCOBT_IMPL,

lr_btadminH type ref to if_bol_bo_property_access.

TRY.

lr_cucobt ?= get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucobt ).

catch cx_root.

ENDTRY.

-


I create a subclass of CL_ICCMP_CUCOBT_IMPL called ZL_ICCMP_CUCOBT_IMPL, and use the following code:

-


data: lr_cucobt type ref to zl_iccmp_cucobt_impl,

lr_btadminh type ref to if_bol_bo_property_access,

lr_cucobt2 type ref to cl_iccmp_cucobt_impl.

try.

lr_cucobt2 ?= get_custom_controller( controller_id = if_iccmp_global_controller_con=>cucobt ).

lr_cucobt ?= lr_cucobt2.

catch cx_root.

endtry.

-


But I can't cast it , and get this expection:

During a 'CAST' operation ('?=' oder 'MOVE ? TO')a type conflict occurred. The source type

'\CLASS=CL_ICCMP_CUCOBT_IMPL' is not compatible for assigning with the target type '\CLASS=ZL_ICCMP_CUCOBT_IMPL'.

How to get reference of my subclass?

Cheers,

Eric