cancel
Showing results for 
Search instead for 
Did you mean: 

set ui element properties dynamically

Carola1
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello.

There are two Web Dynpro Components.

In component1/view1 the user decides if he wants to display or to change the data.

Clicking on display or change, I call a view2 of the Comp2. There, the buttons should be active or inactive in dependence on the action display/change in Comp1.

I use context mapping between the two components and I tried to solve the problem via two different inbound plugs of view2 (in_change and in_show). There I wanted to set the context attributes of the view2 to which the ui elements property 'enabled' is bound.

Now I have two problems:

1) the inbound plug handler method is not called, probably because there is a default plug for the window of comp2.

2)

lo_el_show_change->set_attribute(
    importing
      name =  `CREATEACT`
      value = lv_createact ).

Calling the set_attribute method for the context attribute (type Boolean) in the inbound plug handler leads to a syntax check error which says that the field CREATEACT has not to be changed. Why that ?

Is there a general recommenation to solve the problem of setting ui element properties dynamicalls between different components ?

Thanks and regards.

Carola

Accepted Solutions (0)

Answers (5)

Answers (5)

Carola1
Product and Topic Expert
Product and Topic Expert
0 Kudos

thanks

Carola1
Product and Topic Expert
Product and Topic Expert
0 Kudos

points

Carola1
Product and Topic Expert
Product and Topic Expert
0 Kudos

sorry, I got it.

It was exporting instead of importing

Former Member
0 Kudos

Have an interface node in the component controller of comp2 and have the anabled attribute in it. Map the context node in both comp1 and in the view of comp2. Directly set the context attribute from comp1. You dont need to do anything in comp2, other than binding the attribute to the enabled property of the buttons.

Regards

Nithya

Carola1
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello.

Okay i tried it like Nithya described with interface node attribute Createact in COMP2.

I mapped this interface node to the View2, COMPController1 and View1.

In the action handler of the showButton I tried to set the context attribute:

 navigate from <CONTEXT> to <SHOWCHG> via lead selection
  lo_nd_showchg = wd_context->get_child_node( name = wd_this->wdctx_showchg ).
* get element via lead selection
  lo_el_showchg = lo_nd_showchg->get_element(  ).
* get single attribute
  lo_el_showchg->set_attribute(
    importing
      name =  `CREATEACT`
      value = lv_createact ).

But I get the syntax error message:

'Field CREATEACT has not to be changed'

Do you know why ??? is the syntax correct ?

Thanks and kind regards.

Carola

Former Member
0 Kudos

Hi Carola.

In Comp 2 create a method (set_enabled) in the component controller marked as interface method. This method could take a wdy_boolean as attribute.

When ever this method is called set the corresponding attribute in context of comp2 which you want to use for enable/disable.

In the action handler of comp1 for the enable/disable button just call the interface method of the used comp2.

enable = lr_interface_ctrl->set_enabled( abap_true ).

disable = lr_interface_ctrl->set_enabled( abap_false ).

Cheers,

Sascha