on 05-11-2009 7:28 AM
Hi all,
I have two cloumns as check boxes in an alv table.
Now my requirement is to deactivate ( with non- editable mode ) one check box based on another ckeck box checking in the alv table.
Thanks in advance.
cheers,
srak.
Hi Sravan,
Do you intend to achieve the disabling of your columns when the ALV loads initially (Like the checkboxes in col2 are either enabled or disabled as per the respective values in col1) or do you want it to happen when the application loads up and the user starts checking checkboxes in 1 column? (Suppose user checks a checkbox in col1 then you want the corresponding checkbox in col2 to be disabled)
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravan,
I think that you can try proceed as follows.
1) First contain a boolean variable (say BOL1) under the same node which you are using to bind to your ALV. This boolean variable would be used to determine the readOnly property of your 2nd column. By default let it be set to false. (While you are creating a new checkbox ui element under col2 using the NEW_CHECKBOX of CL_WD_CHECKBOX bind the BIND_READ_ONLY property to BOL1)
2) Register an event handler method for the event ON_DATA_CHECK of the ALV. Now you would get to know the information about which of the ALV checkboxes have been changed. So with this information read the corresponding rows BOL1's value for col2 and set it to true. So every time the user checks any checkbox the ON_DATA_CHECK event gets triggered leading to the corresponding BOL1's value being reset.
My sandbox server is currently down or else I would have tried to send out some sample coding for you. Hope this approach makes sense and helps resolve your problem.
Regards,
Uday
Hi uday,
In my alv table , I have 5 cloumns in which 2 columns are check boxes.
My view context node have 5 attributes in which 2 are of type WDY_BOOLEAN for check boxes.
I am able print the check boxes and able give the input for that check boxes.
From this , how I need to approch....Please help me..
Regards,
sravan.
Hi All,
In view : Only one UI Element ie., View Container UI elment.
In View Context :Table is the node and Number, Name,Group, Approve, Reject are attributes .
Approve, Reject are WDY_BOOLEAN type.
Below is my Table fileds and data in ALV table :
Number Name Group Approve Reject
000001 Raj MSE Check Box Check Box
000002 Rohit MCE Check Box Check Box
......N no. of records based on database table
Now my requirement is , if I check the check box in Approve column then the check box in the Reject column should be non-editable mode.and if I check the check box in Rejcet column , then the corresponding check box in the Approve column should be non-editable mode.
Hope my requirement clear.
Can any one proivde me the solution in clear as I am new webdynpro for ABAP.
Thanks in Advance.
Regards,
sravan.
Hi Sravan,
-
Now my requirement is , if I check the check box in Approve column then the check box in the Reject column should be non-editable mode.and if I check the check box in Rejcet column , then the corresponding check box in the Approve column should be non-editable mode.
-
I suggest you use radiobuttons instead of checkboxes, as it is more suitable to your requirement.
If there aby specific reason why you want to go for checkbox ?
Radhika.
Edited by: Radhika Vadher on May 11, 2009 6:48 PM
Hi Sravan,
There doesn't seem to be any class which we can use for incorporating radio buttons in an ALV. May be you can try to go for a single column instead of 2 & incorporate an dropdown with 2 values Approve & Reject within it. This was you can both realize your required functionality and also reduce the ui to just 1 column.
Regards,
Uday
Hi Sravan,
You can refer the below coding for information about how you can incorporate dropdowns within your ALV. I have a node by name NODE with the same structure as SFLIGHT. I additionally have 2 attributes TEMP & TEMP_NEW. I have associated them with 2 of my custom domains so that they can derive their value set from them. Below is the coding I use for embedding the dropdowns within the ALV.
Regards,
Uday
METHOD build_alv .
DATA:
lr_alv_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_link TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,
lr_image TYPE REF TO cl_salv_wd_uie_image,
lr_dropdown TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.
" Instantiate the ALV Component
lr_alv_usage = wd_this->wd_cpuse_alv( ).
IF lr_alv_usage->has_active_component( ) IS INITIAL.
lr_alv_usage->create_component( ).
ENDIF.
" Get reference to model
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_config = lr_if_controller->get_model( ).
" To get the dropdowns displayed you need to set the table to editable by using below statement
lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
" Set the UI elements.
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
" The dropdowns get their values from the associated domain which has fixed values
" If in case you aren't using a domain then you need to manually create the valueset like in the commented " lines shown below
LOOP AT lt_columns ASSIGNING <fs_column>.
IF <fs_column>-id = 'CARRID'.
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( <fs_column>-id ).
<fs_column>-r_column->set_cell_editor( lr_link ).
ENDIF.
IF <fs_column>-id = 'TEMP'.
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'TEMP'.
<fs_column>-r_column->set_cell_editor( lr_dropdown ).
ENDIF.
IF <fs_column>-id = 'TEMP_NEW'.
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'TEMP_NEW'.
<fs_column>-r_column->set_cell_editor( lr_dropdown ).
ENDIF.
ENDLOOP.
ENDMETHOD.
If sravan,
If you still want to go with 2 check boxes in 2 different columns just incoporate this piece of code.
You do not have to create any extra attributes also.
DATA: l_column_header TYPE REF TO cl_salv_wd_column_header .
lt_columns = l_column_settings->get_columns( ) .
LOOP AT lt_columns INTO ls_columns .
CASE ls_columns-id .
WHEN 'APPROVE'.
DATA: lr_chk1 TYPE REF TO cl_salv_wd_uie_checkbox.
CREATE OBJECT lr_chk1
EXPORTING
checked_fieldname = ls_columns-id.
ls_columns-r_column->set_cell_editor( lr_chk1 ) .
lr_chk1->SET_READ_ONLY_FIELDNAME( 'REJECT' ). " bind your second checkbox attribute to readonly property
WHEN 'REJECT'.
DATA: lr_chk2 TYPE REF TO cl_salv_wd_uie_checkbox.
CREATE OBJECT lr_chk2
EXPORTING
checked_fieldname = 'CHK2'.
ls_columns-r_column->set_cell_editor( lr_chk2 ) .
lr_chk2->SET_READ_ONLY_FIELDNAME( 'APPROVE' ). " bind your 1st chkbox attribute to readonly paroperty
WHEN OTHERS .
ls_columns-r_column->set_visible(
cl_wd_uielement=>e_visible-none ) .
ENDCASE .
ENDLOOP .
This way when you select your first checkbox, your second checkbox's readonly property would be set to 'X' and it would be disabled and vice versa.
This way you can achieve your scenario, without any additional attributes and without creating any eventhandler methods.
Regards,
Radhika.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.