Entering content frame

Object documentation Controllers Locate the document in its SAP Library structure

Definition

Controllers are the active parts of a Web Dynpro application. They determine how the user interacts with the Web Dynpro application. The data that a controller can access is defined in the corresponding context. Different instances of controllers and contexts exist within a Web Dynpro application. In addition to view controllers, which control the behavior of an individual view, there are also global controllers that offer more general services for all the views of a component.

Use

Controllers

Each view has exactly one view controller, which processes the actions performed by the user in the view. A view also has exactly one view context, which contains the data required for the view.

This graphic is explained in the accompanying text

A view controller, and therefore also the corresponding context, normally exists for as long as the view is displayed in the browser. If the view is replaced by a successive view, the local data is also no longer available.

This graphic is explained in the accompanying text A view that is available, for example, in the form of a tab page as a part of a view set in the background, is visible in a technical sense, and its data is available as before.

 

Each Web Dynpro component also has superordinate controllers that are visible for all views of the component. One of these controllers is known as the component controller. The component controller is automatically created when a new Web Dynpro component is created. The lifespan of the data for this component controller covers the whole period during which the component is in use. You can add further component-wide controllers in the form of custom controllers. These also last as long as the component itself, and the data they contain is available to all views of the component.

Each Web Dynpro component also has two further controllers that enable communication with other components as a part of the component interface. These are the configuration controller and the interface controller. For more information on both these controllers, see the unit Web Dynpro Component, section The Interface of a Web Dynpro Component.

The four controllers that are visible in the whole component (component controller, custom controller, configuration controller, and interface controller) are called global controllers.

This graphic is explained in the accompanying text 

Communication from one controller to the next is achieved by calling methods from a different controller, or by triggering an event on which other controllers are already registered. You define these uses when you create a controller.

Source code

Each controller contains program areas in which you can insert your own source code. Therefore, an Application Programming Interface (API) exists for the processing of context nodes and their attributes and data. The necessary initialization of nodes can also be executed using this API. There are further APIs available, for example, the server abstraction layer for accessing the system environment, and the APIs for message handling and dynamic programming.

Controllers can contain their own source code in the following areas:

·        Event handlers – these are executed when a view is initialized, ended, or entered, when a user interface element of a view triggers an action, or when other controllers trigger a registered event

·        Methods – these can be called by other controllers

·        Supply functions – these are executed when necessary to initialize elements in the context

 

 

Leaving content frame