cancel
Showing results for 
Search instead for 
Did you mean: 

Embed view in view container dynamically

Former Member
0 Kudos

Hello Experts,

I have links in my web dynpro ABAP view, when user clicks on a link I need to show another view in view container. For example I have two links in my view and when user clicks on link1 I need to show VIEW1 to the user in the view container UI element, if user clicks on link2 I need to show VIEW2. I have written the below code in Link action method. But it is not working. Any one can help in this?

DATA : lo_window_controller TYPE REF TO if_wd_window_controller.

DATA : lo_view_controller TYPE REF TO if_wd_view_controller.

DATA : lo_window_rr TYPE REF TO if_wd_rr_window.

lo_view_controller = wd_this->wd_get_api( ).

lo_window_controller = lo_view_controller->get_embedding_window_ctlr( ).

lo_window_rr = lo_window_controller->get_window_info( ).

  • Embedding view

lo_window_rr->embed_view( used_view_name = 'V_EMP_TERMINATION'

embedding_position = 'V_ACTION/VCU_CONTAINER'

used_component_name = 'ZHR_MSS_APPL' ).

with best regards

K. Mohan Reddy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi mohan ,

You written the code for embedding the view . then you have to creat the navigation link then only you can do navigation

Look at the sample code for creating the navigation link dynamically

DATA lo_navi_services TYPE REF TO if_wd_navigation_services_new.

DATA lo_api_v_main_wf TYPE REF TO if_wd_view_controller.

DATA lo_navi_services TYPE REF TO if_wd_navigation_services_new.

DATA lo_view_usage TYPE REF TO if_wd_rr_view_usage.

DATA lo_window TYPE REF TO if_wd_rr_window.

lo_api_v_main_wf = wd_this->wd_get_api( ).

lo_navi_services ?= lo_api_v_main_wf.

lo_view_usage = lo_api_v_main_wf->get_view_usage( ).

lo_window = lo_view_usage->get_window( ).

CONSTANTS lc_target TYPE string VALUE 'VIEW_MAIN_WF/VC_WF'. "viewname /view vontainer name

*Write the code for getting the view name here

if view_name is not initial

TRY.

  • lv_window_name = lo_window->get_name( ).

  • wd_comp_controller->fire_unactivate_all_pro_event( ).

wd_this->m_navi_repository_handle = lo_navi_services->do_dynamic_navigation(

source_window_name = 'lv_window_name'

source_vusage_name = lo_view_usage->name

source_plug_name = 'source_out_plug'

  • plug_parameters = lv_plug_parameter

target_view_name = lv_view_name

target_plug_name = 'FROM_Plug'

target_embedding_position = lc_target )."lv_target ).

CATCH cx_wd_runtime_repository INTO lr_error.

ENDTRY.

hope thisl piece of code is help full

regards

chinnaiya

Former Member
0 Kudos

HI Chinnaiya,

In my case I am not navigating between views or windows. I need to show in the same view. I have three views MAIN, VIEW1, VIEW2. In main view I have two links and View container. If user selects link1 I need to show VIEW1 in the view container. If user selects Link2 then I need to show VIEW2 in the view container. Since I am not navigating between the views, still do I need to write the code for dynamic navigation.

with best rgards

K. Mohan Reddy