Skip to Content

Some of you would be interested in knowing how we achieved this. We were trying to add a new tab at the item level which holds Z fields. Now, this is possible via SPRO -Create Table Extensions and Supply with Data . But the limitation is that a table appears in the new tab. Our requirement was to have the new tab similar to that of the item basic data tab.

This was achieved in the following way, I will show below an example wrt to Rfx and the same can be incorporated for Response and Contracts.

Pre-Requisite – Add custom fields through SPRO to the Rfx Item structure and maintain metadata for each field.

  1. Create a custom webdynpro componet call Z_RFQ_CUSTOMTAB with your required layout and implement interface /SAPSRM/WDI_L_FPC_CA_DLTS,/SAPRM/WDI_L_FPC_GENERAL and IF_FPM_UI_BUILDING_BLOCK.
  2. Create a context node with the structure of the Zfields that were created via SPRO
  3. Create an enhancement to /SAPSRM/WDC_DOFC_RFQ_I_D1 and to the used component add  Z_RFQ_CUSTOMTAB.Custom Tab D1 for RfQ.PNG
  4. In the layout of the /SAPSRM/WDC_DOFC_RFQ_I_D1 comp, add a new tab to the tabstrip called D1_CUSTOM.
  5. Create an overwrite exit to the INIT_TAB method of the component controller of  /SAPSRM/WDC_DOFC_RFQ_I_D1. The logic in this method should be such that you look for the tab D1_CUSTOM , instantiate the Usage of the Zcomp that you added. Create a component using the usage and then initialize the usage
  6. In the ONACTIONSELECT_TAB of the view create an overwrite exit , such that you write a code to perform the necessary action when the additional tab is selected.
  7. In the window IV_L_FPC_CA_DETAILS embed and emty view and the interface view of Zcomp.
  8. Create an outbound plug D1_I_RFQ_CUSTOM of window and then create a navigation link between the plug and ‘Default’ Inbound plug of interface view as shown
  9. Window1.PNG
  10. Create a context node in component controller  with the structure of the Zfields, that was created using SPRO.
  11. Embed the View of the custom component to window IV_L_FPC_CA_DETAILS.
  12. Create a Custom Controller ‘CONFIG CONTROLLER’and then right click on it and select ‘SET AS CONFIG CONTROLLER’ to convert it to configuration Controller. 
  13. Create a Context ‘USAGE_DEFINITION’ in CONFIG_CONTROLLER and map it to your View Controller because the standard code of FPM application  checks this context node of embedded components .Thus create a component configuration for the custom component.
  14. In the component controller method WDDOINIT create a task container instance and get the data  from the mapper object using the instance method ‘get_current_bo_mapper’ into  attribute mo_bom_rfq.
  15. Using the mo_bom_rfq in the component controller get all the data to the current view controller.
  16. Add the standard assistance class ‘/SAPSRM/CL_CH_WD_UI_ASSIST_DTL’ in custom component as shown below.
  17. Assistance class.PNG

This is all we did to achieve this. I hope this helps you . Please feel free to drop any questions or view with respect to this and I will be more than happy to reply back.

18. Screenshot of the Custom tab.

/wp-content/uploads/2012/07/image46_322363.png

To report this post you need to login first.

24 Comments

