Skip to Content
0
Mar 12, 2013 at 12:20 PM

Full editable row in ALV comp. for APPEND and INSERT buttons

28 Views

Hi,

I have made a restriction in WDDOINIT for my key fields as they are not to be changed by the user when editing existing records.

However, I use the standard ALV toolbar in my view and I need to make all fields editable when the user clicks either

APPEND or INSERT row, but how to address these buttons ?

My existing code for WDDOINIT:

METHOD wddoinit.

* Add toolbar for functionality (INSERT, DELETE etc.)
* and
* Set table fields Editable for start and end date

DATA : lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref.

DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

lo_cmp_usage = wd_this->wd_cpuse_alv_test( ).

IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.



DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv_test( ).

DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(

).



CALL METHOD lv_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.



DATA : lo_sdatum TYPE REF TO cl_salv_wd_uie_input_field.
DATA: lo_edatum TYPE REF TO cl_salv_wd_uie_input_field.

* Open fields in existing records for editing

LOOP AT lt_columns INTO ls_columns.
CASE ls_columns-id.
WHEN 'SDATUM'.
CREATE OBJECT lo_sdatum
EXPORTING
value_fieldname = ls_columns-id.
ls_columns-r_column->set_cell_editor( lo_sdatum ).
WHEN 'EDATUM'.
CREATE OBJECT lo_edatum
EXPORTING
value_fieldname = ls_columns-id.
ls_columns-r_column->set_cell_editor( lo_edatum ).
ENDCASE.
ENDLOOP.

CALL METHOD lv_value->if_salv_wd_table_settings~set_read_only
EXPORTING
value = abap_false.


ENDMETHOD.