on 11-24-2009 10:18 AM
Hi Experts,
I have a requrirement where I have made custom Buttons in ALV . By Default the buttons are set disabled and I want to enable buttons on Lead Selection of ALV.
I have used this code in WD Donit to make custom button and by default set it disable :
data:lr_function type ref to cl_salv_wd_function,
lr_toggle_button type ref to cl_salv_wd_fe_button.
lr_function = l_value->if_salv_wd_function_settings~create_function(
id = 'S' ).
create object lr_toggle_button.
lr_toggle_button->set_text( 'SAVE' ).
lr_toggle_button->SET_ENABLED( abap_false ).
lr_function->set_editor( value = lr_toggle_button ).
How to make this custom button enable only on Lead Selection ?
HI,
Try to save this button reference global to view's attributes ie under ATTRIBUTES tab.
Now implement the LEADSEELCTION event for ALV, when you change the lead selection this gets triggered right..
Then using this refrernce you can enable/disable it using that class method.
create object lr_toggle_button.
wd_this->gr_button = lr_toggle_button.
lr_toggle_button->set_text( 'SAVE' ).
lr_toggle_button->SET_ENABLED( abap_false ).
lr_function->set_editor( value = lr_toggle_button ).
In lead selection event of ALV,
wd_this->gr_button->set_enabled( abap_true).
This will work.
Edited by: Lekha on Nov 24, 2009 3:52 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check out the cl_salv_wd_config_table to get the function implemented using the IF_SALV_WD_FUNCTION_SETTINGS~GET_FUNCTIONS so that it retuns the custom functions on ALV whichn inturn gets the
GET_EDITOR of CL_SALV_WD_FUNCTION.
Hope this way you can explore things.....
I guess storing it global would be fine...
Regards,
Lekha.
Thanks Lekha.
It worked with this :
data:lr_function type ref to cl_salv_wd_function .
data lr_button type ref to cl_salv_wd_fe.
data lr_button1 type ref to cl_salv_wd_fe_button.
lr_function = l_value->if_salv_wd_function_settings~get_function(
id = 'S' ).
lr_button = lr_function->get_editor( ).
lr_button1 ?= lr_button .
lr_button1->set_enabled( abap_true ).
Done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.