Skip to Content
avatar image
Former Member

Component Usage (Urgent)

Hi All,

Can a view ui container contain more than one component instance. If so at runtime can i choose any one of the instance and create the component and display it.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 08, 2006 at 04:22 PM

    Hi Mahesh,

    Regarding your question:

    > Hi Maksim,

    > Thanks for that project. I need some clarification

    > regarding the Webdynpro Component Interface which u

    > have created in the project ---> ViewContainerChild.

    > What is it and the uses of it. If ther is any other

    > examples or tutorials, please send in.

    > Mahesh

    Unfortunately I don`t know any tutorials or examples about how to use Web Dynpro Component Interfaces but I will try to explain the main idea behind: Web Dynpro Component Interface is very similar to plain Java interface - you describe some methods and after in your you class you must implement them.

    So, you can create Web Dynpro Component Interface, describe context structure, methods, events for component interface controller, create one or more Interface View Definitions and used models. Afterwards in your Web Dynpro Component you declare new created Web Dynpro Component Interface as Implemented Interface and all metadata is copied (Interface Views, Used Models, etc.) and you have to implement methods, event handlers and so on.

    In my example I use Web Dynpro Component Interface in Main component as Used Web Dynpro Component and embedd Interface View Definition to ViewContainerUIElement. But exact implementation you will specify on run-time using code:

    final String componentName = "";//full name of component including package
    final IWDComponentUsage usage = wdThis.wdGetViewChildComponentUsage(); 
    if (usage.hasActiveComponent() && !componentName.equals( usage.getComponentUsageInfo().getName()) ) {
    if (!usage.hasActiveComponent()) { 
    	} catch(WDRuntimeException e) {
    		wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);

    I hope now it is clear.

    Best regards, Maksim Rashchynski.

    Add comment
    10|10000 characters needed characters exceeded

  • May 07, 2006 at 01:49 PM

    Hi Mahesh,

    Send my mail to rastchinskym At mail DOT ru and I will reply with example which is doing exactly what you need because it is too long to describe step by step what you need to do.

    Best regards, Maksim Rashchynski.

    Add comment
    10|10000 characters needed characters exceeded

  • May 08, 2006 at 01:40 PM

    You didn't say if you were working in Web Dynpro Java or Web Dynpro ABAP. However if you are working Web Dynpro ABAP there is a very nice dynamic Navigation API that also allows you to choose a targert embedding position. This allows you to do dynamic component instances like you are describing. I don't know if a similar API is available in Java Web Dynpro or not. Here is the API call in ABAP:

    l_api_main = wd_this->wd_get_api( ).
         source_window_name  = 'MAIN'
         source_vusage_name  = 'MAIN_VIEW_USAGE_1'
         source_plug_name    = source_plug_name
         target_component_name = target_component_name
         target_view_name      = target_view_name
         target_plug_name      = 'DEFAULT'
         target_embedding_position = 'MAIN_VIEW/VIEW_CONTAINER'.
      catch cx_wd_runtime_repository.

    Although the API method needs the name of source plug, this doesn't have to be defined at designtime. It just needs you to provide a unique name.

    Add comment
    10|10000 characters needed characters exceeded