Controllers -- What they are???
Controllers are the one of the most essential concept of WebDynpro Component. Or You can say that Controllers are all in all of any WebDynpro Component. Without Controller you can't think about WebDynpro Component.
From below diagram hope you can understand the basic concept of Controller.
As you can see the diagram. A controller is something where you will implement the your logic as well there is data storage area to storage data which you will use in your implementations
So In more precise way..
Controllers are essentially ABAP classes with predefined methods, attributes and events that handle the basic functionality required based on the controller type.
Examples of the standard functionalities are:
- Hook Methods
- Event Handler Methods for Navigation and Action Events
- Attributes for local Data.
Types of Controller:
There are different types of Controller in WebDynpro framework which are
- Component Controller
- Custom Controller
- Interface Controller
- View Controller
- Window Controller
Before going further to know more about the Controllers. Let us know something about different types of interfaces that are created at the time of component creations. These interfaces are as below.
IF_<ControllerName>
IG_<ControllerName>
IWCI_<ComponentName>
The interface begin with the prefix IF is local and can be used for coding only within that controller.
The interface begin with the prefix IG is used for Cross Controller Communication.(e.g Component controller to View Controller)
The interface begin with the prefix IWCI is used for Cross Component Communication.
(e.g. ComponentA to ComponentB ) Now lets come to the Controller types..
Component Controller
This is the parent controller for the WebDynpro component. There is only one Component Controller exists as per WebDynpro component and it is Global Controller. i.e Component Controller consist of data, flow logic, Events, Methods are available to all the other types of controller.
This controller does not have any visual interface. The life time of the component controller is the life time of the component.
Components of Component controller:
- Properties

- Context
Note: In Coming post you will be understand about Context and its properties.

- Attributes
These attributes can also be accessed from different controllers as well using the handle provided for the Component Controller (WD_COMP_CONTROLLER) in the respective controller.

- Events
Events can also implement Cross Component Communication provided that the interface check box is checked.

- Methods
Note:- In coming post you will come to know more about Hook Methods

Custom Controller
Custom Controllers can be additionally created in the component and there are exactly similar to the Component Controller in terms of functionality. This means it is visible to all the Controllers. And life time of the controller is the lifetime of the component.
Any number of custom controller you can create in the component and it will provide you the option of structuring the data’s and functions. It only make sense to create a custom controller if certain function and data’s are to be associated with the specific set of views.
Components of Custom Controller:
The Components of Custom Controller, Properties, Context, Attributes are similar to the Component Controller. And only Events and Methods are differ from Component Controller.
- Events

- Methods

Interface Controller
Interface controller is used for Cross Component Communication. Interface controller itself does not contain any implementation. It is the point of contact of communication for other component to use this component. Only nodes, methods and events marked as interfaces can be used by other Components.
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>
Components of Interface Controller:
- Properties:
In the Properties tab you will be able to see the administration data and ABAP Interface that was created for the external communication (IWCI).

- Context

- Events

- Methods

View Controller
No of View Controllers in a component depends upon the no of views. The view controller cares about the view specific flow logic like checking user input, handling user actions etc & design the UI using standard UI's element. The lifetime of the view controller is restricted to the life time of the view.
Components of Interface Controller:
- Properties:

As you can see in the above screen. A component ZWD_LINK is used in view controller so you can access the methods or context data from the view controller of Component Controller. This component will be added automatically when first time you create a component. And you have to add others component in Used Controllers/Component explicitly so you able to access the functionality of other Components.
- Layout:
Layout is something which gives you feel as WYSIWYG (What You See Is What You Get). In you layout you will design the user interface using UI elements. As you can see in the below screen. Layout is divided in four parts.
- UI Elements Library (left hand side)
- View Design Area (middle)
- UI Element hierarchy (top of right hand side)
- UI Elements Properties (below of right hand side)

- Inbound Plugs:

- Outbound Plugs:
WD_THIS->FIRE_<OutboundPlugname>_PLG( )

- Context
View Controller Context is visible to the View only i.e you can not access from other controllers since View Controller doesn't allow to create interface Context.

- Attributes

- Actions

- Methods

Window Controller
Components of Interface Controller:
- Properties

- Window
Note : Don't forget to embed the View in Window when ever you created a new View otherwise you will not able to see the view in browser.

- Inbound Plugs
The properties of Inbound Plugs of Window is differ from Inbound Plugs of Window as different characteristic like Interface Exit, Suspend . You can create the different types of Inbound Plugs here like Startup, Exit, Resume, Suspend as well.
The Interface Check Box determines whether the Inbound Plug is used only for navigation within the component or cross component navigation.

- Outbound Plugs

- Context

- Attributes

- Methods

That's all about Controller. Hope you will able to understand about controllers. In coming post you will be able to understand more about Hook Methods.
And Don't forget to comment :) :)
Thanks
Hi ...Thanks for Sharing ..It will help us a lot
ReplyDelete