Web dynpro ABAP made simpler.
Q) How many types of controllers are there in a web dynpro component?
There are total 4 mandatory and 1 optional component in any web dynpro component
the four mandatory components are
1) Component controller
2) Interface Controller
3) View controller
4) Window controller
These (above mentioned) controllers are given by default while creating the WD component.
The option controller is custom controller, this is not mandatory for a web dynpro abap component to exits but can be created explicitly on requirement.
NOTE: There can be only one component controller but can be many or no custom controller.
Q) Detail component Controller.
The component controller is similar to what data declared in the top include is, in the case of reports. Declare the node here and these nodes will be available across the component, all the views.
This trick comes handy when developer has to play around with the visibility of certain UI elements on the screen.
For example there is an input field on second view which needs to be made visible only if certain check box on first view is checked, this scenario can be handled simply by creating the node/attributes bound to the input field and the check box in component controller. The data set to the checkbox bound attribute would be available even in the second view as the node was declared in the component controller.
Also, component controller helps us in modularising the code of ours,
Declare a method here and write the code in it, this particular method can be called in any view of the component by using the object wd_comp_controller
Q) Describe the Interface Controller
In a web dynpro component if nodes, views and methods are to be made available to other web dynpro components these need to be declared in the interface controller.
People doubt in making a view as an interface view ( is there any check box which needs to be clicked to make this view as an interface view?).
The answer is a NO there is no such mechanism, the fundamental is as soon as the view is embedded in the window it becomes available in the interface controller.
but there is a check box in case a node is to be made as an interface node.
Check it out yourself and in case of doubt let me know via comments, will be happy to help 🙂