cancel
Showing results for 
Search instead for 
Did you mean: 

How VIEW connects to CONTROLLER ?

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

sreemsft
Contributor
0 Kudos

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

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks All.

Former Member
0 Kudos

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

Former Member
0 Kudos

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