cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with embed a view dynamically in a ViewContainer.

Former Member
0 Kudos

Hi

I found best article about dynamically embed view (without need adding used components).

etc.

http://scn.sap.com/community/web-dynpro-abap/blog/2013/01/07/navigation-from-one-component-view-to-o...

http://scn.sap.com/thread/1161579

The main part code is:

CALL METHOD LV_NAV_SERV->DO_DYNAMIC_NAVIGATION
           EXPORTING
             SOURCE_WINDOW_NAME        = 'ZWDA000' "my windows form I start
             SOURCE_VUSAGE_NAME        = 'MAIN_USAGE_0' "my view usage copied from Windows main
             SOURCE_PLUG_NAME          = 'DEFAULT' "used default value?
*            PLUG_PARAMETERS           =
             TARGET_COMPONENT_NAME     = 'ZWDA001' "my application who I want show
             TARGET_COMPONENT_USAGE    = 'ZWDA001' "same as above
             TARGET_VIEW_NAME          = 'MAIN' " view name of sub-application who I want show
             TARGET_PLUG_NAME          = 'DEFAULT' "used default value?
             TARGET_EMBEDDING_POSITION = 'MAIN/VCO_APP' "MAIN is view of SOURCE component / VCO_APP is ViewContainerUIElement
*          RECEIVING
*            COMPONENT_USAGE           =
            

I have a main application ZWDA000 and sub-application ZWDA001, ZWDA002, ZWDA003 e.g.

Each sub-application have a minimal 2 view (LOGON and MAIN). And component name is equal with Windows name. Sub-application have only one Windows.

Main application have many view (LOGON and MAIN, CHANGE e.g.). And have more Windows. Main windows have same name as component name (ZWDA000). This application has in MAIN view under ROOTUIELEMENTCONTAINER created VCO_APP type ViewContainerUIElement.

In main application I want show only MAIN view from sub-application.


I got this error

Instance of the view MAIN already exists in component

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Looks like your view usage name is incorrect here.

SOURCE_VUSAGE_NAME        = 'MAIN_USAGE_1' " see in properties the View usage name.

SOURCE_PLUG_NAME          =   'TO_OUT'   "Enter the Out bound plug name of your main view



hope this helps,



Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

I try your advice, but I got same result "Instance of the view MAIN already exists in component".

May I same name of view in application? (because each application have a view with "MAIN" name)

Thank you

former_member184578
Active Contributor
0 Kudos

Hi,

In your Target View name, you need to use the Interface View name( Window name) not the MAIN view.

  TARGET_VIEW_NAME          = 'ZWDA001' Interface View name of sub-application 



hope this helps,



Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

You have right with

TARGET_VIEW_NAME = 'ZWDA001'


but in ZWDA001 I have

WINDOWS

  • ZWDA001

and View:

  • MAIN
  • LOGON - this I set as default


But I want show "MAIN" view - not "LOGON" view.

What I can set, when I want show MAIN view from ZWDA001?


Thank you very much

former_member184578
Active Contributor
0 Kudos

Hi,

In that case create a Window say ZWDA001_W and then place the MAIN view in that Window and then pass this Window as TARGET_VIEW_NAME.

hope this helps,

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

With new Windows it working

Thank you very much

Former Member
0 Kudos

Hi Kiran Kumar Valluru

May I pass parameters between view of different controls?

I need pass parameter between ZWDA000 view MAIN (Windows ZWDA000) and ZWDA001 view MAIN (Windows ZWDA001W)?

Thank you

former_member184578
Active Contributor
0 Kudos

Hi,

You can pass it via plug parameters and you need to get those parameters in the window of target view component. Or the best way is to share the data between components in a singleton class.

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

Can you give me example about this?

Thank you

former_member184578
Active Contributor
0 Kudos

Hi,

There are discussions available in SCN. You can just create a class with required method( & attributes static) and then set the parameters by calling the method of the class in the source Component and then read the parameters/data in the target component.

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

Yes, i look about singleton (this is a standart static class). I thinking about this, but for this is better use set/get parameter or export/import to memory?

But I maybe like use your first advice with PLUGS.

I know how read data from inbound plugs, but I don't how this set to outbound plugs. Because I can't use

l_ref_main_window->fire_DEFAULT_plg(
    p_name     =       stru_node_emp1-name

   ).


In my case I use:

CALL METHOD LV_NAV_SERV->DO_DYNAMIC_NAVIGATION
           EXPORTING
             TARGET_PLUG_NAME          = 'DEFAULT'


How set parameters with using DO_DYNAMIC_NAVIGATION?


Thank you

former_member184578
Active Contributor
0 Kudos

Hi,

 I thinking about this, but for this is better use set/get parameter or export/import to memory?

You cannot use Import/Export memory in WDA. instead you can use Shared Memory Objects. You can check this document for reference:

For your scenario its not required to use shared memory instead you can just use the singleton class.

And regarding plugs:


l_ref_main_window->fire_DEFAULT_plg(
    p_name     =       stru_node_emp1-name

   ).

When you are passing the plug parameters you need to declare the parameter name as importing parameter in the corresponding inbound plug.

So, here in your window Default plug, you can declare the parameters as importing just like the Function module parameter declaration. In your window HANDLEDEFAULT method add the parameters which you are going to pass via plugs as importing parameters.

hope this helps,

Regards,

Kiran

Former Member
0 Kudos

Hi Kiran Kumar Valluru

I found this parameter " PLUG_PARAMETERS           = l_parameter_list".

For share I use PLUGS.

Thank you very much

former_member184578
Active Contributor
0 Kudos

Hi,

It was already mentioned in earlier reply

Best Regards,

Kiran

Answers (1)

Answers (1)

Former Member
0 Kudos

I have a LOGON view in WDA000 and too in ZWDA001.

When I changed only TARGET_VIEW_NAME = 'LOGON'

I my MAIN application (ZWDA000) showed LOGON view from ZWDA000 - not LOGON view from ZWDA001!!! (TARGET_COMPONENT_NAME = 'ZWDA001')