cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in embedding view

Former Member
0 Kudos

Hi,

I have view container being dynamically generated . My requirement is to embed a standard view in it at run time.

Please help me out.

Thanks&Regards,

Narendra N Shukla

Accepted Solutions (1)

Accepted Solutions (1)

shwetars
Advisor
Advisor
0 Kudos

Hi Naren,

I would suggest you don't create the view container at runtime instead create it at design time itself and just change its visiblity property based on some condition at runtime. In this way you can avoid a lot of coding and its a better too and you woudln't have to worry about view embedding at runtime.

Regards,

Shweta

Former Member
0 Kudos

Hi Sweta,

I can't do so because the view container is inside TAB which are also being dynamically generated .

Since I don't know the number of tabs , I am going for dymanic programming.

I am getting Tabstrip , Tabs and View Container inside Tab all generated.

The only problem is to embed a standard view inside view container at Runtime.

Cheers,

Narendra

shwetars
Advisor
Advisor
0 Kudos

Hi Naren,

Check out the methods:

prepare_dynamic_navigation and do_dynamic_navigation of the interface if_wd_view_controller.

I tested with a simple scenario the code for which follows:

the scenario is i hv window main with a view v_test, at runtime i m creating a view conatiner vc1 within v_test and embedding the view v_test1 within it.

the only difference between prepare and do methods is that former just creates the navigation link where as the latter fires the outbound plug too, so in ur case i suppose the prepare method shud suffice as u can fire the outbound plug only when a particular tab is selected.

DATA: lo_api_v_test TYPE REF TO if_wd_view_controller,

lo_comp_usage TYPE REF TO if_wd_component_usage.

lo_api_v_test = wd_this->wd_get_api( ).

TRY.

CALL METHOD lo_api_v_test->do_dynamic_navigation

EXPORTING

source_window_name = 'MAIN'

source_vusage_name = 'V_TEST_USAGE_1'

source_plug_name = 'TO_V_TEST1'

  • target_component_name =

  • target_component_usage =

target_view_name = 'V_TEST1'

target_plug_name = 'FROM_V_TEST'

target_embedding_position = 'V_TEST/VC1'

RECEIVING

component_usage = lo_comp_usage.

CATCH cx_wd_runtime_repository .

ENDTRY.

Regards,

Shweta

Message was edited by:

Shweta R Shanbhag

Former Member
0 Kudos

Hi Sweta ,

Thanks for the reply.

I have been using this method (prepare_dynamic_navigation and do_dynamic_navigation ) .

But the only problem is that I am not able to identify the "target_embedding_position " since in my case embedding position is View Container which is being dynamically build at run time.

Thanks for the reply.

Cheers,

Narendra

shwetars
Advisor
Advisor
0 Kudos

Hi Naren,

Whenever you try creating the view container element, you can keep track of its position by saving the value in some attribute, because this is definitely known at design time. May be you can have an internal table to save all the postions and then read the appropriate value at the time of using prepare or do navigation, while saving the position value u can prefix it with something which you can use later for identification purposes and just use the remaining part of the string in the method call.

Regards,

Shweta

shwetars
Advisor
Advisor

Answers (0)