Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 9057

Adding a custom tab in Web UI

$
0
0

Introduction

 

Adding a custom tab in Web UI to any of the standard Web UI applications can be tricky. Luckily SAP has made the Web UI very extensible by using the Service Provider (SP), Floorplan Manager (FPM) and Web Dynpro ABAP (WDA) frameworks.

 

Environment

 

PLM 7.02 on ERP 6.0 EHP6 SPS04 was used while writing this document.

 

Solution

 

Go to SE18 and use Enhancement Spot /PLMU/ES_FRW_CONSUMER_APPCC to create your own enhancement. Use BAdI defintion /PLMU/EX_FRW_CONSUMER_APPCC. Define a filter to restrict to a specific Web UI application (WD_APPLICATION_NAME) and configuration (WDAPPLICATIONCONFIGURATIONID) unless you want your tab to be visible in all applications. For example to add a tab only to the standard Document (DIR) Web UI application define WD_APPLICATION_NAME as /PLMU/WDA_DIR_OIF and WDAPPLICATIONCONFIGURATIONID as /PLMU/WDC_DIR_OIF_CFG. Of course if you have defined an Z application configuration, you would use that instead of the standard one.

 

In the implemeting class, method /PLMU/IF_EX_FRW_CONSUMER_APPCC~OVERRIDE_EVENT_OIF define the logic to add the custom tab. To add a custom tab, use the following code:

 

      data ls_uibb            type if_fpm_oif=>ty_s_uibb.      data lt_uibb            type if_fpm_oif=>ty_t_uibb.      clear lt_uibb[].      clear ls_uibb.      ls_uibb-component      = '<WEBDYNPROCOMPONENT>'.      ls_uibb-interface_view  = '<WEBDYNPROCOMPONENTWINDOW>'.      append ls_uibb to lt_uibb.      try.          call method io_oif->add_mainview            exporting              iv_variant_id    = '<VARIANT>'              iv_mainview_id  = '<MAINVIEWID>'              iv_mainview_name = '<NAMEOFTAB>'              iv_index        = <INDEXOFTAB>              iv_subview_id    = '<SUBVIEWID>'              iv_subview_name  = '<SUBVIEWNAME>'              it_uibb          = lt_uibb.        catch cx_fpm_floorplan .      endtry.

 

If you want to check if the tab is already visible use the following code:

 

  data lt_mainviews      type if_fpm_oif=>ty_t_mainview.  data ls_mainviews    type if_fpm_oif=>ty_s_mainview.  data lv_tabvisible        type boole_d.  try.      call method io_oif->get_mainviews        exporting          iv_variant_id = '<VARIANT>'        importing          et_mainview  = lt_mainviews.      loop at lt_mainviews into ls_mainviews.        if ls_mainviews-variant = '<VARIANT>' and          ls_mainviews-id      = '<MAINVIEWID>'.          lv_tabvisible = abap_true.          exit.        endif.      endloop.    catch cx_fpm_floorplan .  endtry.

Things to consider

 

In Web UI, like any modular implementation, data sharing becomes an issue. In Web UI assistance classes are heavily used. By simply using the same assistance class in your custom component you will have visibility on the context of the standard class. For example in the above example if I wanted to query for the current document type, I would have used the following code:

 

  data lo_node            type ref to if_wd_context_node.  data lo_element        type ref to if_wd_context_element.  data ls_init              type /plmb/s_dir_init.  if /plmu/cl_dir_appl_assist=>go_context is bound.    lo_node = /plmu/cl_dir_appl_assist=>go_context->get_child_node( /plmu/if_dir_c=>gc_init ).    if lo_node is bound.      lo_element = lo_node->get_element(  ).      if lo_element is bound.        lo_element->get_static_attributes( importing static_attributes = ls_init ).        if ls_init-documenttype eq 'XYZ'.        endif.      endif.    endif.

Viewing all articles
Browse latest Browse all 9057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>