Skip to Content

In this blog, we will look at how interface views of different child components are embedded dynamically inside the window of main component in SRM (By child component I mean component that is being used inside main component).

If you look at WD component /SAPSRM/WDC_DODC_SC_GAF_C and view V_DODC_SC_GAF_FSCA, there are two ViewcontainerUIelements embedded.

pic1.JPG

In general Viewcontaineruielement is used to embed interface views from child WD components. So we define a component usage for child WD component and embed the interface view of that component inside the window of the main component. We do this in the window of main component at design time.

Below is the screenshot of how the component usage is defined for component /SAPSRM/WDC_DODC_SC_GAF_C 

pic2.JPG

Looking in the window IV_L_FPC_GAF_CA, we see interface view IV_L_FPC_CA_DETAILS of component /SAPSRM/WDI_L_FPC_CA_DTLS is embedded in each of the view container ui element. That looks fine 🙂

pic3.JPG

Now let’s go to component /SAPSRM/WDI_L_FPC_CA_DTLS and see what that view contains. To our surprise the WD component is actually a WD component interface with just one interface view and nothing else.

pic4.JPG

Now the question is when we run the application for WD component /SAPSRM/WDC_DODC_SC_GAF_C   we see interface views from /SAPSRM/WDC_UI_SC_DODC_CC embedded in CATALOG_LIST and /SAPSRM/CH_WD_UI_SO_CCS embedded in CROSS_CATALOG_SEARCH.

How is this possible?

If you go back to my blog Understanding Shopping cart creation in SRM7 – Part 2,  you will find a screen shot of the component configuration and a table detailing different WD components configured  for /SAPSRM/WDCC_FPM_SC_GAF_C. When we run the application, in the WDDOINIT method, we read the context node USAGE_DEFINITION , which contains different  WD components to be used for each of the usage definition at runtime. Component  /SAPSRM/WDC_UI_SC_DODC_CC is used for  CATALOG_LIST and /SAPSRM/CH_WD_UI_SO_CCS  is used for CROSS_CATALOG_SEARCH.

In general we use the below code wizard code to create the usage of child component

  DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

lo_cmp_usage =   wd_this->wd_cpuse_usage1( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.


This code works fine, if interface view of child component is embedded at design time. But in the WD component  /SAPSRM/WDC_DODC_SC_GAF_C embedded interface view is empty .Then how the system is determining the exact interface view to embed.  The trick lies in method CREATE_COMPONENT of class CL_WDR_COMPONENT_USAGE (This is the runtime class that gets instantiated when running the above mentioned code).  There is another variation of method CREATE_COMPONENT, where we can pass the component name and configuration name directly.

CALL METHOD io_usage->create_component
EXPORTING
component_name   = lv_component
configuration_id = ls_config_key.


So when creating usage for  CATALOG_LIST component /SAPSRM/WDC_UI_SC_DODC_CC is passed in the above code ( in lv_component) and when creating usage for CROSS_CATALOG_SEARCH, component  /SAPSRM/CH_WD_UI_SO_CCS  is passed.

The final part of the trick is to make sure that interface view in both of these components is IV_L_FPC_CA_DETAILS ( which is same as interface view of WD component interface  /SAPSRM/WDI_L_FPC_CA_DTLS ) and also implement the WD component interface /SAPSRM/WDI_L_FPC_CA_DTLS ( if you look at the code inside method CREATE_COMPONENT of class CL_WDR_COMPONENT_USAGE, you will understand why this is necessary)

To summarize, the components that you see in the properties tab of the component are just WD component interfaces which just act as place holders and nothing else. The real components  that are used at runtime are configured in component configuration and they should have interface views with same name as in corresponding WD component interface and implement the WD component interface.

This should have been part of Understanding Shopping cart creation in SRM7 – Part 2, but decided to have it separated in order to reduce the length of Part2

Have a nice day 🙂

To report this post you need to login first.

2 Comments

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

  1. Naganandini S

    Hi Sankara,

    Thanks a loooot for such informative articles…. I have read all 3 articles…. ‘Understanding SC creation in SRM 7.0’. You helped me to fill the gaps that I always had….  🙂

    Eagerly waiting for your next article.

    Kind Regards,

    Nandini

    (0) 
    1. sankara rao bhatta Post author

      Hi Nandini,

      I am really glad to know that the blogs helped you to fill your knowledge gap. I love to write more blogs but not getting time now a days.

      thanks,

      sankar.

      (0) 

Leave a Reply