Methods in the Component controller

Hello,
When is better call a method in the component controller, than run only a viewu2019s method?
In other words, what kind of methods should to be in the component controller and what kind of methods should to be in the view?
Could you give me some examples?
Regards
Janeth

hi
The EventHandler methods like on Action<actionname>() and methods to fire plugs we will generally used in view controllers.
If we want to intialise any attributes we will do it in WdDoInit() method of view Controller.
Generally its not preferrable to write business logic which is used by many components like service contoller generated methods in a view.
Its a good way to use Service Controller methods like execute<bapiname> in Component Controller.
For Dynamic Generation of UiElements we will use the WdDoModifyView(..) we use it in View.
Regards
sowmya.

Similar Messages

  • Calling a method in the view controller from the component controller

    Hi
    Is there anyway to call a method in the view implementation from the component controller??
    Thanks
    jack

    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

  • How to consume a method on the interface controller from another component?

    Hello,
    I have a project which contains two Components, A & B.
    I have exposed a method at the interface controller of Component A. How can I consume it from Component B?

    Hi,
       First add ComponentA as a used webdynpro component in ComponentB. Then open the Interface Controller of B and switch to Properties Tab. Select Add in the "Required Controllers" section. From the dialog that appears, select A's interface controller. Then you can access A's method from B's interface controller as:
    wdThis.wdGetAComponentInterface().<method>;
    Regards,
    Satyajit.

  • Assistance class not instantiated in the component controller of an ABAP WD

    I have a very weird problem when trying to launch an ABAP webdynpro I get a short dump, looking into it the assitance class does not get instantiated properly so it falls over.  It used to work, but I don't think I have substantially changed anything with the assitance class just on the layout, although something must have changed.
    In the constructor of the component controller it trys to cast (I think that is the correct term)  the assistance class from the compoent controller as below, Me->f_Alter_Ego->assistance_class is initial so that fails, it then tries to create the assistance class and falls over on create object Me->f_Assist.
      try.
        Me->f_Assist ?= Me->f_Alter_Ego->assistance_class.
      catch cx_sy_move_cast_error.    "#EC NO_HANDLER
      endtry.
      if not Me->f_Assist is bound.
        create object Me->f_Assist.
      endif.
    Extract from the short dump below.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "/1BCWDY/4LYS0NWZ8L8ENKKA93YQ==CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
        The following syntax error occurred in program
         "ZCL_WD_USER_MAINT=============CP " in include
         "ZCL_WD_USER_MAINT=============CM004 " in
        line 7:
        "You can only use "class=>method" with static methods."
    Other ABAP web dynpros in our system are fine.
    I have tried the obvious stuff like removing the assitance class from the WD component and putting it back in again.
    There is obviously somehting I am missing can anyone point me in the right direction or has experienced this before?
    Thanks,
    Tim

    Thanks Thomas,
    I could not see the wood for the trees on that one, I had syntax checked the assitance class ZCL_WD_USER_MAINT, however, that error would have been raised at runtime.
    Anyway all sorted now.
    Cheers,
    Tim

  • 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

  • Copying methods from one component controller to other ?

    Hi,
    I have many methods in one component controller, which i wish to copy to another component controller through standard buttons. When i try to copy them, it says 'The method or methods are copied to the clipboard'. But, i was unable to copy them to another component's componentcontroller. It says as 'The clipboard' doesnot contain data. Can someone help me in providing solution in copying all the methods in one shot to other ?
    Thanks & Regards,
    Gaurav.

    Hi,
    I think You are trying it to paste after making new method in the other component directly with the help of Cntrl+V
    I am able to do same by using copy and paste buttons.
    First go to method tab and copy it then go in methods tab in which you want to paste click where we create for new method and click standard button for paste.
    By this way the name of the methods will be same. But if you want that you can rename it.
    I hope it helps.
    Regards,
    Rohit

  • Reference to the component controller in the window

    Hello All,
    Can we get the reference of the component controller in the method of the window..
    Warm Regards,
    Smita

    Vinod..hard luck ...!!!...
    This is what i get..!!!...The interface IF_POWL_TABLE has no such method to retrieve the reference for the component controller...:-(....
    Web Dynpro Comp. / Intf. POWL_TABLE_COMP,Web Dynpro Window POWL_TABLE
    Pre-Exit PST46K50FS40BKOKLYAGE0SR3P6M for HANDLEDEFAULT
    Method "GET_COMPONENTCONTROLLER_CTR" is unknown or PROTECTED or
    PRIVATE.
    Web Dynpro Comp. / Intf. POWL_TABLE_COMP,Web Dynpro Window POWL_TABLE
    Pre-Exit PST46K50FS40BKOKLYAGE0SR3P6M for HANDLEDEFAULT
    Method "GET_COMPONENTCONTROLLER" is unknown or PROTECTED or
    PRIVATE.
    Web Dynpro Comp. / Intf. POWL_TABLE_COMP,Web Dynpro Window POWL_TABLE
    Pre-Exit PST46K50FS40BKOKLYAGE0SR3P6M for HANDLEDEFAULT
    Method "GET_COMPONENTCONTROLLE_CTR" is unknown or PROTECTED or
    PRIVATE.

  • How to work with the component controller.

    I Created a Z component.
    In that component controller i ceated a context node by using value node with BUT000 with the attribute NAME_ORG1.
    I created a view in the same component.
    In the view i created a Context Node BUT000 wiht NAME_ORG1.
    I bind this view context node with compnent controller context node.
    I want set the value from the view context node to component controller context node. How it is possible?
    I created another Z component.
    I created compoent controller like same context node above.
    I created the view also.
    I want display the first compoent controller data in the second component controller.
    How it is possible.
    For one component to another component we can pass the data based on component controller only?
    Please give me how i can set/display the component controller context node with the data?
    Thank You.
    Regards,
    B. Krishna.

    Hi Manish.
        Thank you for reply Manish. I need some more information.
    I created ZCOMP1 with view V1 and ZCOMP2 with view V2.
    In both component controllers I created Context node by usng NAME_ORG1 of BUT000.
    I provide the Navigation link from ZCOMP1 to ZCOMP2 as well as ZCOMP2 to ZCOMP1.
    In Run Time Repository I provied two components as a INTERFACE VIEWS and
    I provide ZCOMP2 as component Usage in ZCOMP1 as well as ZCOMP1 as a Component Usage in ZCOMP2.
    Now, what ever data I entered in ZCOMP1 like NAME_ORG1 is "HELLO" then
    This infomation I want display in ZCOMP2 - V2.
    In ZCOMP2 method  wd_usage_initialize
    I write like this.
    IF IV_USAGE->USAGE_NAME = 'CompUsage'.
        iv_usage->bind_context_node( iv_controller_type  = cl_bsp_wd_controller=>co_type_component
                                       iv_target_node_name = 'BUT000'       
                                       iv_node_2_bind      = 'BUT000' ).    
      ENDIF.
    But it is displaying the Exception like this
    Cannot display view ZCOMP2/MainWindow of UI Component ZCOMP2
    An exception has occurred Exception Class  CX_BSP_WD_INCORRECT_IMPLEMENT - The view controller or custom controller "" was implemented incorrectly 
    Method:  CL_BSP_WD_COMPONENT_USAGE=>IF_BSP_WD_COMPONENT_USAGE~BIND_CONTEXT_NODE 
    Source Text Row:  24
    Please tell me how to solve this Problem.
    Regards,
    B. Krishna.

  • Private method in the comp controller

    HI
    How do ui declare the private method in the componenet controller and declare the parameter one as the node and other as structure, when i click on methods tab it declears the public method with green logo in the implementation view, while i need to define a private method that should reflect with the red like logo in the outline view , when i click implementation tabr
    rgds
    Akeel

    you can write the private method in hte end of the implementation in the other hooks
    //@@begin others
    //write the code here
      //@@end
    Regards,
    Sarbjeet Singh

  • Mapping one node in a view context to many nodes in the component controlle

    Hi guys,
    I need to map an element (attribute) of a node in the View Context to an attribute of multi nodes of the same type:
    Context View:
    customer_no
          |
          | -> KUNNR
    Component Controller Context having two nodes:
      - Node1
         RFC1
            |
            |->KUNNR
      - Node2
          RFC2
             |
             |->KUNNR
    Above I need to map the (KUNNR) in customer_no node to KUNNR in the RFC1 RFC2 before i execute the two RFCs services.
    Note:
    if this is not possible would you mention another solution.
    Thanks,

    Hi,
       As per MVC you cannot map context from view controller to component controller.Mapping can happen from component
    controller to view controller.
    You cannot create mapping for context attributes. You can map nodes if both source node and destination node both has same structure and same number of attributes. If they dont contain same number of attributes the extra attributes from the source node gets copied to the destination node.
    In your case before the RFC execution you can read the value of attribute Kunnr from view and set it the RFC attribute Kunnr before the Function module execution.
    Regards
    Bala Baskaran.S

  • Problem in transporting the component Controller

    Hi Friedns,
    We had a problem when transporting a WD Componenrt controller. Til Quality it when ok. But when the transport reached to production we saw that from the attributes tab of the Componenrt controller the WD_ASSIST WAS MISSING . Due to which it was giving a dump. We recreated a new transport and sent it but that didnt worked to .
    Can anybody advise any solution. In the dump it is saying Component ZBASE_RATE CONTAINS SYNTAX ERRORS.
    THANKS
    Rohit

    Hi,
    It might be difference of the environments in ur quality and production systems.
    Check whether both systems are having the same level of webdynpro patches.
    You can check with ur basis people for this clarification.
    Regards,
    Veerendra Nath

  • What is the use of Component Controller in WD4A

    Hey Folks,
                   I have been reading tutorials and notes on WD4A.I understood basic architecture of WD4A but still i cant understand details of different Controllers like components controller,custom controllers,interface controllers etc.In which methods of controller i should code??.

    Hi Nirad,
    Controllers are heart of WebDynpro Components, since programming logic and data are defined in these entities.
    For example: ComponentController is accessible from all the views and windows in the WebDynpro Component. Hence we can declare the Attributes, context and the methods in the component controller which can be accessible in all the other controllers present in the WebDynpro Component.
    You can also find more information about controllers in the thread:
    Re: Controllers
    Best regards,
    Suresh
    Message was edited by:
            Suresh Honnappanavar

  • WD ABAP: call dialog window from component controller method

    Hi all,
    I need to call a dialog box from a method in the component controller. It would be helpful if u could post the code too.
    Thanks,
    Sravanthi

    Hi Maksim,
    this is the code i wrote:
    DATA: api_component  TYPE REF TO if_wd_component,
          window_manager TYPE REF TO if_wd_window_manager.
    api_component = wd_this->wd_get_api( ).
    window_manager = api_component->get_window_manager( ).
    wd_this->window = window_manager->create_window(
               window_name = 'OPTIONWD'
               close_button = abap_false ).
    wd_this->window->open( ).
    When i test it, this is the error i get.
    "An Instance of the View OPTIONWD Already Exists in the Component"
    how do i correct it?
    Thanks,
    Sravanthi

  • 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

  • Calling a method in view from component controller?

    Hi,
    Is it posible to call a method that is defined in the Component Controller in the View?
    If it is posible please give some sample code how to call the method?
    Regards,
    Padmalatha.K

    Padmalatha, all the methods defined in a controller from 'Methods' tab are instance methods. An instance method defined in a component controller is callable from any view controller that holds a reference to the component controller.
    Defining methods between the tags
    //@@begin others
    //@@end
    is useful if you want to declare static methods.

Maybe you are looking for