Dynamic Modification UI Hierarchy (WebDynpro for ABAP)

By Raja Narayanan, Kaavian Systems

Create a Web Dynpro Component called Z_DYNAMIC 

 

Create a View called MAIN_VIEW , on the Method tab double-click the WDDOMODIFYVIEW and write the following coding. 

method WDDOMODIFYVIEW .
data : lr_textview type ref to cl_wd_text_view.
Data:lr_container type ref to cl_wd_uielement_container,
     lr_row_head type ref to cl_wd_row_head_data,
     lr_button type ref to cl_wd_button,
     lr_input type ref to cl_wd_input_field,
     lr_flow_data type ref to cl_wd_flow_data,
     lv_child_id type string.
if first_time = 'X'.
lr_button = cl_wd_button=>new_button( view = view
                                      text = 'Create Button'
                                      on_action = 'CLICK' ).
lr_row_head = cl_wd_row_head_data=>new_row_head_data( element = lr_button ).
lr_button->set_layout_data( lr_row_head ).
lr_button->set_tooltip( value = 'Tooltip' ).
lr_flow_data = cl_wd_flow_data=>new_flow_data( element = lr_button ).
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_container->add_child( lr_button ).
lr_textview = cl_wd_text_view=>new_text_view( view = view
                                              text = 'Welcome to Dynamic Layout Design' ).
lr_row_head = cl_wd_row_head_data=>new_row_head_data( element = lr_textview ).
lr_textview->set_layout_data( lr_row_head ).
lr_flow_data = cl_wd_flow_data=>new_flow_data( element = lr_textview ).
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_container->add_child( lr_textview ).
endif.
endmethod. 

Now create an Action called CLICK in the MAIN_VIEW…. Action Tab. 

 

In the MAIN_VIEW,  on the Method tab double-click the ONACTIONCLICK and write the following coding.  

method ONACTIONCLICK .
* get message manager
DATA: L_CURRENT_CONTROLLER TYPE REF TO IF_WD_CONTROLLER,
      L_MESSAGE_MANAGER    TYPE REF TO IF_WD_MESSAGE_MANAGER.
L_CURRENT_CONTROLLER ?= WD_THIS->WD_GET_API( ).
CALL METHOD L_CURRENT_CONTROLLER->GET_MESSAGE_MANAGER
  RECEIVING
    MESSAGE_MANAGER = L_MESSAGE_MANAGER .
* report message
CALL METHOD L_MESSAGE_MANAGER->REPORT_SUCCESS
  EXPORTING
    MESSAGE_TEXT             = 'Dynamic Event Triggered Successfully' .
endmethod.

Navigate to the window and embed view MAIN_VIEW into the window. 

 

Create a Web Dynpro application for your Web Dynpro component: 

Activate your Web Dynpro component and execute. 

Output 

 

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image