Custom vs component controller

i was trying to use component controller instead of custom controller in the Get Flight List application. but it is not working. can any one tell why?
when do we use custom controller and when component controller?

Hai vineet,
For Normal and simple applications you can use Component controller , If you are using complex application that contains more models and more views , you can share the data by using custom controllers,
can you breifly explain what's your problem is?
to get the reponses immediately post this thread on Webdynpro for java forum
regards,
Naga

Similar Messages

  • How to call Custom or Component Controller methods from View Controller

    Hy Guys,
    how do I call Custom Controller or Component controller methods from a View or Context Controlller?
    thanks in advance
    Jürgen

    Hi Juergen
    Yes it is possible, pls follow the below approach to access the component controller in context node class
    1) since the standard component controller class is protect variable , declare a variable of type component controller in your controller class.
    say for example the public variable you declared is  g_comp_controller
    2)  now redefine the controller class method WD_CREATE_CONTEXT  and add the below lines of code
       g_comp_controller ?= me->comp_controller.
    3) go to context node class  (CNXX)  there declare the varaible which of type controller class (IMPL)  as public variable, for example g_owner
    4) redefine the method  IF_BSP_MODEL~INIT  and write the below code
         CALL METHOD super->if_bsp_model~init
        EXPORTING
          id    = id
          owner = owner.
      g_owner ?= owner.
    5) now the variable   g_owner  that is declared in  (CNXX)   contains reference to your controller class
    6) in  on_new_focus  method access your component controller in the below manner and access the entities also.
    DATA: lv_owner                    TYPE REF TO xxxxx_impl,  " Implementation class
                 lr_comp_cont                TYPE REF TO xxxx_bspwdcomponen_impl, " component controller class
                 lv_entity type ref to cl_crm_bol_entity.
    lv_owner ?= g_owner.
    lr_comp_cont    ?= lv_owner->g_comp_controller.
    IF lr_comp_cont IS BOUND.
       lv_entity ?= lr_comp_cont->typed_context->mdfcampaign->collection_wrapper->get_current( ).
    now lv_entity contains the value of component controller context node.
    Thanks & Regards
    Raj
    Edited by: bmsraj on Sep 27, 2011 3:28 PM

  • Difference between custom controller and component controller

    Hi All,
    I am a beginner in CRM SAP .
    Please can anyone tell me whats the difference between custom controller and component controller with some scenario.
    I am totally baffled.
    Thanks in advance.
    Regards
    Shilpi

    Hi Shilpi,
    The main difference between custom and component controller is the role which they play during data transfer.
    a) Custom controller is used for data transfer across two views within a component. For that you need to bind view context nodes to custom controller either through wizard or manually by adding the code in CTXT class create_contextnode method:
    initial setting for depandant model node
        coll_wrapper =
          BTADMINH->get_collection_wrapper( ).
        TRY.
            entity ?= coll_wrapper->get_current( ).
          CATCH cx_sy_move_cast_error.
        ENDTRY.
        IF entity IS BOUND.
          BTOpportH->on_new_focus(
                       focus_bo = entity ).
        ENDIF.
    b)Component controller is used for data transfer across two views in two different components. For this, we need to define the component usage first and then bind the context nodes in the method-WD_USAGE_INITIALIZE of the Component Controller impl class.
        WHEN 'ComponentUsageName'.
          iv_usage->bind_context_node(
                      iv_controller_type  = cl_bsp_wd_controller=>co_type_custom
                      iv_target_node_name = 'ContextNodeName'  "#EC NOTEXT
                      iv_node_2_bind      = 'ContextNodeName' ).  "#EC NOTEXT
    Hope this clears some of your doubts!
    Thanks and Regards,
    Rohit
    P.S-This is valid for CRM 2007.Raghu is also right because Interaction Center is made up of different different components combined together.You have put your question in wrong forum.

  • Difference between Component Controller and Custom Controllet...?

    Hi
    Can any one tell me Difference between Component Controller and Custom Controllet...?
    Best Regards
    Ravi Shankar B

    Hi RaviShankar B,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/web%20dynpro%20sample%20applications%20and%20tutorials.htm
    Also refer to the below link
    Component and custom controllers
    Component Controller:-
    For each component of yours there will be a component controller, were in you can define context variables and methods, events etc.. This usefull while using models.
    Simple example where we can see this is, when you create global context variable in this controller and map this variable to the view controller context variable of different view, which enables you to pass the value of the variable from one view to another.
    Custom Controller:-
    They also have the same the function but as the name suggest there function can be customised. That is we can have more than one custom controller for a component. This is usefull when we need to create seperate execute methods for inputs from model import( Both webservice and rfc call).So you can seperate each other. Example is there in the more sample codes and application section.
    regards
    Anil Dichpally

  • Web Dynpro Tree in the Component Controller

    Hi!!!
    I made a tree in the view. But to separating the view and the model I would like to create the tree in the component controller. Therefor I copy the code from the view to the controller and adapt them, but it doesn`t work. I get the first node and that`s it. I can`t add children, although I called the responsible method.
    Some ideas????
    Greets
    Roman

    Check your mapping between view & controller (actually, view controller & custom / interface / component controller) -- it seems that you have mapped only top-level node but not children.
    VS

  • Issue in Binding Custom controller to Component Controller

    Dear All,
    I have enhanced a standard component ERP_H.
    I created a custom controller with context nodes BTSTATUS, BTSTATUSH
    I enhanced the component controller with context node BTSTATUS, BTSTATUSH
    Now when i try to bind the custom controller to component controller using this code in the context class of my custom controller
    bind to component controller
      owner->do_context_node_binding(
               iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_COMPONENT
               iv_target_node_name = 'BTSTATUS'  " component controller context node
               iv_node_2_bind = BTStatus ).
    its not working since this context node in component controller is not the standard one but the custom added one.
    Am i missing something, or is there any way to bind customer context node in custom controller to customer context node in component controller.
    regards,
    pradeep

    Hi pradeep,
        Try the other way round go to the context class in the component controller and paste the following code in the
    create_contextnode( context node = name of the node to be linked).
    *owner->do_context_node_binding(
            iv_controller_type = cl_bsp_wd_controller=>co_type_custom   <-----linking from component to custom
            iv_target_node_name = 'BUILHEADER' "target node: component controller node
            iv_node_2_bind = BUILHEADER ). "source node: current node.
    See if this works.
    Thanks

  • Difference between component controller & Custom controller

    Hi all
    what is the main difference b/w component controller , custom controller & interface controller.
    i want to know the difference of these three in the real time environment.
    if anybody explains me with any simple example then it is great help to me....
    Thanks
    Suresh babu.

    Hi Suresh,
    Component Controller and Custom Controller are more or less the same. Both are related to a particular component in the webdynpro application you create.
    Component Controller:-
    For each component of yours there will be a component controller, were in you can define context variables and methods, events etc.. This usefull while using models.
    Simple example where we can see this is, when you create global context variable in this controller and map this variable to the view controller context variable of different view, which enables you to pass the value of the variable from one view to another.
    Custome Controller:-
    They also have the same the function but as the name suggest there function can be customised. That is we can have more than one custom controller for a component. This is usefull when we need to create seperate execute methods for inputs from model import( Both webservice and rfc call).So you can seperate each other. Example is there in the more sample codes and application section.
    Interface Controller:
    There is only one interface controller for a component. It is mainly used when we need to communicate between two components.There is sample application for communication between two components in the sample codes and application section.
    Regards
    Sreedhar.

  • Diff between Component controller,Custome controller and  View controller

    hi,
        Can any body tell me the following details,
    1.difference between the Component controller,Custome controller and  View controller in WD-ABAP.?
    2.what is Lead Selection?   
    Regards,
    Ravi

    Hi Ravi.
    The component controller is visbile to all views in a component. So all context nodes and methods you create here can be accessed from all views in the component. This way you can share data between the views by mapping context nodes or thru method calls. You can also mark methods and nodes as interface so that they are acessable from other components that define component usages to this cmponent.
    Custom controller is quiet similar to the component controller. You can define it if you want to group some views with a custom controller for a certain functionality.
    If you want to access a custom controller in a view you have to define the usage first on the properties tab of the view.
    A view controller is only visible in the view itself. So all methods or context nodes you define here are only accesable by the current view.
    The lead selection is in most cases the current selected element in a context node. The lead selection is used by many UI elements to determine which element has to be shown (e.g drop down).
    If you have a table with single selection the current selected table row is the lead selection element of the bound context node.
    SO you can get the lead selection element easily in any mthod by calling context_node->get_element( ).
    Hope this clears your questions.
    Cheers,
    Sascha

  • Should i Map thecommon bapi's to component controller or custom controller?

    Hey Can any body give the clarification for this doubt
    we have one web dynpro component , It contains some views. Created some BAPIs. Now we have two different applications in the same component. So we have created the two controllers for each application. the created BAPI's are mapped to o each controllers with respect to application.   . Now we have a small doubt, the Bapis  which common are common to both application not binding to any of that two controllers. so the common bapis should be map to the component controller or created one more controller like util Controller.
    Once bapis  mapped to any of this we can add this controllers to views. Please suggest which one is better, either mapping bapi's to component controller or custom controller.
    vijay

    Hi Raj, thks for the quick responce again.  I made small mistake in the sentence.Plz look at now again
    In my webDynpro project , under that i have created only single WebDynpro component with two applications .I have two modules(applications) one is DirectCustomer and another one is InDirectCustomer. so i have set of RFS's in a single RFC model. In this RFS's some are common to both the views. some are independent to each other. so i have created two custom controllers one for directCustomer another for Indirectcustomer.Then i mapped the RFC' model objects to each custom controller seperately . But now the RFC's which are common to both views to map, Better, should i map common RFC model objects  to existing Componentcontroller(which comes by default when create the webDynpro component) or should i create new customcontroller (like commoncontroller).
    which i option is better, can u suggest me. I feel that, The common RFC's will be mapped to component controller, bcz, it the Base controller for the both customcontroller , indrectly to the viewcontroller.
    Wht is your suggestion on this disign issue?

  • Add a custom event wihtout modifying the standard in a component controller

    Hello,
    We are currently working on an enhancement in the DPR_SEARCH component. We added through an enhancement a custom button, with a specific action. Then we would like to fire an event to other components (cross-controllers interface), but we are not able to add the event definition in the DPR_SEARCH component controller, wihout modifying the standard.
    Does anyone know if it's possible?
    Thank you.
    Matthias

    Seems not possible...

  • What is CUSTOM CONTROLLER  & COMPONENT CONTROLLER

    hI ALL
    1)what is CUSTOM CONTROLLER  & COMPONENT CONTROLLER
    GIVE DIFFRENCES AND ADVANTAGES OF EACH
    REGARDS
    BABU

    Hi,
    Custom Controllers -
    A controller that can be defined by application development and used to share common data over several views. Custom controllers are defined for purposes that cannot be assigned to view controllers or component controllers, and serve as structuring element of a Web Dynpro application. Custom controllers use their context to communicate with their surroundings. They are used for manipulating data, or connecting to the back end.
    Leaving content frame
    Component Controllers-
    Each Web Dynpro component contains exactly one component controller. This controller is automatically created during the component creation and contains a context, events, and methods. Unlike a view controller, the component controller is visible for all views in a component. This means, the controllers of different component views can access context elements or methods of the component controller. For this purpose, the component controller usage is automatically created for every view controller.
    See this link for more details -
    http://help.sap.com/saphelp_erp2005/helpdata/en/eb/e1cb5eea012b4481f8077c6023a70e/frameset.htm
    The definitions explain the difference between these 2 types of controllers.
    Hope this helps.
    ashish

  • Declaring and accessing custom global attributes of component controller

    Hi,
    I want to declare some global attributes for Component Controller and initialize them in WdDoInit() method.
    I have declared them under Component Controller --> Attributes tab --> after wd_context and wd_this (say G_MESSAGE).
    However,  when I am trying to set them in wdDoInit() method, I get compilation error saying G_MYMESSAGE is unknown and its not defined using data statement.
    How do I access these attributes?
    Thanks and regards,
    Amey

    Hello Amey,
    You need to access the variable by "wd_this->g_mymessage"
    Since wd_this attribute in each controller refers to interface of local controller. you could read the description of that attribute in attribute tab.
    Regards
    Anurag Chopra

  • To fetch data from a standard component through Component Controller

    Hi,
    I have a requirement in which i have to access and display a standard view of a standard component in a Custom Component.
    I am able to display or configure that view on Custom Component by using Component Usage and Component Interface. But unable to populate the data in that view. Although i have exposed a context node in the standard component and created the same context node in my custom component in the Component Controller and using its method WD_USAGE_INITIALIZE to bind them.Please, provide some pointers on it.
    Cheers,
    Sharad

    Hi Sharad,
               The data will show up only if you put them there. May be the standard component itself gets the data from some where else. Usually, these data are provided by the component controller. For example, the component controller contains the header entity and the used component has access to the header entity via binding and shows all item entries fetched via relations(usually this is done in on_new_focus method). If the binding is there, but no data ia available, it will stay empty.
             Check a standard main component which uses the standard component that you are using and look at how they are establishing the connections.( component/custom controller bindings, on_new_focus methods,,)
    Regards,
    Arun Prakash

  • Is it possible to serialize a web dynpro component controller?

    Hi,
    Is it possible to serialize a web dynpro component controller and deserialize it for use?
    I have one web dynpro application WDA1 for web dynpro component WDC1. And  another web dynpro application WDA2 for WDC2 will be opened in a new window triggered by a button action in WDC1.
    Iu2019d like to pass the object reference of WDC1 component controller to WDC2.
    I first tried to use a static member of a class object but found out that even the static member is initialized and set in WDC1, itu2019s still initial when I access it in WDC2.
    Then I searched the forum and found one article Passing Object ref to Webdynpro Application while calling from BSP screen .
    The recommended way is to serialize the object reference and store in a DB table, later on read it out and deserialize it for use.
    I tried serialization using the following code, but when itu2019s deserialized, the result is initial.
    Can anyone share some ideas on this?
    Serialize
      data: ostream type string,
               xslt_err type ref to cx_xslt_exception.
    ***** serialize model class
      try.
          call transformation id
          source model = wd_comp_controller
          result xml ostream.
        catch cx_xslt_exception into xslt_err.
      endtry.
    Deserialize
        data: istream type string,
              xslt_err type ref to cx_xslt_exception.
        istream = ls_db_sel-obj.
        data lr_wdc type REF TO ZIWCI_BY_WDC_SERIALIZE.
        try.
            call transformation id
            source xml istream
            result model = lr_wdc.
          catch cx_xslt_exception into xslt_err.
        endtry.

    When you say new window, I assume you mean new browser window. This is a separate user session then.  This is why the singleton pattern doesn't work.  Have you considered using a new dialog window instead of a new browser window.  It will be modal, but will share the same user session as the parent window.
    >Why do you choose this approach over cross-component usage ? component usage is the way webdynpro components are >to be reused.
    >You can also consider using Singleton OO pattern class to share data between these two components.
    Neither of these approaches will work if you are using separate browser windows. Such an approach results in two separate user sessions (perhaps even running on different application servers depending upon how you have load balancing setup) and therefore can't share data using either of these approaches.
    In general the idea of serialization and then writing the string ito a server cookie or other database table is sound.  I don't think you should try and serialize the component controller, however.  Serialization only saves and restores public attributes - not protected or private ones.  So in general a class has to be designed for serialization.  The component controller is much too complex and wasn't designed for such an operation. 
    I would suggest instead extracting the data you want to share out of component controller or context and serializing it into a custom class and passing that to the other component.

  • Calling a method in the Custom ADF component from JSF page

    HI.
    I have created some custom compoents by extending the core ADF Components. Like i have a ComboBoxDefault component with it's ComboBoxDefaultTag.java and Controls.tld file.
    Now my requirement is i want to bind my label to this component from the JSF page. like
    <fwcontrols:label binding="#{listComponents.comboBoxDefaultLabel}" id="label1"/>
    <fwcontrols:comboBoxDefault binding="#{listComponents.cmbLocales}"
    value="en_GB" id="comboBoxDefault" autoSubmit="true" label="label1">
    <f:selectItems value="#{listComponents.locales}"/>
    </fwcontrols:comboBoxDefault>
    In my JSF page the label will have an id, and that id will be specified in the label tag of the component.
    In Tag.java file i have overrided the setProperty(FacesBean facesBean). In this method i have bind all my properties. In core JSF the setProperty method is provided with the UIComponent parameter, so i can call my method in component also. Which is not in case of ADF Faces.
    My main point is how i can call my method setLabel() which is in ComboBoxDefault.java so that i can set the label.
    Thanks in Advance.

    Thanks for all your replies. I want this kind of a functionality because Im trying to invove a DC (Child DC) from a Parent DC such that the Child DC's view is displayed onto the view container of the Parent DC. I have embedded using 'interface view of a component instance' in the Parent Window and am able to create the component and set usage though the onPlugDefault of the Child View.
    But I observe that when i make a call from the parent, the flow is like this:
    1. The wdDoInit of the Child Component Controller gets triggered first.
    2. Then the wdDoInit of the Child's <b>VIEW</b> gets triggered
    3. and <b>THEN</b> the onPlugDefault of the Child Component Interface View
    What I had actually wanted was to Fire onPlugDefault where Im calling a method LoadData(), after which the Child DC's view must be triggered so it can display the fetched data.
    What is actually happening is the view gets displayed, but no data is displayed in the view.
    Right now I have just given a work around where Im triggering <b>LoadData()</b> of the <b>COmponent COntroller</b> from the <b>wdDoInit</b> of the <b>VIEW</b>.
    Is there a better way to do this? I find it strange that I have to load the Data from the view.
    Thanks
    Jack

Maybe you are looking for