cancel
Showing results for 
Search instead for 
Did you mean: 

get the view from the component controller

Former Member
0 Kudos

Hi,

i have a understanding Problem here.

In my View BERUFUNGSVERFAHREN is a ButtonChoice Element called "LV_1_BUTTON" with 3 Action Items in it.

the goal was to set a Action Item dynmamicly

this is my Coding in my View BERUFUNGSVERFAHREN

DATA lo_view TYPE REF TO if_wd_view.
        DATA lo_buttonchoice TYPE REF TO cl_wd_button_choice.
        DATA lo_menuactionitem TYPE REF TO cl_wd_menu_action_item.

* Get a reference to the ButtonChoice view object
        lo_view ?= wd_this->wd_get_api( ).

*       lo_buttonchoice ?= lo_view->get_element( 'LV_1_BUTTON' ).
*       lo_buttonchoice->SET_SELECTED_ACTION_ITEM( 'RUF_1_NEUTRAL' ).
        lo_buttonchoice ?= lo_view->get_element( BUTTON_CHOICE_ID ).
        lo_buttonchoice->SET_SELECTED_ACTION_ITEM( ACTION_ITEM_ID ).

This workes fine for me in my VIEW but now i want to push this coding in my Componentcontroller to use as a method. (MVC-Modell)

And there i got this Dump "Dynamischer Typkonflikt bei Zuweisung von Referenzen "

I think this is happening because of my first line


DATA lo_view TYPE REF TO if_wd_view.

if i am right, maby i need to get first the reference of the VIEW ? Because i am now in my Componentcontroller.

Can u Help me here please.?

kind regards

tk

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Create an attribute in component controller with type  if_wd_view and pass value to that attribute in doinit method of that view.

In component controller method use that attribute to habe view instance.

Former Member
0 Kudos

@ Paul Sudhakar,

i Think u mean the right thing

my Solution was this:

i Created an Context-Attribute in my View

VIEW_WD_IF type ref to IF_WD_VIEW

Then in the Method WDDOMODIFYVIEW

i exportet the View Parameter to my context attribute VIEW_WD_IF

My Attribute was mapped with my CC so now i can easily use the Attribute in my CC Method for my Button Choice Method.

I used this coding im my CC Method

* get single attribute
       LO_EL_VIEW_DETAILS->GET_ATTRIBUTE( EXPORTING NAME `VIEW_WD_IF`
                                          IMPORTING VALUE = LV_VIEW_WD_IF ).

       LV_VIEW_WD_IF->GET_ELEMENT( BUTTON_CHOICE_ID  ).

       DATA LO_BUTTONCHOICE TYPE REF TO CL_WD_BUTTON_CHOICE.
       DATA LO_MENUACTIONITEM TYPE REF TO CL_WD_MENU_ACTION_ITEM.
* Button wird auf Neutral zurückgesetzt
       LO_BUTTONCHOICE ?= LV_VIEW_WD_IF->GET_ELEMENT( BUTTON_CHOICE_ID  ).
       LO_BUTTONCHOICE->SET_SELECTED_ACTION_ITEM( ACTION_ITEM_ID ).

Answers (0)