cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Components and Dynamic Views

Former Member
0 Kudos

Hi All.

I just started learning WD4A a couple of months back, and have immediately been faced with, what seems to be, a daunting task.

We have to make an application which will embed components (and their views) dynamically into the main (calling component). The no. of components to be inserted is absolutely dynamic and is fetched from the custom table.

To elaborate, let's say there is a sales order creation form.

This form is empty initially. There are various components - like Vendor master, items data, address data, customer data, bill data etc.

To further complicate, what components will be shown vary from country to country. So it is all maintained in a customizing table.

How to achieve something like this?

Please give your valuable advice.

Thanks in adv.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I was trying out something like this (test case):

I made an interface (ZDYN_INT) with an empty view I0.

Then I made a component (ZDYN1) implementing this interface. I name the window as I0 and insert the view of this component into the window I0.

Now, in my main component (ZDYN_MAIN), i declare usage of ZDYN_INT.

In this init method, i instantiate my dynamic component (ZDYN1)

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

wd_this->usage1 = wd_this->wd_cpuse_usage1( ).

l_ref_cmp_usage = wd_this->usage1->create_comp_usage_of_same_type( 'USAGE2' ).

Now in the view V0_MAIN of the main component, I write following in modifyview:

DATA: l_view_controller_api TYPE REF TO if_wd_view_controller.

IF NOT first_time IS INITIAL.

l_view_controller_api = wd_this->wd_get_api( ).

l_view_controller_api->prepare_dynamic_navigation(

source_window_name = 'W0' "Window of the main comp

source_vusage_name = 'V0_MAIN_USAGE_1'

source_plug_name = 'OUT_V0'

"Outbound plug i created in V0_MAIN

target_component_name = 'ZDYN1'

target_component_usage = 'USAGE2'

target_view_name = 'I0'

target_plug_name = 'DEFAULT' target_embedding_position = 'V0_MAIN/VIEW_UI' ).

"VIEW_UI is the ViewcontainerUI element in my View.

ENDIF.

But I don't see any output. No error also.

What am I doing wrong here? Any clues please?

I have not done any bindings/navigations in the windows.

Former Member
0 Kudos

I assume you have

WINDOW W0

VIEW V0_MAIN

View Container View_UI

Did you forget to include V0_main in Window W0 ?

Cheers

Phil.

Former Member
0 Kudos

I got the mistake. I was not firing the event.

Silly mistake