Skip to Content
avatar image
Former Member

Determine the view during the WDDOINIT of a window

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 25, 2013 at 11:15 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 25, 2013 at 08:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded