Skip to Content
0
Former Member
Apr 14, 2008 at 02:24 PM

Reset ALV entry in display

79 Views

Hello.

I'm using an ALV display with a custom field catalog to allow a user to edit data via the ALV display (certain fields).

I create my container and fieldcatalog in the PAI of my screen and use CALL METHOD grid1->refresh_table_display to display it, I can edit the contents of the table displayed in the ALV just fine. I can validate each entry the user makes using the register_edit_event and use CALL METHOD er_data_changed->get_cell_value to get the user data as they enter and I can then validate the entry against my custom rules. My issue is that if the user violates the rules I defined in my code I would like to reset the entry. What method can I use to do this. My code for validation is below.

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_data_changed.

DATA: ls_good TYPE lvc_s_modi.

  • DATA wa LIKE LINE OF lt_good_cells.

CALL METHOD grid1->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

LOOP AT er_data_changed->mt_good_cells INTO ls_good.

v_tabix = sy-tabix.

CASE ls_good-fieldname.

WHEN 'QUANTITY'.

CALL METHOD er_data_changed->get_cell_value

EXPORTING

i_row_id = ls_good-row_id

i_fieldname = 'MATNR'

IMPORTING

e_value = v_1303matnr.

CALL METHOD er_data_changed->get_cell_value

EXPORTING

i_row_id = ls_good-row_id

i_fieldname = ls_good-fieldname

IMPORTING

e_value = v_qtytemp.

*---> I validate here and if I find an issue I would like to reset or change the cell value.

ENDCASE.

ENDLOOP.

ENDMETHOD.

Thanks!!