You must be Logged on to comment or reply to a post.

  1. partha sarathi

    Good work Naveen.

    Require prerequisite configuration steps,step12 and step13 in more details with screenshots. 

    Could you please elaborate step step approach in details in screenshots  then it will be more helpful for us.

    (0) 
  2. Nida Patel

    Hi Naveen,

    I’ve carried out all the above mentioned activities and have added a tab and fields to SC item. But the data is not getting stored on DB.

    1. In SPRO, I’ve added fields to both SC and DB item structures and created the context attributes wrt SC structure. Would like to know if this is correct. I’ve maintained the metadata as well, though I didn’t get its purpose as the fields are being added through WD view.

    2. From step 14 onwards, I couldn’t understand the exact procedure. I’ve performed some part of these steps referring the WD for other std tabs, but that didn’t help. It would be really helpful if you could elaborate these steps a little.

    Thanks for sharing such a valuable info.

    Nida

    (0) 
    1. naveen rajan Post author

      Hi Nida,

      Sorry for the late reply. Can you make sure that you mapped the context element correctly in the custom webdynpro component.

      The step 13 onwards is to retain the guids , etc that gets created in the basic data tab ( or somewhere else , but the reference is in the basic data tab) . So you would need to follow step 13 onwards to pass the guids and other information to your custom tab , once you have the reference all you have to do is map the elements to your context node and the system will automatically save the data to your db , like the way it does it for other elements ( in the basis data or other tabs)

      I hope I have made myself clear. Please let me know if you need any more information.

      Regards,

      Naveen

      (0) 
      1. Dinesh k

        Hi Naveen,

        Thanks for your detailed steps.

        I tried the above steps. I am able to see the Tab but the view is not getting called. Is there anything that I need to do.

        If possible can you eloborate Steps 5, 6 , 12, 13

        My step 5 looks like this

            WHEN ‘D1_I_RFQ_CUSTOM’.

              DATAls_config_key         TYPE         wdy_config_key.

              lo_cmp_usage = wd_this->wd_cpuse_z_rfq_customtab( ).

              IF lo_cmp_usage->has_active_component( ) IS INITIAL.

                lo_cmp_usage = wd_this->wd_cpuse_z_rfq_customtab( ).

                ls_config_keyconfig_id = ‘Z_RFQ_CUSTOMTAB’.

        *** TRY WD COMPONENT INSTANTIATION

              CALL METHOD lo_cmp_usage->create_component

                EXPORTING

                  component_name   = ‘Z_RFQ_CUSTOMTAB’

                  configuration_id = ls_config_key.

        *        wd_this->mo_component_manager->init_component_usage( io_usage = lo_cmp_usage ).

                wd_this->mo_ztest ?= wd_this->wd_cpifc_z_rfq_customtab( ).

                wd_assist->add_comp_controller_for_detail( EXPORTING iv_ui_id = iv_tab_id

                                                                     io_comp_controller = wd_this->mo_ztest ).

        (0) 
      2. Nida Patel

        Hi Naveen,

        Thanks for the elaboration.

        In view method WDDOINIT, I’ve written the following code for context mapping (as done in other std. components)

        CREATE OBJECT wd_this->mo_meta_init.
           CLEAR lo_root_context_node_info.
           lo_root_context_node_info = wd_context->get_node_info( ).
           wd_this->mo_meta_init->init_context( EXPORTING iv_root_context_node_info = lo_root_context_node_info ).

        *   navigate from <CONTEXT> to <FMQ> via lead selection
             LO_ND_FMQ = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_FMQ ).
             ls_wd_setREF_CONTEXT_NODE = LO_ND_FMQ.
             APPEND ls_wd_set to lt_wd_set.
             lo_wd_view_controller = wd_this->wd_get_api( ).
             lo_wd_component_controller ?= wd_comp_controller.
             wd_this->mo_dodm_ct = wd_comp_controller->mo_bom_sc->/SAPSRM/IF_CLL_BO_MAPPER~GET_DODM_CT(
                                   ION_WD_SET                 = lt_wd_set
                                   IO_WD_VIEW_CONTROLLER      = lo_wd_view_controller
                                   IO_WD_COMPONENT_CONTROLLER = lo_wd_component_controller
                                   io_meta_init               = wd_this->mo_meta_init
                                   IV_VIEW_NAME               = lo_wd_view_controller->IF_WD_CONTROLLER~NAME ).


        I understand from your reply, that I’ll need to map the reference elements to my context node. Reference, as in my case, would be mo_bom_sc, right? Could you please suggest what exactly I should do here, in addition to above code or in place of above code.


        In case of other std tabs, the mapper class has method for each component, eg: get_dodm_sc_i_bd  for Basic data, get_dodm_account_assignment for Account Assignment. Since, mine is a custom development, I’ve used GET_DODM_CT. Please suggest


        Thanks again.


        Regards

        Nida

        (0) 
        1. naveen rajan Post author

          Hi Nida,

          Just do one thing for me, place a breakpoint in this code and see if your context node is getting filled with data.

          Regards,

          Naveen

          (0) 
          1. Shakeer Hussain

            Hi Naveen,

            Thanks for this blog, For me everything is working except data base is not filling with the data whatever i enter in custom fields in portal. may be i have not done points 13,14,15 from the below blog.Can you please elobarate those steps.

            Thanks a lot.

            (0) 
  3. Isaac Ariza Cruz

    Hi Naveen,

    First of all, thanks for this great blog. I’ve followed it and I’ve been able to create a new custom tab at SC Item level and display a Z Component on it. However, I’ve been also having problems when I try to save data on DB. And I think that it is because some steps are not properly done. Therefore, could you please help me on the following question?

    • Following step 14, I’ve implemented WDDOINIT method to create a task container instance and get the data from the mapper:

      ” create a task container instance
    lo_task_factory
    = /sapsrm/cl_ch_wd_taskcont_fact=>get_instance( ).
    wd_this
    ->mo_task_container = lo_task_factory->get_task_container( ).

    ” get BO mapper
    wd_this
    ->mo_bom_sc = wd_this->mo_task_container->get_bom_sc( ).

    So in that way I have the SC data and I can set them into corresponding Z Fields.

    However, I’ve not able to SAVE data entered into the item. And I guess it is because indeed I’ve not completely integrated my new Z WD. So could you please support me on what additional action should be done?

    Thanks again and best regards,

    Isaac

    (0) 
    1. naveen rajan Post author

      Hi Isaac,

      I would want you to check a couple of things

      1. Make sure you added the custom fields on the custom tab to the below structures

      a. incl_eew_pd_item_csf

      b. incl_eew_pd_item_csf_sc

      2. In the mo_bom_sc – mo_item_admin  – mo_pdo_item_list – mt_items is filled ( check this via debugger)

      Regards,

      Naveen

      (0) 
  4. Daniel C

    Hi ,

    Thanks for this document . Helped a lot.

    May i know how to get the shopping cart number or Rfx number to my custom component so that i can use it to determine corresponding Purchase Req number.

    Thanks,

    Daniel C

    (0) 

Leave a Reply