Webdynpro Configurator
This document demonstrates a scenario where the visibility of the UI element is controlled by using the Webdynpro configurator.
Configuration
Configuration modifies the behavior of a Web Dynpro component and application for all users of the application in the same way. A Web Dynpro component can have special parameters which steer the behavior of the component. A set of parameter values which define how the component should act is called a configuration, or configuration data record.
Follow the below steps for the demo
1. Create a Webdynpro through SE80
2. Create a Custom Controller with name ‘CUST_CONTR’ as shown in the below and save it
3. Set the custom controller as Config controller as shown below
After setting as Config controller and saving the symbol of it changes as shown
4. Create a node with name ‘ND_CONFIG’ with the below cardinality and selection
5. Create an attribute with the name ‘VISIBILITY’ with the type as Boolean
6. Go to the main view Properties tab and select the ‘CUST_CONTR’ and click ok.
7. Go to the context tab and drag and drop the node ‘ND_CONFIG’ on to the main view context as shown below
8. Create 4 UI elements on the main view
9. Bind the visibility of the Company code label and the drop down with the below attribute as shown
10. Copy paste the below code in WDDOINIT Method
METHOD wddoinit .
DATA lo_nd_nd_ccname TYPE REF TO if_wd_context_node.
DATA lt_nd_ccname TYPE wd_this->elements_nd_ccname.
DATA ls_nd_ccname TYPE wd_this->element_nd_ccname.
* navigate from
lo_nd_nd_ccname = wd_context->get_child_node( name = wd_this->wdctx_nd_ccname ).
* @TODO handle non existant child
* IF lo_nd_nd_ccname IS INITIAL.
* ENDIF.
* * @TODO compute values
* * e.g. call a model function
*
ls_nd_ccname-ccname = 'Siemens'.
APPEND ls_nd_ccname TO lt_nd_ccname.
ls_nd_ccname-ccname = 'Wipro'.
APPEND ls_nd_ccname TO lt_nd_ccname.
ls_nd_ccname-ccname = 'TCS'.
APPEND ls_nd_ccname TO lt_nd_ccname.
ls_nd_ccname-ccname = 'SAP-LABS'.
APPEND ls_nd_ccname TO lt_nd_ccname.
lo_nd_nd_ccname->bind_table( new_items = lt_nd_ccname set_initial_elements = abap_true ).
ENDMETHOD.
11. Create a webdynpro application ‘ZWDC_CONFIG’ as shown below
12. Right click on the webdynpro application name and click create/change configuration
13. The below screen appears. Fill Configuration ID (any name) and then click create button and then save as shown below
14. After save the below screen appears provide the Configuration name and then click Go to Component Configuration Button as shown below
15. The below screen appears just click create button as shown and save
16. After expanding the context node which was created in CUST_CONTR is appeared here. Attribute Visibility is available with a drop down with some set of values
Select any value from the dropdown and check final and then save as shown below.
17. Go to SE80 expand ZWDC_CONFIG as shown and click the test
Output
If true is value is selected the below will be the output.
By clicking the start configurator we can configure the UI elements according to our need. When clicked it will redirect to step no 15
No comments:
Post a Comment