cancel
Showing results for 
Search instead for 
Did you mean: 

Determine the view during the WDDOINIT of a window

former_member627003
Participant
0 Kudos

Hello guys,

I have 3 views and only one window in my component, I need determine wich view show be the "default view" during the initialization of the window.

This determination will depends of the role of the user that is acessing this component.

For example:

1 - reads the role of the user.

2 - The role is: "developer".

in the WDDOINIT, I need have something like this:

if role = 'developer'.

--- call view1

if role = 'admin'.

--- call view2

.....

Thanks,

Ricardo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Lets say that you have two views V1, V2, V3. You would have embedded three of them in the same window. Create inbound plugs for each of these views. After that go to the window and create three outbound plugs. Create navigation links from these outbound plugs to the three different view inbound plugs. Then in the WDDOINIT method of the window, fire the appropriate outbound plug depending on the user role.

eg:

data : test type i value 1.

if test = 1.

   wd_this->fire_to_v2_plg(   ).

else.

   wd_this->fire_to_v1_plg(   ).

   endif.

former_member627003
Participant
0 Kudos

Hello Ajith,

Your sollution is working here and was very simple!

Many thanks,

Ricardo

Answers (1)

Answers (1)

Abhinav_Sharma
Contributor
0 Kudos

Hi Ricardo,

What you can do is use the Dynamic Navigation. Create one view, lets call it Main. Embedd the view in the main window.

Now lets say you have two views - view1 and view 2. Embedd the these views in the same window.

Create an outbound plug in the main window TO_TARGET.

In the wddoinit of window you can write the below logic:

   DATA: lo_win type REF TO IF_WD_VIEW_CONTROLLER.

  lo_win = wd_this->wd_get_api( ).

if role = 'developer'.


  lo_win->IF_WD_NAVIGATION_SERVICES_NEW~DO_DYNAMIC_NAVIGATION( SOURCE_WINDOW_NAME = 'MAIN_WIN'
                                                                  SOURCE_VUSAGE_NAME = 'MAIN_USAGE_0'
                                                                  SOURCE_PLUG_NAME = 'TO_TARGET'
                                                                  TARGET_VIEW_NAME  = 'VIEW1'
                                                                  TARGET_PLUG_NAME = 'FROM_MAIN' ) .

if role = 'admin'.

lo_win->IF_WD_NAVIGATION_SERVICES_NEW~DO_DYNAMIC_NAVIGATION( SOURCE_WINDOW_NAME = 'MAIN_WIN'

                                                                  SOURCE_VUSAGE_NAME = 'MAIN_USAGE_0'

                                                                  SOURCE_PLUG_NAME = 'TO_TARGET'

                                                                  TARGET_VIEW_NAME  = 'VIEW2'

                                                                  TARGET_PLUG_NAME = 'FROM_MAIN' ) .

Hope it helps. Thanks!

Regards

Abhinav