Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Step1: Creating a WD Component

Step2: Reuse the System component “WDR_OVS”

Step3: Create the required Node Structure in the Context of Component Controller

  • Emp_no , Type PERNR_D
  • Emp_Name, Type EMNAM  

Step4:  Define Mapping between View context and Component controller context  

Step5: Designing the Layout

 

Step6: Data mapping for the Input fields and the Table  

Step7: Reuse the Used Component from the Component controller

Step8: Create an Event handler by using the System component  

Step9: Change the System generated code from the Event handler method  

.

Changed code as per our requirement:  

METHOD ovs_employeeid.
TYPES : BEGIN OF ty_emp_data,
        pernr
TYPE pernr_d,
        ename
TYPE emnam,
       
END OF ty_emp_data,

        tt_emp_data
TYPE TABLE OF ty_emp_data.
DATA :  lo_nd_employee_details  TYPE REF TO if_wd_context_node,
        lo_el_employee_details 
TYPE REF TO if_wd_context_element,
        ls_employee_details    
TYPE wd_this->element_employee_details,
        lt_employee_details    
TYPE wd_this->elements_employee_details.

 
DATA: ls_search_input  TYPE ty_emp_data,
        lt_select_list  
TYPE TABLE OF ty_emp_data,
        ls_text         
TYPE wdr_name_value,
        lt_label_texts  
TYPE wdr_name_value_list,
        lt_column_texts 
TYPE wdr_name_value_list,
        lv_window_title 
TYPE string,
        lv_group_header 
TYPE string,
        lv_table_header 
TYPE string.

 
FIELD-SYMBOLS: <ls_selection>    TYPE ty_emp_data,
                 <lt_selection>   
TYPE tt_emp_data.
* navigate from <CONTEXT> to <EMPLOYEE_DETAILS> via lead selection
  lo_nd_employee_details = wd_context->get_child_node( name =
  wd_this->wdctx_employee_details ).

 
SELECT  pernr ename
         
FROM pa0001
         
INTO TABLE lt_select_list
         
UP TO 50 ROWS.

 
CASE ovs_callback_object->phase_indicator.

   
WHEN if_wd_ovs=>co_phase_0.

      ovs_callback_object->set_configuration(
                label_texts         = lt_label_texts
                column_texts        = lt_column_texts
                group_header        = lv_group_header
                window_title        = lv_window_title
                table_header        = lv_table_header
                col_count           =
2
                row_count           =
20
                table_multi_select  =
'X').

   
WHEN if_wd_ovs=>co_phase_1.* No Action
   
WHEN if_wd_ovs=>co_phase_2.

      ovs_callback_object->set_output_table(
output = lt_select_list ).

   
WHEN if_wd_ovs=>co_phase_3.

     
ASSIGN ovs_callback_object->selection->* TO <lt_selection>.

     
IF <lt_selection> IS ASSIGNED.

       
LOOP AT <lt_selection> ASSIGNING <ls_selection>.
         
APPEND <ls_selection> TO lt_employee_details.
       
ENDLOOP.

        lo_nd_employee_details->bind_table( lt_employee_details ).
* Visibility

 
DATA :  lo_el_context   TYPE REF TO if_wd_context_element,
          ls_context     
TYPE wd_this->element_context,
          lv_visible_grp1
TYPE wd_this->element_context-visible_grp1,
          lv_visible_grp2
TYPE wd_this->element_context-visible_grp2.
* get element via lead selection
  lo_el_context = wd_context->get_element( ).
* @TODO fill attribute
lv_visible_grp1 =
' '.
lv_visible_grp2 =
'X'.
* set single attribute
  lo_el_context->set_attribute(
    name = 
`VISIBLE_GRP1`
   
value = lv_visible_grp1 ).
* set single attribute
  lo_el_context->set_attribute(
    name = 
`VISIBLE_GRP2`
   
value = lv_visible_grp2 ).

     
ENDIF.
 
ENDCASE.
ENDMETHOD.  

Step10: Create a WD Application for the component, save it and test it  

Result:  

Labels in this area