Skip to Content
0

Why ALV Grid Handle Data Changed Event Not Triggering After ALV Handle User Command Event?

Mar 23 at 03:08 PM

52

avatar image

Hi Experts,

I am trying to select/deselect lines with ALV toolbar button then i need to catch changed data from handle data changed event so i am validating data at this event.

When i changed select flag field in alv its trigger handle data changed event its okey but why it is not trigger after handle user command event in fact data was changed.

Note : I was try set GridModified property as manual it was trigger something but it couldnt catch changed data content just trigger handle data changed event .

Thanks.

scn-ss.png (14.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ömer Faruk KAYA Mar 23 at 07:47 PM
-1

Hi,

I had registered required event for editable alv as of below code;

CLASS lcl_event IMPLEMENTATION.

  METHOD handle_data_changed.
    PERFORM handle_data_changed USING er_data_changed.
  ENDMETHOD.                    "HANDLE_DATA_CHANGED

  METHOD handle_hotspot_click.
    PERFORM handle_hotspot_click USING e_row_id e_column_id.
  ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK

  METHOD handle_toolbar.
    PERFORM handle_toolbar CHANGING e_object e_interactive.
  ENDMETHOD.                    "handle_toolbar

  METHOD handle_user_command.
    PERFORM handle_user_command USING e_ucomm.
  ENDMETHOD.                    "handle_user_command

ENDCLASS.                    "lcl_event IMPLEMENTATION

**********************************************************
  SET HANDLER go_handler->handle_data_changed  FOR go_grid_item.
  SET HANDLER go_handler->handle_hotspot_click FOR go_grid_item.
  SET HANDLER go_handler->handle_toolbar       FOR go_grid_item.
  SET HANDLER go_handler->handle_user_command  FOR go_grid_item.

  CALL METHOD go_grid_item->set_table_for_first_display
    EXPORTING
      i_bypassing_buffer            = 'X'
      is_layout                     = gs_layout
      is_variant                    = gs_variant
      i_save                        = 'A'
      it_toolbar_excluding          = gt_exclude
    CHANGING
      it_outtab                     = gt_itab_0301[]
      it_fieldcatalog               = gt_fcat[]
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    CALL METHOD go_grid_item->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_modified
      EXCEPTIONS
        error      = 1
        OTHERS     = 2.
   ENDIF.


Check my short video to understand better via link or click here.

https://drive.google.com/file/d/1egv5amgshOwnYd_I5BMfac2X1_yjLS1a/view?usp=sharing

Thanks for your valuable answer.

Share
10 |10000 characters needed characters left characters exceeded
Naveen Krishnamurthy Mar 23 at 06:26 PM
0

Hi,

Can you check if you have used the below in your code,

CALL METHOD gv_alvgrid->register_edit_event

EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified.

CALL METHOD gv_alvgrid->set_ready_for_input

EXPORTING i_ready_for_input = 1.

SET HANDLER go_evnt_handler->handle_data_change FOR gv_alvgrid.

Thanks,

Naveen

Share
10 |10000 characters needed characters left characters exceeded