on 08-05-2009 12:20 AM
Hi,
I have an checkbox in editable ALV which displays 10 rows intially .It has vertical toolbar .
Requirement is when I check the box one of the corresponding row cell will become editable.
My problem is when I check intial 10 rows it is fine but when I go to 11th record using scrollbar and select checkbox , imemdiately table is being refreshed because my code is in ON_DATA_CHECK event ..How do i get rid of this issue so that cursor stays in the 11th record position only.
IN ON_DATA_CHECK .. i have following code..
LOOP AT lt_alvdata INTO ls_alv_data.
IF ls_alv_data-seplan = 'X'.
MOVE ls_data_selections-pstrt TO ls_alv_data-pstart.
MODIFY lt_alvdata FROM ls_alv_data .
......
ENDLOOP.
LOOP AT lt_columns INTO ls_columns .
CASE ls_columns-id .
WHEN 'TDURAT' .
DATA:lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
lr_column = lo_value->if_salv_wd_column_settings~get_column( 'TDURAT' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'TDURAT'.
lr_input_field->set_read_only_fieldname( 'READ_ONLY' ).
lr_column->set_cell_editor( lr_input_field ).
ENDCASE.
ENDLOOP.
lo_nd_alv_data->bind_table( lt_alvdata ).
What am I missing?
Rgds
Vara
hi ,
refer the following manuals
link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82d3e8]
link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for your replies.
Yes Radhika there is a reason for ON_DATA_CHECK.
Everytime user check that box I want to change to my row -cells to ediatble input field, Drop down .
If i have used On_CLICK it wouldn't catch the data changes and thus wouldn't change my cells to input fields & dropdown.
Abhimanyu,
I never used IF_SALV_WD_TABLE_SETTINGS~GET_FIRST_VISIBLE_ROW and
IF_SALV_WD_TABLE_SETTINGS~SET_FIRST_VISIBLE_ROW
Could you be little more specific.
How do i get the current index of the cursor so that it remains in the same place where user-clicked the check box.
rgds
Vara
Hi Vara,
In my component am trying to display the CARRID, CONNID, FLDATE, PRICE fields from SFLIGHT in my ALV. I have another context attribute CHECK of type WDY_BOOLEAN under the same context node. This attribute would appear as the checkbox column in my ALV. And when I toggle with the state of this checkbox I want to toggle between the enabled/disabled states of PRICE in the corresponding row. Below is the coding I put inside my WDDOMODIFYVIEW for achieving the same:
Regards,
Uday
METHOD wddomodifyview .
CHECK first_time = abap_true.
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_input TYPE REF TO cl_salv_wd_uie_input_field,
lr_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,
l_value TYPE REF TO cl_salv_wd_config_table.
FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_value = l_ref_interfacecontroller->get_model( ).
l_value->if_salv_wd_table_settings~set_read_only( abap_false ).
lr_column_settings ?= l_value.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns ASSIGNING <fs_column>.
IF <fs_column>-id = 'PRICE'.
CREATE OBJECT lr_input
EXPORTING
value_fieldname = 'PRICE'.
" This is the key thing to be done here. Binding the readOnly state of PRICE to the CHECK attribute
lr_input->SET_READ_ONLY_FIELDNAME( value = 'CHECK' ).
<fs_column>-r_column->set_cell_editor( lr_input ).
ENDIF.
IF <fs_column>-id = 'CHECK'.
CREATE OBJECT lr_checkbox
EXPORTING
checked_fieldname = 'CHECK'.
<fs_column>-r_column->set_cell_editor( lr_checkbox ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD wddoinit .
DATA: lr_node TYPE REF TO if_wd_context_node,
lt_sflight TYPE wd_this->elements_sflight.
lr_node = wd_context->get_child_node( name = wd_this->wdctx_sflight ).
SELECT * FROM sflight UP TO 20 ROWS INTO CORRESPONDING FIELDS OF TABLE lt_sflight.
lr_node->bind_table( lt_sflight ).
ENDMETHOD.
Uday,
my requirement is not only checkbox but I need to modify the displayed data.
for this reason i was modifying context table and re-binding it.
So in re-binding cursor is being taken to first record alltime.
LOOP AT lt_alvdata INTO ls_alv_data.
IF ls_alv_data-seplan = 'X'.
MOVE ls_data_selections-pstrt TO ls_alv_data-pstart.
MODIFY lt_alvdata FROM ls_alv_data .
......
ENDLOOP.
***I guess this ibelow statement is causing the issue*
lo_nd_alv_data->bind_table( lt_alvdata ).
rgds
vara
Hi Vara,
I tried recreating your scenario. I didn't have to work with any ALV events to achieve your desired functionality. I have 1 boolean attribute at my context level & I have used this both for my checkbox column and also for controlling the readOnly property of 1 of my cells. The toggling between the editable & readOnly states works perfectly & I morever I can even scroll down using my scrollbar & toggle a checkbox. The ALV doesn't get refreshed and also the same toggled checkbox stays in focus. Let me explain my code in a bit more detail.
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, Any specific reason for using the On_data_check event ? You could have used the OnClick event to handle the checkbox selection Regards, Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use IF_SALV_WD_TABLE_SETTINGS~GET_FIRST_VISIBLE_ROW and
IF_SALV_WD_TABLE_SETTINGS~SET_FIRST_VISIBLE_ROW
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.