cancel
Showing results for 
Search instead for 
Did you mean: 

Setting default view dynamically

Former Member
0 Kudos

Hi All,

I have a requirement wherein I have 5 different views and 1 window in single Webdynpro component. None of the view is set as default statically in the design, i.e, the window is empty, it will not hold any view statically.

Now I need to set the views as default dynamically based on some condition.

i.e,

When a person clicks on the URL of this application in portal then it needs to check whether a URL parameter is passed with value.

If yes, then the user id should be checked against user master table and the role should be fetched.

Based on the role of that particular user, the view should be embeded dynamically inside the window.

The point here is I should not set any view as default view in window statically. When the application opens in the explorer then dynamically the view should be assigned at the time of window initialization itself.

Please let me know if it is possible to achieve this requirement.

Thanks

Subathra

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I would suggest you to create 5 outbound plugs from window to each view.

Now based on the condition or user Role in HANDLEDEFAULT fire the appropriate outbound plug.

Regards,

Feroz

Former Member
0 Kudos

By the time the execution control comes to HANDLEDEFAULT method, the DOINIT method would have got executed and the initial Window screen would have launched....in my case since there is no view in the window am getting an empty screen in the output.

Former Member
0 Kudos

Hi,

In window,drag and drop ur view that contains all the View Container UI element for 5 views

In turn inside the View Container UI element ,drag and drop all ur 5 views individually.Since u wud

hav handled visibility for the VC in ur HANDLEDEFAULT method,it ll only display one of ur view

at a time based on the condition.

Or u can try dis one tat i hav mentioned already in dis thread.

lr_rr_window->SET_DEFAULT_ROOT_VUSAGE(

VIEW_USAGE_NAME = str ).

Thanks,

Divya.S

BrajeshKumar
Explorer
0 Kudos

Hi,

I have tried with below code to set dynamic default view in single window, but its not working, but another approach is also fine, but how to achieve with below code..

data: lr_window type ref to if_wd_window_controller.

data: lr_rr_window type ref to if_wd_rr_window.

data : lr_usage type ref to IF_WD_RR_VIEW_USAGE.

data str type string.

lr_window ?= wd_this->wd_get_api( ).

lr_rr_window = lr_window->GET_WINDOW_INFO( ).

"Based on ur condition, pass the view name to <view_name>

lr_usage =

lr_rr_window->embed_view( USED_VIEW_NAME = '<view_name>'

USED_COMPONENT_NAME = '<Comp_name>'

).

str = lr_usage->get_name( ).

lr_rr_window->SET_DEFAULT_ROOT_VUSAGE(

VIEW_USAGE_NAME = str ).

can any one please explore on this issue to fix it...

Thanks in advance.

Best Regards,

BK Kushwaha.

Former Member
0 Kudos

Hi Divya,

You have asked me to control the visiblity of the view based on the condition in DOINIT method of the window. But I can check the condition only by getting the parameter value in HANDLEDEFAULT method.

Actually DOINIT method of window will be executed even before HANDLEDEFAULT method executes. So I need to control the visibility or embed the view inside window only after processing HANDLEDEFAULT method. Is there a way to do that?

Thanks in advance.

Thanks,

Subathra

Former Member
0 Kudos

HI,

In that case,wy dont u control visibility inside

HANDLEDEFAULT event handler itself?

Thanks,

Divya.S

Former Member
0 Kudos

Hi,

Or u can embed the view to the window using,

data: lr_window type ref to if_wd_window_controller.

data: lr_rr_window type ref to if_wd_rr_window.

data : lr_usage type ref to IF_WD_RR_VIEW_USAGE.

data str type string.

lr_window ?= wd_this->wd_get_api( ).

lr_rr_window = lr_window->GET_WINDOW_INFO( ).

"Based on ur condition, pass the view name to <view_name>

lr_usage =

lr_rr_window->embed_view( USED_VIEW_NAME = '<view_name>'

USED_COMPONENT_NAME = '<Comp_name>'

).

str = lr_usage->get_name( ).

lr_rr_window->SET_DEFAULT_ROOT_VUSAGE(

VIEW_USAGE_NAME = str ).

Thanks,

Divya.S

Former Member
0 Kudos

Hi,

In addition to five views,

create another view with a transparent container UI element and drag n drop all the five views inside.

Then by controlling the visibility based on ur conditions,one can dynamically make one view to

be displayed as Intial screen.

Refer to this link,

Thanks,

Divya.S