cancel
Showing results for 
Search instead for 
Did you mean: 

override default view with dynamic navigation

kroly_horvth
Participant
0 Kudos

Hi,

I have an URL parameter, based on what I do a dynamic navigation

wd_this->wd_get_api( )->if_wd_navigation_services~do_dynamic_navigation()

in the WINDOW DEFAULT inbound plug.

However the navigation is overridden by what is set as a default view in the WINDOW tab.

I tried

      lr_window_controller = wd_this->wd_get_api( )->get_embedding_window_ctlr( ).
       lr_rr_window = lr_window_controller->get_window_info( ).
       lr_view_usage = lr_rr_window->get_view_usage( 'MAIN_USAGE_0' ).
       lr_view_cnt_assignment = lr_view_usage->get_view_cnt_assignment( 'FUNC_VCA_1' ).
       lr_view_cnt_assignment->set_default_view_usage( 'NOTDEFAULTVIEW_USAGE_1' ).

but not helping, still the default view is appearing. FUNC_VCA_1 in the above code is a view_container, I am trying to set a view active inside that view container.

Any ideas?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

kroly_horvth
Participant
0 Kudos

Guys, there are some confusions here. Take the following case:

1) Embed both COMP_A/VIEW_A and COMP_B/VIEW_B into a view container, and set COMP_A/VIEW_A as default

2) Create a navigation between outbound plug TO_VIEW_B and inbound plug COMP_B/VIEW_B default plug

3) In WINDOW default, based on a parameter wd_this->fire_to_view_b_plg( ).

This works, COMP_B/VIEW_B is visible!

Now remove the navigation link, remove COMP_B/VIEW_B from the window and enter the following code in the handlefeault:

      wd_assist->m_akt_comp_usage = wd_this->wd_get_api( )->if_wd_navigation_services~do_dynamic_navigation(
           source_window_name        = 'WINDOW'
           source_vusage_name        = 'MAIN_USAGE_0'
           source_plug_name          = 'TO_VIEW_B'
*          plug_parameters           = lt_params
           target_component_name     = 'Z_WD_COMP_B'
           target_component_usage    = 'COMP_B_USAGE_1'
           target_view_name          = 'WINDOW'
           target_plug_name          = 'DEFAULT'
           target_embedding_position = 'MAIN/VIEWCONTAINER'
              ).

NWhile I do get back the navigation link and inside do_dynamic_navigation there is a code to create the component and fire the plug, COMP_B/VIEW_B is not showing. Also please note, that if I do that on a button click it works. The problem is only inside handle default method.

Thanks!

kroly_horvth
Participant
0 Kudos

I believe the problem is with

wd_this->wd_get_api( )->...


We are in the WINDOW handle default and wd_this here refers to the window, not the view, where the viewuielementcontainer resists.


If I create a TO_MAIN_VIEW and connect it with a newly created FROM_MAIN inbound plug in the MAIN view of the mans app and put the code there, then it is working, wd_this refers to the view.


So in the WINDOW handle default we have to somehow get the corresponding view api, where the components are to be embedded.

ramakrishnappa
Active Contributor
0 Kudos

Hi,

When system reaches the DEFAULT plug, this is the first point of entry for the application and no views exist at this point of time.

I suggest you the below approach:

  • Create a global attributes at component controller and store the required url information / view/plug name to be triggered inside DEFAULT plug
  • Create one MAIN_VIEW which is default in this case
  • Let us say you have other views VIEW_A, VIEW_B, etc
  • As MAIN_VIEW set as default, the WDDOINIT( ) method triggers, now you can navigate to required view based on global attributes values

Hope this helps you.

Regards,

Rama

kroly_horvth
Participant
0 Kudos

Hi,

Thanks, I made a similar approach, I fire a plug from the window default to an inbound plug of the MAIN_VIEW and do the dynamic navigation there.

Thanks!

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Please refer to the below document.

Hope this helps you.

Regards,

Rama

kroly_horvth
Participant
0 Kudos

