on 2009 Mar 31 6:53 AM
hi all,
I would like to disable a button B1 or enable it depend on some status in my application.
How i can disable or enable the button in WDA?
BR,
Ali
Hi Ali,
In your WDDOMODIFYVIEW method try the following:
DATA lr_button TYPE REF TO cl_wd_button.
lr_button ?= view->get_element( '<Your Button ID Name>' ).
Based on some condition you can now set the enabled property of your button here.
lr_button->set_enabled( exporting value = 'X' or SPACE ).
Hope this is helpful.
Regards,
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks all
My Problem Solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a context attribute of typemWDY_BOOLEAN and bind the enabled property of the button to this.
In the MODIFYVIEW method..
DATA:
lr_btn type ref to cl_wd_button,
lv_btn_app_enable type wdy_boolean, " Enable
lr_view_ele type ref to if_wd_view_element.
CALL METHOD VIEW->GET_ELEMENT
EXPORTING
ID = 'B1' "Button Id
RECEIVING
ELEMENT = lr_view_ele.
***Gettig the button object reference for REVIEW button
lr_btn ?= lr_view_ele.
--------------Put your condition here-------------
***Enable and Disable button
lv_btn_app_enable = abap_false. "Disable
CALL METHOD wd_context->SET_ATTRIBUTE
EXPORTING
VALUE = lv_btn_app_enable
NAME = `BTN_APP_ENABLE` "Context attribute
CALL METHOD lr_btn->SET_ENABLED
EXPORTING
VALUE = lv_btn_app_enable.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ALi,
Bind the 'enabled' property of the button with context attribute of type char1.
When you want to enable it set the value to 'X' or ' ' (space) when you want to disable it.
Regards,
Saket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ali,
If you click on the button UI element, you'll see its properties on the right side of screen. Find a property named enabled. There will be a button on its right side, click on it, list of attributes will be displayed. Select an attribute of WDY_BOOLEAN type and change its values according to your logic.
Regards
Arjun
Follow the steps:
1) Click on button in the layout
2) Goto Properties (Button) on right side pane
3) 4th prop is 'enabled'. Click on the button (3 rd column i.e. Binding) next to 'enabled' property.
4) This will open the popup of context attributes.
5) Map it with desired attribute (previously created of type char1)
Regards,
Saket.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
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.