How to Add UI Elements Dynamically in Web Dynpro : Step by Steps guide how to create a new UI Element in Web DynPro dynamically.
Table of Contents
- Add UI Elements Dynamically in Web Dynpro
- Add UI Elements Dynamically in Web Dynpro: Step by Step
Add UI Elements Dynamically in Web Dynpro
Here the big steps to follow in order to add UI Element in WebDynPro in the runtime.
Creating UI elements at Runtime
Creation of user interface elements during runtime only possible from within the hook method “wdDoModifyView ()” which is present in the Web Dynpro view controller.
Implementation of wdDoModifyView() to generate UI Elements dynamically
Every UI element must have a layout manager assigned to it. The layout manager defines how the child UI elements will be arranged with the parent container. In the following example we will see how a new element is created, a new instance of layout manager is assigned to it and how the UI element is added to the root container.
Binding Dynamically Generated UI Elements with Context Element
Some of the dynamically generated UI element might require to be bind with a context element for proper functioning like InputFiled , drop downs ,radio buttons etc.The following example shows how to create a TextEdit UI element and bind it with a context element.
Creating Action for Dynamically Generated UI Elements
Some of the UI elements may require actions associated with them for proper functioning as in case of a Button. As Event handlers cannot be created dynamically, Event handlers are created during design time only and then associated with dynamically created action of the corresponding UI elements. The below section shows an example of an event handler being created during design time and then it is associated with the action of a dynamically created Button UI element.
Add UI Elements Dynamically in Web Dynpro: Step by Step
PS: This guide use rather WebDynPro Java. But it is the same steps when dealing with WDA ( WebdynPro ABAP )