on 06-10-2008 12:59 PM
Hi,
How do I enable or disable the buttons from a particular view dynamically.
Regards,
Ronita
Hello,
I suggest you to bind the propertie Enabled from the button with a context attribute of type WDY_BOOLEAN . Then you can change this attribute to abap_true or abap_false depending of your needs.
You can see an example at the component WDR_TEST_EVENTS in the view BUTTON .
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Of the two solutions provided, I would strongly suggest that you take the approach suggested by David Pietroniro.
Both approaches are technically correct, however the recommended approach from SAP is to use the content data binding to the UI element properties whenever possible. This provides a cleaner break between the UI layers, makes your application easier to maintain and understand and also still allows for personalization/configuration of the UI.
The programatic approach that the first poster suggest, should only be used as a method of last resort when your entire UI is dynamically generated and can nto be configured via the View Layout.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use something similar to this in WDDOMODIFYVIEW method of the view. BTN_TEST is the id of the button.
data Lo_btn_test type ref to cl_wd_button.
lo_btn_test ?= view->get_element( 'BTN_TEST' ).
lo_btn_test->set_enabled( abap_false ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.