adsense

Saturday, 9 November 2013

Architecture - BSP Application with Controllers and Views / Components

Architecture - BSP Application with Controllers and Views  

§From SAP Web AS 6.20, you can combine controllers and views in a BSP application. You navigate between the controllers and any pages that exist using redirect. Each controller can have one (or several) model(s).
§You can use redirect to navigate between the controllers using a call. 
 

BSP Application with Several Views per Controller 

§An individual controller can also call several views – either sequentially after each other or alternately.  With this example, you always access it using a controller.
  
 

Combination of the Previous Examples 
  

§Central distribution can be carried out by a superior controller, so that each view is controlled by exactly one controller.
  
 

Calling Controllers of Other Applications
  

§A call can be made to other BSP applications
  
 
Components 

§A component consists of a controller, whose class is derived fromCL_BSP_CONTROLLER2, as well as one or more views, which can result in regular nesting.
§Controllers
§One or more views
§Model
§
 


Controller

 
 

§The controller interprets and monitors the data entered by the user, causing the model or the view later to change if necessary. Input data is forwarded and changes to the model data are initiated. The controller uses the model methods to change the internal status and then informs the view about this. This is how the controller determines reactions to the user input and controls processing.
§Controller is a class whose base class is CL_BSP_CONTROLLER2.
§If you create your class directly from the Web Application Builder by double-clicking on the class names, then the inheritance of CL_BSP_CONTROLLER2 has already been configured.
§Overwrite some of the methods of your class, especially DO_REQUEST.
§Save and activate your class and your controller
§Following slides explore more into the class CL_BSP_CONTROLLER2 and its method
§
§
 

Class CL_BSP_CONTROLLER2
 

§Overview
§Class CL_BSP_CONTROLLER2 is used to create controllers and components. Every controller class automatically inherits all methods and attributes from this central basic class.
§Class CL_BSP_CONTROLLER2 enables you to:
§Retain a list of sub-controllers
§Create unique IDs for the sub-controllers, where the sub-controller is assigned the controller ID prefix
§Use models
§Forward data to the correct controller as well as fill model classes (if they exist)
 

Class CL_BSP_CONTROLLER2  - Methods
 

§The individual methods can be separated into different categories:
§Methods where overwriting is required
§DO_REQUEST is the central method in a controller class,this method is called for every request. This method does the “main work”; in particular it should branch to the correct view.
§DO_REQUEST can be used in two different areas:
§If it is the top-level controller of a component, then this method handles both input and output processing.
§If it is a sub-controller of a component, then this method only handles output processing.
 

Class CL_BSP_CONTROLLER2  - Methods
 

§Methods where overwriting is recommended
§You should overwrite these methods in order to determine input processing. 
§
 

Method
Description
DO_HANDLE_DATA
Reacts to user input. Processes data input for this component.
DO_HANDLE_EVENT
Reacts to user input. Processes events if the component contains them.
Exactly one view controller is called to handle the event, which contains an event such as a save button, for example.
DO_FINISH_INPUT
Ends the input processing.
 

No comments:

Post a Comment