Unfortunately not, I do navigation just fine in onActions, the problem here is that I need to navigate to a different view based on an URL parameter. I parse this URL parameter and navigate to view B_VIEW, but since in the window the default view is A_VIEW, that is shown and I cannot make B_VIEW appear.

aarif_baig
Active Participant
0 Kudos

Hi Karoly,

               As per my understanding you cannot change that once you have defaulted the view because that is what you have set in the dynpro

thanks.

kroly_horvth
Participant
0 Kudos

No, you can do that, otherwise you could not navigate onto a different view in the same view container by clicking a window.

1) Create a WebDynpro app with a component, window, view

2) Create two other components COMP_A/VIEW_A and COMP_B/VIEW_B

3) Create a view container in the original view and its window ember both COMP_A/VIEW_A and COMP_B/VIEW_B

4) One of the view is set to default (yellow line), COMP_A/VIEW_A

If I start the app then COMP_A/VIEW_A is visible.

If I fire a plug to VIEW_B in the default inboug plus then VIEW_B becomes visible.

Now since I want to do this dynamically there are no navigations, I do that with do_dynamic_navigation. In the source code of do_dynamic_navigation, it creates the component, creates links and fires the plug.

However despite the do_dynamic_navigation to COMP_B/VIEW_B it's not showing, but COMP_A/VIEW_A is showing.

If I do this dynamic navigation on a button click it's fine. It's just not working in the app window default plug.

aarif_baig
Active Participant
0 Kudos

Hi Karloy,

                I think you missed my point that is what i am trying to say when you go to windows under window you find your view if you right click on that you get an option set as default so now when you set it as default every time you start ur dynpro it will come by default, now how can you override that pls suggest, it can be helpful to me as well.

thanks.

Former Member
0 Kudos

Hi,

Create 2 different outbound plug and their respective target view being A_VIEW & B_VIEW. In your window, embed Empty view and make it as default view. But, In the Window Default event handler method, fire outbound plug, based on type of URL parameter value you read.

Hope this helps you.

Regards,
Vishnu

aarif_baig
Active Participant
0 Kudos

I agree with Vishnu this can be a workaround solution.

Former Member
0 Kudos

Hi,

The outbound plug, i referred need to be created at the window level. It worked for one of my similar requirement. In the default event handler, i am reading URL parameter and based on type of the value, firing necessary outbound plug. It worked.

Regards,
Vishnu

kroly_horvth
Participant
0 Kudos

Hi,

Unfortunately I cannot do that, since all is dynamic there is no view to set as default, it's done in the source code:

      wd_assist->m_akt_comp_usage = wd_this->wd_get_api( )->if_wd_navigation_services~do_dynamic_navigation(
           source_window_name        = 'WINDOW'
           source_vusage_name        = 'MAIN_USAGE_0'
           source_plug_name          = 'TO_VIEW_B'
*          plug_parameters           = lt_params
           target_component_name     = 'Z_WD_COMP_B'
           target_component_usage    = 'COMP_B_USAGE_1'
           target_view_name          = 'COMP_B'
           target_plug_name          = 'DEFAULT'
           target_embedding_position = 'MAIN/VIEWCONTAINER'
              ).

Thanks!

kroly_horvth
Participant
0 Kudos

it's working for me if I actually embed COMP_B/VIEW_B and create a navigation link between this window TO_VIEW_B and COMP_B's default plug.

However the code I just posted is not doing do job.

What's the difference?

ramakrishnappa
Active Contributor
0 Kudos

Hi,

You can still use the same navigation technique to achieve your requirement as well.

Please follow the below steps:

Define Navigation links static

  • Let us say your window has 2 views A_VIEW ( set as default ) & B_VIEW
  • Create an outbound plug TO_VIEW_B inside window and create navigation link to B_VIEW, similarly create navigation links for other views as well
  • Now, based on url parameter fire the respective outbound plug of window.

Define Navigation Links dynamic

Please refer the document suggested earlier, in your case define the triggering point from window based on URL parameter

Hope this helps you.

Regards,

Rama