ABAP Web DynPro
Transaction – SE80 (Web-Dynpro-Comp. / Intf.)
WD is a client-independent programming model.
- It offers separation of layouts and logic and is based on Model-View-Controller (MVC) paradigm.
- Model – interacts with the backend system
- View – defines frontend (screen elements)
- Controller – links model and view
- In classic MVC, a view gets updates directly from the model, i.e. without indirection via a controller, which is not true for Web Dynpro.
We will consider a basic application for Employee details for explanation purpose.
A view is a visible screen area and contains screen elements. E.g. a text field for entering Employee Name
Every view has a dedicated view controller and every component has a component controller. View controller performs event handling (described in event handler methods) based on actions triggered in a view. E.g. adding Employee details on a click of a button.
A window contains one or more views. For a view to be displayed in the browser at runtime, it has to be embedded in the window. Windows have inbound and outbound plugs and a window controller which is global and visible to all controllers within a component.
A component contains all components like views, controllers, windows etc required to execute a WD application and acts as an application entry point. Components interact with each other via component interfaces.
Application is identified by a URL (Uniform Resource Locater) and is something executable for the user. When the user invokes the URL, WD creates an instance of the applications root component i.e. starting the root component and navigating to initial view which in turn is displayed in an initial window.
It is a repository of data and like a data container. Data used in views or component are stored in the context.
These are active parts in Web DynPro component. Component Controller and Interface controller are basically responsible for generating data which will be supplied to View Controller for display. Data that can be accessed by the controller are defined in corresponding context.
- Component Controller is the master of all controllers. A WD component cannot exist without a Component Controller. When a WD application is triggered through URL, the component controller of root component is instantiated. It is visible to all other controllers within the component.
- The life span of these controllers exists as long as the component is in use. More such additional global controllers can be added in the form of custom controllers.
- Interface Controller is available within and outside components and is used to exchange data. Each WD component can have only one interface controller.
- View Controller processes the action triggered by the user in view. A view has one view controller and one view context that contains the data required in the view. The lifespan of view controller and view context is limited to visibility of view in the browser.
They can be divided into Inbound plugs and Outbound plugs. Plugs are used for navigation between different views. To navigate from one view to the other, outbound plug of the calling view should be linked with the inbound plug of the called view. When a view is entered via an inbound plug, it triggers the event handler method and thus an event handler method is generated for every inbound plug.