The different types of controllers in webdynpro ABAP are:
Before learning about the Controllers let us know something about different types of interfaces that are created at the time of the creation of the component. These interfaces are as below.
The interface begins with the prefix IF is local and can be used for coding only within that controller.
The interface begins with the prefix IG is used for cross controller communication. (E.g View controller to component controller)
The interface begins with the prefix IWCI is used for cross-component communication. (E.g. componentA to ComponentB)
Component Controller:
There is only one component controller that exists per webdynpro component and it is global. i.e Component controller consists of data and processing logic that is available to all the views in the component. This controller does not have any visual interface. The lifetime of the component controller is the lifetime of the component.
Components of Component:
Properties:
In the properties tab of the component controller, we can declare the component usage of the other component so that the interface methods of that component can be accessed by the methods of the component controller.
Context:
A context is a hierarchical form of storage of data which we will briefly study about it in the upcoming posts. And for now, context is a place where you declare the data. The Nodes declared here can be mapped to any no of view and can be accessed from there hence making the data of the component controller global.
Attributes:
The attributes required by the Component controller are declared in the attributes and are accessible to the methods of the component controller using the handle provided for the component controller(WD_THIS). These attributes can also be accessed from different controllers using the handle provided for the component controller(WD_COMP_CONTROLLER) in the respective controller. The attribute WD_THIS declared in any controller refers to the interface of the current controller and the attribute WD_CONTEXT declared refers to the corresponding context of the controller.
Events:
Events can be created in components and custom controllers. Events created in the component controller are visible only within the component which means it can only be triggered by the methods of the component controller. But it can be handled in different controllers. Thus Events are used to communicate between the controllers and enable one controller to trigger the event and handler the event in different controllers. Events can also implement cross-component communication provided that the interface checkbox is checked.
Methods:
The components controller consists of a number of predefined methods called to hook up methods that are executed in a pre-defined manner. We will study these hookup methods in the later posts. We can also create the methods on our own and the methods which we created can be called from any controller using the handle for the component controller(WD_COMP_CONTROLLER).