on 05-05-2011 4:57 AM
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.
Error:
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.
Code:
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
RECEIVING
result = lv_result.
CLEAR lv_result.
HI,
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.
Thanks,
Aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the comments.
As per your suggestion i have change to DATA lo_controller TYPE REF TO if_wd_component.
Method "GET_MESSAGE_AREA" does not exist. The following similarly-named methods do exist: "GET_MESSAGE" and "GET_MESSAGE_MANAGER".
DATA lo_controller TYPE REF TO if_wd_component.
after changing the above line getting error as GET_MESSAGE_AREA" does not exist
CALL METHOD lo_controller->get_message_area
Hi.,
What exacly u are trying to do., if u want to display message., use message manager., refer below code..
* get message manager
data lo_api_controller type ref to if_wd_view_controller.
data lo_message_manager type ref to if_wd_message_manager.
lo_api_controller = wd_This1->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager
.
* report message
CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'Enter user name' " message text
ELEMENT = lo_el_user " element
ATTRIBUTE_NAME = 'UNAME' . " attribute name
hope this helps u.,
Thanks & regards
Kiran
Hi,
Try like this.. code this is WDDOINIT of window..
data:
l_api_mycomp type ref to if_wd_window_controller,
l_wd_message_area type ref to if_wd_message_area.
l_api_mycomp ?= wd_this->wd_get_api( ).
l_wd_message_area = l_api_mycomp->get_message_area( ).
l_wd_message_area->set_display_attributes( i_for_all_instances = ' '
i_msg_lines_visible = '1'
i_use_toggle_area = 'X'
i_show_only_current = ' ' ).
endmethod.
Please go through this..
cheers,
Kris.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.