cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member210563
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

you can create your custom button instead of using standard button. if you don't want to display these standard button just hide them

former_member210563
Participant
0 Kudos

Yes, but I want to use the standard buttons for coding a full editable row when clicking them.

Former Member
0 Kudos

try using below alv  event

ON_STD_FUNCTION_AFTE After Executing an ALV Standard Function

ON_STD_FUNCTION_BEFO Before Executing an ALV Standard Function

former_member210563
Participant
0 Kudos

Hi,

To show what I mean a Little screencut above:

In pseudo, I am looking for:

if 'APPEND' button.

     make all fields editable

endif.

if 'INSERT'

     make all fields editable

endif.

How to read the buttons ?

Former Member
0 Kudos

these two button are not triggering any events only option left is to create custom button

former_member210563
Participant
0 Kudos

OK, but can I remove them from the toolbar then ?

Former Member
0 Kudos

yes you can remove them

   * Instantiate the ALV Component
  lr_alv_usage =   wd_this->wd_cpuse_output_list( ).
  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_output_list( ).
  lr_config = lr_if_controller->get_model(
  ).



  lr_std ?= lr_config.
  lr_std->set_export_allowed( abap_true ).
  lr_std->set_edit_check_available( abap_false ).
  lr_std->set_edit_append_row_allowed( abap_false ).
  lr_std->set_edit_insert_row_allowed( abap_false ).
  lr_std->set_edit_delete_row_allowed( abap_false ).
  lr_std->set_filter_filterline_allowed( abap_false ).

Answers (0)