cancel
Showing results for 
Search instead for 
Did you mean: 

Editing ALV Column

Former Member
0 Kudos

Hi,

I am using these methods;

lr_config TYPE REF TO cl_salv_wd_config_table,

lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_EDIT_MODE ()

What is supposed to be written in the parenthesis in order to edit the ALV column

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi,

Try go through this [excellent blog|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1] by Claudia Dangers to understand how you can change 1 particular column of your ALV to editable mode.

Regards,

Uday

First it is necessary to use an input field as cell editor for the column u201Cprice,u201D which should be editable. Therefore we need to enhance method WDDOINIT of view ResultView:

WDDOINIT()
[u2026] " Do all your basic stuff first

" set cell editor for input fields (~make colum PRICE editable)
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
      lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.

lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_column( 'PRICE' ).

CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'PRICE'.
lr_column->set_cell_editor( lr_input_field ).


" The u201Cread only modeu201D has to be set to abap_false to make the table editable.

" set read only mode to false (and display edit toolbar)

data: lr_table_settings type ref to if_salv_wd_table_settings.

lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
ENDMETHOD.

Without this setting the input field will not be editable!

Former Member
0 Kudos

Hi everyone,

does anyone know if it is possible to have a column in edit mode but not display the extra edit buttons(check,append line,insert row)?

Regards

Mart

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You should not append new questions to the ends of existing threads. Please do not do this in the future. However the solution to your question is quite simple. Yes you can using methods of the ALV Model:

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv_basic( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.

  DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv_basic( ).
  DATA l_table TYPE REF TO cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).

  l_table->if_salv_wd_table_settings~set_read_only( abap_false ).
  l_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
  l_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
  l_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).

Former Member
0 Kudos

Appologies for appending it to end, it was only because my question was directly related to the topic but will create new question and reference old post in future. Thanks for solution though, it is much appreciated!

Regards

Mart

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This is the code to create editable alv.

Note:

l_value is ALV table reference.

*Get the Column to which you want to make editable

data:lr_input type ref to cl_salv_wd_uie_input_field,

l_column1 type ref to cl_salv_wd_column,

.

l_column1 =

l_value->if_salv_wd_column_settings~get_column('PRICE' ).

l_column1->set_cell_editor( value = lr_input1 ).

endloop.

*Set the table Editable

l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).

Edited by: suman kumar chinnam on Oct 30, 2008 10:31 AM