Creation of WEB UI Component and navigation with standard component

...Previous

Step 10. Add custom component ZBP in configuration

In component structure browser, double click on view SalesHome. Go to configuration tab and click on edit and provide customizing request.

Select the custom component ZBP and click on move down button

Now, if you test standard component WCC_SLS_HOME. It will show the LINK view as a part of view set. But currently if you click on link ‘My Accounts’ it will not work as navigation is still remaining.

Step 11. Create Navigation Link.

In runtime repository editor, right click on navigation link and select Add Navigation Link. Enter ID (e.g. ZBP), source view (e.g. ZBP.ZBP/LINK), outbound plug (e.g. TOLIST), target view (e.g. ZBP.ZBP/MainWindow) and inbound plug (e.g. FROMLINK). Click on continue. Click on save.

Now, if you test standard component WCC_SLS_HOME. It will show the LINK view as a part of view set. Also when you click on link ‘My Accounts’ it will show you available buisness partners.

Step 12. Creation of a field value as a link in table view.

As shown in above screen shot, we will create buisness partner field as a link and on clicking on this, we are able to view details of buisness partner.

Go to the custom component which you have created in step1 i.e. ZBP.

In component structure browser double click on PARTNER view. In right hand side expand context node PARTNER. Go to the attribute BP_NUMBER and implement GET_P_BP_NUMBER method.

method GET_P_BP_NUMBER.
  
CASE iv_property.
    
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
    
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
      rv_value = 
'SELECTION'.
  
ENDCASE.
endmethod.

In PARTNER view, right click on outbound plug and choose create. Give plug name (e.g. TOPARTNER).

Right click on custom controller and choose create.

A wizard is displayed. Enter custom controller name (e.g. CUCOPARTNER), Model node (e.g. PARTNER), BOL Entity BuilHeader), add model attribute by clicking on  and select all. Click on continue and finish the wizard.  If prompted choose a package and enter workbench request.

Double click on component controller and right click on context node and choose create. A wizard is displayed. Enter name (e.g. BPPARTNER), select radio button of model node and enter BOL Entity (BuilHeader), ), add model attribute by clicking on  and select all. Do not change on the following screens and finish the wizard. If prompted choose a package and enter workbench request.

Now right click on context newly created context node BPPARTNER and choose create binding. Enter BSP Application (e.g. ZBP), Controller type (Custom Controller), custom controller (CUCOPARTNER.do) and target context node (PARTNER).

In component controller, right click on method  WD_USAGE_INITIALIZE and choose redefine. Double click on the method to implement.

method WD_USAGE_INITIALIZE.
  
DATA: lv_usage TYPE REF TO if_bsp_wd_component_usage.
  lv_usage = me->comp_controller->get_component_usage( iv_usage->usage_name ).
  
CASE iv_usage->usage_name.
    
WHEN 'CUBP'.
      
CALL METHOD lv_usage->bind_context_node
        
EXPORTING
          iv_controller_type  = cl_bsp_wd_controller=>co_type_component
          iv_target_node_name = 
'BPPARTNER'
          iv_node_2_bind      = 
'PARTNER'.
  
endcase.
endmethod.

 

In component structure browser, double click on PARTNER view and select the outbound plug method OP_TOPARTNER to implement.

method OP_TOPARTNER.
  
DATA: lr_tcc      TYPE REF TO ZL_ZBP_BSPWDCOMPONENT_IMPL, " Implementation class of component controller
        lr_cuco     
TYPE REF TO ZL_ZBP_CUCOPARTNER_IMPL,  " Implementation class of custom controller
        lr_entity   
TYPE REF TO cl_crm_bol_entity,
        lr_cuwrp    
TYPE REF TO cl_bsp_wd_collection_wrapper,
        lr_window   
TYPE REF TO cl_bsp_wd_window,
        lv_guid     
TYPE        bu_partner_guid,
        lr_core     
TYPE REF TO cl_crm_bol_core.
  lr_cuco ?= me->get_custom_controller( 
'ZBP/CUCOPARTNER' ).
  
CHECK lr_cuco IS BOUND.
  lr_cuwrp = me->typed_context->PARTNER->get_collection_wrapper( ).
  
CHECK lr_cuwrp IS BOUND.
  lr_entity ?= lr_cuwrp->get_current( ).
  
CALL METHOD lr_entity->get_property_as_value
    
EXPORTING
      iv_attr_name = 
'BP_GUID'
    
IMPORTING
      ev_result    = lv_guid.
  lr_core = cl_crm_bol_core=>get_instance( ).
  lr_entity = lr_core->get_root_entity( iv_object_name = 
'BuilHeader' iv_object_guid = lv_guid 

CHECK lr_entity IS BOUND.
  lr_tcc ?= me->comp_controller.
  lr_tcc->typed_context->bppartner->collection_wrapper->clear_collection( ).
  lr_tcc->typed_context->bppartner->collection_wrapper-add( iv_entity = lr_entity
 iv_set_focus = abap_true ).
 view_manager->navigate( source_rep_view = rep_view
                         outbound_plug   = 
'tobp' ).
endmethod.

Right click on event handler in PARTNER view and create the event handler (e.g. SELECTION). Implement the method EH_ONSELECTION.

method EH_ONSELECTION.
  
DATA: lv_index  TYPE i.
    cl_thtmlb_util=>get_event_info(
      
EXPORTING
        iv_event = htmlb_event_ex
      
IMPORTING
        ev_index  = lv_index ).
  me->typed_context->PARTNER->collection_wrapper->find( iv_index = lv_index ).
  op_TOPARTNER( ).
endmethod.

To test all scenarios, run the transaction CRM_UI.

Click on My Accounts link.

Click on business partner 404848 for detailed view.

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