ALV Table with Business Graphics (WebDynpro for ABAP)

...Previous 

38. Now go to ‘Component usages’ in the left side tree and expand ALV and double click on the INTERFACECONTROLLER_USAGE. Then Click the Controller Usage Button in the Right Side Window. 

 

39. It will open a Screen for Selecting Component Use. There, select the COMPONENTCONTROLLER in the View/Controller. Then Press Enter.

 

40. Then Drag and Drop the Node EMPLOYEE to the Node DATA in the Context INTERFACECONTROLLER. 

 

41. Go to the View and Click the Tab Methods. 

 

42. In the ONACTIONGET_EMPLOYEE_DETAILS Method, Write the Following Coding.
ONACTIONGET_EMPLOYEE_DETAILS:
method ONACTIONGET_EMPLOYEE_DETAILS .
  wd_this->fire_to_alv_table_plg(  ).
  DATA lo_nd_employee TYPE REF TO if_wd_context_node.
  DATA lo_el_employee TYPE REF TO if_wd_context_element.
  DATA lt_employee TYPE wd_this->elements_employee.
  DATA ls_employee TYPE wd_this->element_employee.
* navigate from <CONTEXT> to <EMPLOYEE> via lead selection
  lo_nd_employee = wd_context->get_child_node( name = wd_this->wdctx_employee ).
  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lv_emp_no LIKE ls_context-emp_no.
  
  DATA lv_num TYPE I.
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).
* get single attribute
  lo_el_context->get_attribute(
    EXPORTING
      name =  `EMP_NO`
    IMPORTING
      value = lv_emp_no ).
  SELECT ZZORGEH ZZ_PER_ASSG BEGDA ENDDA INTO CORRESPONDING FIELDS OF TABLE 
      lt_employee  FROM PA9027 WHERE PERNR EQ lv_emp_no AND ENDDA EQ '99991231'.         
  DESCRIBE TABLE lt_employee LINES lv_num.        
  lo_nd_employee->BIND_TABLE( lt_employee ).
  data lo_cmp_usage type ref to if_wd_component_usage.
  lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
  
  if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage->create_component( ).
  endif.
  DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
  lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv( ).
  DATA lo_value TYPE ref to cl_salv_wd_config_table.
  lo_value = lo_interfacecontroller->get_model( ).
  
* Set Visible Row Count as 5
  lo_value->if_salv_wd_table_settings~set_visible_row_count( lv_num ).
* The Config Table Setting to Display Table & Business Graphics
  DATA: l_ref_config_table TYPE REF TO if_salv_wd_table_settings,
        l_display_as TYPE salv_wd_constant VALUE '02'.
  l_ref_config_table ?= lo_value.
  l_ref_config_table->set_display_as( value = l_display_as ).  
endmethod.

43. Save the Application and Activate the Component. 

 

44. Create Webdynpro Application, save it and Test the Application. 

Output: 

1. Enter the Employee Number in the Input Field and Click the Button ‘Get Details’. 

 

2. The Output will Display as shown below. 

 

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