You can create enhancement implementations for existing applications that were implemented using Web Dynpro for ABAP. These enhancement implementations are independent development objects that are managed separately from the respective original object. They are part of the enhancement concept that was integrated into the ABAP Workbench in the SAP NetWeaver Application Server 7.0. The original objects they are based on are not changed by such an enhancement and can therefore be updated whenever there is a release change.
Hint: Conflicts related to software updates can be solved using transaction SPAU_ENH.
ABAP source texts in a Web Dynpro application can be enhanced using BAdIs.
For this purpose, explicit anchor points (called enhancement options) are implemented in the source code at suitable points during the development of the application. Using these options, you can insert a separately developed BAdI later on into the flow of the program. Each BAdI is therefore an explicit enhancement.
An implicit enhancement, on the other hand, does not need any advance implementation through the application development department.
In addition to the source code enhancements described above, you can also perform enhancements to individual sections of a Web Dynpro component. For
Figure 95: Enhancements: Web Dynpro Application without enhancements
Figure 96: Enhancements: Same Web Dynpro application with enhancements
Enhancements in Detail
The following Web Dynpro entities can be enhanced modification-free using the new enhancement framework. The first list contains the enhancement options for all kinds of Web Dynpro controllers.
• At the beginning and at the end of each method, pre-exit and post-exit methods can be created that are called at the beginning of this method or at the end of this method, respectively.
• New ordinary methods can be created.
• New supply functions can be created.
• New event handler methods can be created.
• New attributes can be created.
• New context attributes can be added to an existing context node.
• New context nodes can be created.
• The list of used components/controllers can be extended statically (as of SAP NetWeaver 7.0, SP13 and later).
Additional enhancement options exist for view controllers:
• New inbound plugs and outbound plugs can be added.
• New actions can be created.
• Existing UI elements can be removed, new UI elements can be added to the UI element hierarchy.
• New views can be created (as of SAP NetWeaver 7.0, SP13 and later).
For window controllers, the following additional enhancement options do exist:
• New inbound plugs and outbound plugs can be added.
• Existing navigation links can be removed, new navigation links can be defined.
• New windows can be created (as of SAP NetWeaver 7.0, SP13 and later).
For Web Dynpro components, the list of used components can be extended statically (as of SAP NetWeaver 7.0, SP13 and later).
The following enhancement options do not exist for SAP NetWeaver 7.0:
• Create new custom controllers
• Create new events in existing controllers
Creating an Enhancement Implementation
In order to use a predefined enhancement option, an enhancement implementation has to be created and activated.
Hint: Enhancing of Web Dynpro controllers is only possible, if the related Web Dynpro components belong to a software component having the correct system change settings (Transaction SE06).
Figure 97: Prerequisite for enhancing repository objects: Adequate system change settings
Hint: Deactivating enhancement implementations is only possible via the switch framework. To use this functionality, the enhancement implementations have to be stored in a package that is assigned to a switch (Transaction SFW1). In addition, this switch has to be assigned to a business function (Transaction SFW2). Then, activating / deactivating the enhancement implementations can be realized by switching on the related business function using transaction SFW5.
To create an enhancement implementation for any Web Dynpro controller, the controller object has to be displayed (not edited) in the ABAP Workbench. Next, for switching to the enhancement implementation mode, the related icon in the button bar has to be pressed (or menu entry <left menu>→Enhance, or key
combination Ctrl + F4). A dialog box will pop up asking for the name of the enhancement implementation to use. You can either create a new enhancement implementation or you can select an existing one if available.
To switch back to the display mode of the controller, the button to toggle between the display mode and the change mode has to be pressed once (or menu entry <left menu>→Display <-> Change, or key combination Ctrl + F1).
Figure 98: Creating / extending an enhancement implementation
Enhancements for all Controller Types
On the tab Methods, the hook methods, ordinary methods, supply functions, and event handler methods are displayed. Having switched to the enhancement mode, additional user defined methods can be added to this list and the source code can be entered as if these methods were defined in the edit mode.
For existing methods, the source code can not be modified, but coding blocks that are processed before the method's source code (pre-exits) and after the method's source code (post-exit) can be defined. To do this, two buttons are available in the line displaying the method's name. These buttons are located in columns with the title Pre-Exit and Post-Exit, respectively. Pressing such a button will open the related coding block in the edit mode.
Figure 99: Enhancements: Creating new methods, pre-exits and post-exits For the pre-exit method, all importing and changing parameters of the
corresponding controller method are automatically provided. Export parameters and returning parameters are not accessible.
For the post-exit methods, all import and changing parameters of the related controller method are provided. Export parameters and returning parameters of the controller method are provided as changing parameters.
Figure 100: Pre-exits and post-exits: Processing flow
To delete pre-exit methods or post-exit methods, the related buttons on the Methods tab (above the table displaying the methods) have to be pressed. The same enhancement implementation has to be used for the creation and the deletion of these methods.
In the enhancement mode arbitrary attributes can be added to all kinds of controllers. Existing attributes can not be changed. Deleting attributes defined by enhancements is possible, if the deletion is stored in the same enhancement implementation that has been used before to create the attributes.
Figure 101: Enhancements: Defining new controller attributes
Context nodes can be added to the context of all controller types. This is not only true for independent nodes but also for dependent nodes. There are no differences between defining a node in the enhancement mode and in the edit mode. It is even possible to map context nodes defined by enhancement to other controllers.
Context attributes can be added to all context nodes. However, if the context node is typed with an ABAP Dictionary structure, only attributes related to the fields of this structure may be added. This is done via the context menu entry Create using the Wizard → Attributes from Components of Structure.
Context nodes and context attributes defined by enhancement can be changed and deleted again. However, the same enhancement implementation has to be used for the creation and the deletion.
Context elements created in the edit mode can not be deleted by enhancement and their properties can not be changed.
Finally, for new context nodes supply functions can be created. Again, this does not differ from the way it is done in the edit mode.
Figure 102: Enhancements: Defining new context elements and map context nodes
Additional Enhancements for View Controllers and Window Controllers
For view controllers and for window controllers, additional outbound plugs and inbound plugs can be created in the enhancement mode. The single steps of defining plugs, outbound plug parameters and for inbound plugs the method's source code and signature do not differ from creating these entities in the edit mode. Creating, changing, or deleting plugs is only possible in one and the same enhancement implementation.
Figure 103: Enhancements: Defining new plugs
New actions can be defined in view controllers. The single steps of defining actions, the method's source code, and its signature do not differ from creating these entities in the edit mode. Creating, changing, or deleting actions is only possible in one and the same enhancement implementation.
Figure 104: Enhancements: Defining new actions
For window controllers, navigation links can be deleted (suppressed) via enhancement. New navigation links, connecting plugs that are defined statically or via enhancement, can be created. Navigation links deleted by enhancements are still displayed in the window. However, in the property list for these links an additional line appears indicating by which enhancement implementation this link is hidden. For the new links defined by enhancement a corresponding line is added indicating, by which enhancement implementation the new link was created. Creating new navigation links and deleting them again has to be stored in the same enhancement implementation. The same rule applies for suppressing and displaying again statically defined navigation links.
By combining the enhancement options to create new actions, new plugs, and to change the navigation, the sequence of the view assemblies and the reaction on user input can be changed without having to modify the Web Dynpro
component. However, creating new views and embedding these views in existing viewUIElementContainers is not possible before SAP NetWeaver 7.0 SP13. For systems without SP13, the possibility to dynamically change the UI element hierarchy of each view (from the pre-exit or from the post-exit method of the hook method wddomodifyview()) in combination with the possibility to define and trigger the navigation dynamically serves as a replacement.
Figure 105: Enhancements: Change navigation between views
The last modification-free changes provided by enhancement options are changes of the UI element hierarchy related to a view's layout. Existing UI elements can be removed and new UI elements can be attached to each container UI element.
Removing an existing UI element does not mean that it is deleted from the UI element hierarchy. It is still visible at design time. However, at runtime this element will not be processed at all, so it will not leave its marks in the generated UI. This is different from an UI element having the property visible = none, since such an element still occupies space in the rendered UI.
Hint: UI elements removed by enhancement are not accessible at runtime.
This has to be taken into account - especially when accessing the UI elements dynamically (method wddomodifyview()).
Creating new UI elements and deleting them again has to be stored in the same enhancement implementation. The same rule applies for suppressing existing UI elements and displaying them again.
Figure 106: Enhancements: Changing the view's layout