Skip to Content
avatar image
Former Member

Can i change the view embbed in viewContainerUIelement in code?

I have defined a viewContainerUIelement in my MAINVIEW and several VIEWs in my component. Each time, I start the WD application, I need the viewContainer choose one of the VIEWs to show according to some conditions. How can i realize it in my code?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 22, 2008 at 02:58 AM

    Hi,

    After Embedding all the required views in the View UI Container , link them through the plugs and fire the relevent plugs of the View which want to display.

    Eg, if Embed View A, View B, View C in the Main View,Link these Inbound plugs from the View A, View B ,View C to Main Outbound Plugs .After that call the Relevent outbound plug in the WDOINIT method in the Main View

    Add comment
    10|10000 characters needed characters exceeded

    • Although Navigation Plugs are the correct normal approach, please note that there is also a pure coding approach also. This way not all navigation plugs have to be defined in advance, allowing for really dynamic navigation. For this you can use the method do_dynamic_navigation of the view API:

      data:
          l_api_main type ref to if_wd_view_controller.
        data: target_component_name type string,
              target_view_name      type string,
              source_plug_name      type string.
         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.

      This method even allows you to call external components without declaring a component usage.

  • avatar image
    Former Member
    Jun 22, 2008 at 11:25 AM

    hi Vikranth, it's great! Thank you!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 03, 2008 at 02:24 PM

    HI Thomas Jung,

    This is very helpful! Thank you very much all the same!

    Add comment
    10|10000 characters needed characters exceeded