SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

How to set UI element properties with context binding in Webdynpro

How to set UI element properties with context binding in Webdynpro

Some UI element properties can be bound directly to the context attribute of the associated primary property, which means a new context attribute does not have to be especially created. The Web Dynpro ABAP framework enables the following UI element properties to be bound in this way:

● Enabled

● ReadOnly

● State

● Visible

Instead of creating a separate context attribute whose value is directly dependent on the value of the context attribute bound to the primary property, the four UI element properties mentioned above can be bound directly the respective property of the context attribute bound to the primary property as shown below:

How to set UI element properties with context binding in Webdynpro

 

After the context binding set the property using the method set_attribute_property of the interface if_wd_context_element.


METHOD wddomodifyview .
  DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
  DATA lo_el_node1 TYPE REF TO if_wd_context_element.

  IF first_time = abap_true.
* navigate from  to  via lead selection
    lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).

* get element via lead selection
    lo_el_node1 = lo_nd_node1->get_element( ).

* @TODO handle not set lead selection
    IF lo_el_node1 IS BOUND.
      lo_el_node1->set_attribute_property(
        EXPORTING
          attribute_name =  `MATNR`   " Attribute Name
          property       =  lo_el_node1->e_property-enabled   " Property (See E_PROPERTY-*)
          value          =  abap_false   " Replacement for Real Boolean Type: 'X' == True '' == False
      ).

    ENDIF.
  ENDIF.
ENDMETHOD. 

Add comment

Before Buying, Compare Prices at Topprice.in

Topprice.in