Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when using handle_data_changed of cl_gui_alv_grid...

aris_hidalgo
Contributor
0 Kudos

Hello Experts, 

I am using the said method(handle_data_changed) in my ALV grid using cl_gui_alv_grid.
My question is, The value that I enter in one of the editable columns(TREAS_TRANSACTIONS) is not being passed
into structure ls_good. By the way, I am using BCALV_EDIT_03 as my reference. 
Below is my code guys: 

CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
      handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
        IMPORTING
          er_data_changed.

  PRIVATE SECTION.
    DATA: ls_good TYPE lvc_s_modi.

    METHODS: check_input
               IMPORTING
                 im_amount       TYPE lvc_s_modi
                 im_data_changed TYPE REF TO cl_alv_changed_data_protocol.

ENDCLASS.                    "lcl_event_receiver DEFINITION

CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_data_changed.
    LOOP AT er_data_changed->mt_good_cells INTO ls_good.
      CASE ls_good-fieldname.
        WHEN 'TREAS_TRANSACTIONS'.
          CALL METHOD check_input
            EXPORTING
              im_amount       = ls_good
              im_data_changed = er_data_changed.
      ENDCASE.
    ENDLOOP.
  ENDMETHOD.                    "handle_data_changed

  METHOD check_input.
    DATA: ls_input TYPE lvc_s_modi.
    READ TABLE im_data_changed->mt_good_cells INTO ls_input
                       WITH KEY row_id    = im_amount-row_id
                                fieldname = 'TOT_CASH_BAL'.

  ENDMETHOD.                    "check_input
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
1 ACCEPTED SOLUTION

Sougata
Active Contributor
0 Kudos

At which point exactly do you want the "Check_changed_data" to trigger? When you hit Enter on grid after you changed data on grid or when you hit any other button on toolbar after you changed data on grid?

Also post your code after

CALL METHOD gt_grid->set_table_for_first_display

when you are registering the event by

CALL METHOD gt_grid->register_edit_event

and set the handler

SET HANDLER go_ref->handle_data_changed FOR gt_grid.

Cheers,

Sougata.

1 REPLY 1

Sougata
Active Contributor
0 Kudos

At which point exactly do you want the "Check_changed_data" to trigger? When you hit Enter on grid after you changed data on grid or when you hit any other button on toolbar after you changed data on grid?

Also post your code after

CALL METHOD gt_grid->set_table_for_first_display

when you are registering the event by

CALL METHOD gt_grid->register_edit_event

and set the handler

SET HANDLER go_ref->handle_data_changed FOR gt_grid.

Cheers,

Sougata.