2009 Mar 10 2:35 AM
Hi,
Can you help me in how to check whether the editable ALV grid is modified or not?
Thanks,
Sita.
Hi,
Can you help me in how to check whether the editable ALV grid is modified or not?
Thanks,
Sita.
2009 Mar 10 2:37 AM
check some where in the code of field catalog fc-edit = 'X'.
compare the old table to the new table
2009 Mar 10 3:34 AM
Hi,
In case of oops ALV u can do the following,
Create a class :-
CLASS cl_event_receiver DEFINITION.
PRIVATE SECTION.
DATA: error_in_data TYPE c.
METHODS
perform_checks
IMPORTING
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
METHODS:
get_cell_values
IMPORTING
row_id TYPE int4
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol
EXPORTING
w_key TYPE cuinst.
ENDCLASS.
under which create a method:-
CLASS cl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
error_in_data = space.
CALL METHOD perform_checks( er_data_changed ).
IF error_in_data = 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD. "handle_data_changed
METHOD get_cell_values.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = row_id
i_fieldname = 'CARRID'
IMPORTING
e_value = w_key.
ENDMETHOD. "GET_CELL_VALUES
ENDCLASS.
METHOD perform_checks.
PERFORM data_checks USING pr_data_changed
CHANGING error_in_data.
ENDMETHOD. "perform_checks
Then in the subroutine part:-
FORM data_checks USING pr_data_changed
CHANGING error_in_data.
FIELD-SYMBOLS: <l_fs> TYPE ANY.
LOOP AT p_data_changed->mt_mod_cells INTO ls_good.
CLEAR:l_htype.
CASE ls_good-fieldname.
WHEN 'FIELDNAME'
CHECK ls_good-value IS NOT INITIAL.
IF sy-subrc NE 0.
PERFORM add_entry USING text-m02 ls_good-fieldname
ls_good-row_id p_data_changed.
p_error = 'X'.
ENDIF.
FORM add_entry USING p_text p_fieldname p_rowid
p_data_changed TYPE REF TO
cl_alv_changed_data_protocol.
CALL METHOD p_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = p_text
i_fieldname = p_fieldname
i_row_id = p_rowid.
ENDFORM . "ADD_ENTRY
endcase.
ENDLOOP.
ENDFORM.
Revert back in case of further help.
Thanks & Regards,
Ruchi Tiwari
2009 Mar 10 3:39 AM
Hi,
This code will reflect changed from alv to the internal table.
If you make any changes in alv grid output, then these changes will be reflected back to internal table
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
Hope this helps you.
Regards,
Tarun