Skip to Content
avatar image
Former Member

'CAST' operation ('?=' or 'MOVE ?TO')

Hi Experts,

Need your support to understand and fix below WD A error.

The error is apearing due to casting taking place in Component Controller, could you please redirect me to fix it.


It was tried to assign a reference to a rereference variable using the

'CAST' operation ('?=' or 'MOVE ?TO').

However, the current content of the source variable does not fit into

the target variable.


 DATA lv_result TYPE REF TO if_wd_message_area.
  DATA lo_controller TYPE REF TO if_wd_window_controller.

*&* Comments: Cast error happening at below point.

lo_controller ?= wd_this->wd_get_api( ).

  CALL METHOD lo_controller->get_message_area
      result = lv_result.

  CLEAR lv_result.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 05, 2011 at 04:05 AM


    Declare the reference lo_controller as

    DATA lo_controller TYPE REF TO if_wd_component.

    Method wd_get_api in component controller return the reference of the component . You cannot use a window controller type to hold it..Hence the cast error.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Krishna Reddy B

      Hi ,

      I am newto ABAP world and trying to understand what the code is performing and fix the fix to CAST exception.