Skip to Content
avatar image
Former Member

How VIEW connects to CONTROLLER ?

Dear Experts,

i have a very basic question for the MVC paradigm in BSP. How does the VIEW connect to the controller.

i mean Any event on the VIEW gets handled in DO_HANDLE_EVENT method of controller class, in case where there are MORE than 1 controller how do we specify Controller class1 handles all events of view1 and Controller class2 handles all events of view2.

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 17, 2009 at 09:10 AM

    Hi,

    Check this blogs by Suresh.

    /people/suresh.babu60/blog/2005/10/25/bsp-data-exchange-between-subcontrollers--part-i

    /people/suresh.babu60/blog/2005/10/27/bsp-data-exchange-between-subcontrollers--part-ii-using-oo-design-patterns

    Thanks,

    Sreekanth

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 16, 2009 at 03:54 PM

    Prasanth,

    when we create a View we specify the Controller Class that the View would connect to. This can be seen in the properties of the view. For better understanding take a look at the standard BSP's available in SAP. We specify CONTROLLER1 connects to VIEW1 and CONTROLLER2 connects to VIEW2.

    Thanks and Regards,

    Pavithra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 16, 2009 at 04:30 PM

    Hi Prashant ,

    The main method that handles the correct navigation between the controllers is the the method "dispatch_input" that we use in the DO_REQUEST of the controller.

    The view actually gets connected with the controller when we call the view using "CALL_VIEW" statement from the controller.

    Actually when you develop a htmlb application, these navigation to the correct controller is handled implicitly by the htmlb framework itself which is happening in the backend when you create a sub-controller with the "CREATE_CONTROLLER" method.

    Let me explain you with steps,

    1. Assume that there is a main controller M.

    2. From the main controller, you create 2 sub-controllers say A & B.

    3. These sub-controllers will have their own controller ID stored in the system.

    4. So assume that these sub-controllers are binded to the views say AV and BV respectively for A and B controller.

    5. When you trigger an event from the view say BV.

    6. There are something called form_fields associated with the views, which will be send to the server during the event trigger.

    7. Based on these formfields, the htmlb framework find the correct do_handle_event to trigger.

    8. This logic is written in dispatch_input method, that's the reason the dispatch_input method should be specified in the do_request of the controller if a event needs to be handled by the controller.

    Hope it helps you.

    Regards,

    Maheswaran

    Edited by: Maheswaran B on Jul 16, 2009 10:00 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 22, 2009 at 08:31 PM

    Thanks All.

    Add comment
    10|10000 characters needed characters exceeded