cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic reusability of components

Former Member
0 Kudos

Hello,

in my web dynpro component MAIN_APPL I have to call another web dynpro component (either WD_APPL1, WD_APPL2 or WD_APPL3) but dynamically. I´ve done it staticly by declaring the component WD_APPL1 in folder Used components of the main component, later I use a ViewContainerUIelement in the view for embedding the component and declare the component use in the properties of the view, etc. etc.

The information that I´ve found here and in the SAP manual is confusing me totally.

Can anyone explain how to do this dynamically ??

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There is an API for this. It is method do_dynamic_navigation of if_wd_view_controller. It lets you fill an existing ViewContainerUIElement with a dynamic component usage.

data: target_component_name type string,
        target_view_name      type string,
        source_plug_name      type string.
  case node_index.
    when 1.
      target_component_name = 'ZZ_00_SFLIGHT'.
      target_view_name      = target_component_name.
      source_plug_name      = 'OUT_PLUG1'.
****Other Examples Navigations
  endcase.

    l_api_main = wd_this->wd_get_api( ).
    try.
        l_api_main->do_dynamic_navigation(
            source_window_name        = 'MAIN'
            source_vusage_name        = 'MAIN_VIEW_USAGE_1'
            source_plug_name          = source_plug_name
            target_component_name     = target_component_name
            target_view_name          = target_view_name
            target_plug_name          = 'DEFAULT'
            target_embedding_position = 'MAIN_VIEW/VIEW_CONTAINER').
        .
      catch cx_wd_runtime_repository .
        raise exception type cx_wdr_rt_exception.
    endtry.

Former Member
0 Kudos

Thanks Thomas. This looks good.

Can you please explain where your outbound plug 'OUT_PLUG1' is linking to ??

Thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It isn't linked to anything. It doesn't show up in the window editor because it is generated dynamically at runtime. You only need to supply a unique name for the plug - but the API call does everything else.

Answers (0)