Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Changing the Value of a Binded element


I have two views in a component. A field in the first view needs to be displayed in the second view. I am using CONTORLLER context bind to transfer the data to second view. Here I have binded source field to CONTROLLER context and then i have binded CONTROLLER context attribute to second view context attribute.

Now my requirement is needs to make slight modification to the same field before displaying the same in Second view. For this i have used the following code in the WDINIT of the second view. Which is not working, please help me in this case.

data: node type ref to if_wd_context_node,
        element type ref to if_wd_context_element,
        elements type wdr_context_element_set,
        change_Date_time TYPE string,
        lv_change_date_time TYPE char35,
        lv_temp TYPE char35.
CLEAR: change_date_time.

  node = wd_context->get_child_node( 'VIEWDETAIL_CH_REQ' ).
 if node is not initial.
   elements = node->get_elements( ).
  loop at elements into element.
     if sy-tabix = 1.
     element->get_attribute( exporting name = 'CHANGE_DATE_TIME' importing value = change_date_time ).
   lv_change_date_time = change_date_time.
   lv_temp+0(4) = lv_change_date_time+0(4).
   lv_temp+4(1) = '-'.
   lv_temp+5(2) = lv_change_date_time+4(2).
   lv_temp+7(1) = '-'.
   lv_temp+8(2) = lv_change_date_time+6(2).
   lv_temp+10(1) = space.
   lv_temp+11(2) = lv_change_date_time+8(2).
   lv_temp+13(1) = ':'.
   lv_temp+14(2) = lv_change_date_time+10(2).
   lv_temp+16(1) = ':'.
   lv_temp+17(2) = lv_change_date_time+12(2).

   element->set_attribute( exporting name = 'CHANGE_DATE_TIME' value = lv_temp ).

Former Member
Not what you were looking for? View more on this topic or Ask a question