cancel
Showing results for 
Search instead for 
Did you mean: 

How is the ON_CHANGED Event Handler used in an Editable ALV

Former Member
0 Kudos

Hi,

I have managed to make a column in my ALV editable by implementing the following code in the WDDOINIT method:

  • Set column price as editable field

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( 'MEASUREMENT' ).

CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'MEASUREMENT'.

lr_column->set_cell_editor( lr_input_field ).

  • Set read only mode to false. 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 ).

QUESTION IS:

When a user changes the value in the cell, how do I return that value to the context WITHOUT having to use a "Save" button?

Is it possible to return the value back to the context using the event handler ON_CHANGED. This event handler is defined in CL_SALV_WD_UIE_INPUT_FIELD. How do I make use of this event handler - IF_SALV_WD_CONFIG~ON_CHANGED.

Thank you.

Giscard

Accepted Solutions (0)

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The onChanged event is not a Web Dypnro event from the UI but instead an internal ABAP OO event that is used by the ALV framework. It is used to notify different parts of the ALV framework when the configuration has changed.

Former Member
0 Kudos

hi,

1.Implement the ON_DATA_CHECK event.

2, There you will get all the modified cells.

For Ref :

method ON_DATA_CHECK .
  DATA: lr_node TYPE REF TO if_wd_context_node,
        lr_element TYPE REF TO if_wd_context_element,
        ls_modified_cells TYPE salv_wd_s_table_mod_cell,
        wa_data type wd_this->element_table,
        wd_node type ref to if_wd_context_node.
 
  FIELD-SYMBOLS <temp> TYPE data.
 
  wd_node = wd_context->get_child_node( name = 'TABLE' ).
 
" get message manager
  DATA lo_api_controller     TYPE REF TO if_wd_controller.
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
 
  lo_api_controller ?= wd_this->wd_get_api( ).
 
  CALL METHOD lo_api_controller->get_message_manager
    RECEIVING
      message_manager = lo_message_manager.
 
  lr_node = wd_context->get_child_node( name = 'TABLE' ).
 
  LOOP AT r_param->t_modified_cells INTO ls_modified_cells.
    lr_element = lr_node->get_element( index = ls_modified_cells-index ).
" The ALV might also have been modified at other places so check if the modification
" has happened in the any column. 
    IF ls_modified_cells-attribute = 'APPROVE'.
" If the modification has happened in the checkbox then fetch the information of that row
      wd_node->get_static_attributes( exporting index             = ls_modified_cells-index
                                      importing static_attributes = wa_data ).
" Do your desired processing with the row information that you have in wa_data
    endif.
  endloop.
endmethod.

I hope it helps.

arjun_thakur
Active Contributor
0 Kudos

Hi Giscard,

Refer to the reply given by Naresh in this thread:

I hope it helps.

Regards

Arjun

Former Member
0 Kudos

It worked. Thanks a lot Arjun.

Former Member
0 Kudos

Hi ,

I am facing the problem with ON DATA CHECK EVENT. I have registered this event interface controller and create a method On data check of event handler type. Actually My requirement is to find the number of rowls deleted, inserted or appended by the user in the Editable ALV output.

But the evernt On Data Check is not triggering when the user clicks CHECK buttton.

Please let me know if you have any solution.

Regards,

J.P