The component controller provides data and processing logic that it should be possible to display or change for all views of a component. It has three interfaces:
· Interface IF_<controller_name> for coding within the controller
· Interface IG_<controller_name> for cross-controller coding within the current component.
· Interface IWCI_<component_name> for cross-component coding. On the ABAP language level it represents the interface controller (see below).
Within the component, mapping is possible to any context element of the component controller. (See also Data Binding and Mapping).
The attributes of a component controller are known to all methods that are called within a component and can be used by them, provided they have the Public property. Otherwise, their visibility is restricted to the component controller. Events and methods assigned to the component controller are visible throughout the component. So, for example, any action of a view of the component can call such a method of the component controller.
The visibility of a specially marked number of methods, events and context nodes of a component controller can be extended beyond the borders of one’s own component. They then form the interface controller of the component.
The interface controller is used for cross-component communication. It defines the controller part of the interface of a Web Dynpro component. The interface controller itself does not contain any implementation.
· For the interface controller of a Web Dynpro controller, the methods are implemented in the related component controller.
· For the interface controller of a component interface definition, the implementation is performed in the component controller of the embedding component.
For every interface controller there is a related ABAP interface IWCI_<component_name> or IWCI_<Comp.Interf.Def-Name>. For information on how to use component interface definitions in programming, see Working with Component Interface Definitions.
Events, methods and context nodes of the component controller can be made visible for other components; mark the Interface checkbox to assign them to the component interface. They are then included into the related ABAP interface IWCI_<component_name>.
In the object list of the ABAP Workbench, these special component controller elements are displayed additionally in the Interface Controller node, but they cannot be changed there.
For elements of the context of a controller from another component a mapping can be defined to the elements of the component controller context assigned to the component interface.
In the object list of the ABAP Workbench, the interface controller is displayed as a separate object of the related Web Dynpro component. In spite of this fact, the interface controller of a component is implemented and edited as part of the component controller (see above).
Only if an interface controller is part of a component interface, the controller editor is in change mode and the context, the events and the methods can be implemented and edited directly.
The global interface IWCI_<Comp.Interface-Name > is stored in the class library and can be displayed using SE24.
The properties and use of the custom controller that can be added optionally correspond exactly to those of the component controller. This means that it is visible to all elements of the component and the lifetime of the elements is the lifetime of the component. The custom controller gives you the option of structuring functions and data within a component. It makes sense to create and maintain a custom controller if a certain subset of views of a component should be equipped with a special function or with a special set of data.
Layout and flow logic are very closely connected to each other in a view. As part of a view, the view controller – unlike other controllers – is therefore not edited in the Controller Editor. Instead, the necessary tools have been integrated into the View Editor, which can be used to edit the view as a whole.
Just like the component controller, the view controller contains data and functions. Furthermore, the view controller also has
· An IF_<Controllername> interface, which means that these data and functions are visible within the same view only.
The lifetime of the controller element of a view is restricted to the lifetime of the view. To create simple Web Dynpro applications, it is sufficient if you maintain the component controller and the view controller of a view. The two controllers described below are optional and help you to structure complicated components and applications, thereby increasing their reusability.
For every window created in a Web Dynpro component, a window controller is generated. Such a window controller is visible throughout the component – it behaves like a component or custom controller.
As part of a Web Dynpro window the window controller – just like the view controller – is not edited in the Controller Editor but in the Window Editor instead.