on 08-13-2007 9:31 AM
Hello,
I have an ALV table where the 1st column is an checkbox. Now I want to disable the checkbox in some rows. When there is the string 'GARANTY' in the next field I would like the checkbox to disappear.
thankx and regards
stefan
Hi Stefan,
In your context node, add an attribute 'checkbox_enabled' of type char01. I presume you know how to make the cell editor of your ALV as a checkbox. Use the following code to bind the 'enabled' property of the checkbox to the context attribute.
data: lr_checkbox type ref to cl_salv_wd_uie_checkbox.
initialize checkbox*
lr_checkbox->set_enabled_fieldname( 'checkbox_enabled' ).
*set checkbox as cell editor *
In the method where you populate the internal table, loop through the internal table and set this field. Depending on the value in the field checkbox_enabled, the checkbox will either be greyed out or be enabled. Sample code would be:
loop at itab into wa.
if <fieldname> EQ 'GARANTY'.
wa-checkbox_enabled = abap_false.
else.
wa-checkbox_enabled = abap_true.
endif.
modify itab from wa.
endloop.
Have the checkbox_enabled attribute in the same node that you bind to the ALV table. Hope this helps.
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Ooops sorry already posted
data : lr_checkbox type ref to CL_SALV_WD_UIE_CHECKBOX.
data : lr_function_settings TYPE REF TO if_salv_wd_function_settings.
data: lr_function TYPE REF TO cl_salv_wd_function.
data: alv_config_table type ref to CL_SALV_WD_CONFIG_TABLE.
lr_salv_wd_table = wd_this->wd_cpifc_req_process( ).
alv_config_table= lr_salv_wd_table->get_model( ).
lr_function_settings ?= alv_config_table.
lr_function = lr_function_settings->create_function( 'ON_check' ).
CREATE OBJECT lr_checkbox exporting checked_field_name = '<Attribute Name>'.
lr_function->set_editor( lr_checkbox ).
lr_checkbox->GET_READ_ONLY_FIELDNAME( '<attribute Name>' ). " if you want to make the checkbox read only.
Regards
Abhimanyu L
Message was edited by:
Abhimanyu Lagishetti
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 | |
24 | |
12 | |
9 | |
7 | |
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.