Skip to Content
avatar image
Former Member

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 23 at 06:26 PM

    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

    Add comment
    10|10000 characters needed characters exceeded