2009 Jun 18 8:58 AM
Hello All,
I am using the handler Data_changed.
Here the table "er_data_changed" is filled when a field is modified in the alv.
But when the F4 for a field is used, then the "er_data_changed" is getting refreshed i.e, the other old modified value are lost.
I do not want the old modification to be lost.
Thanks,
Nishanth.
2009 Jun 18 9:13 AM
Hi,
Call the method CHECK_CHANGED_DATA in PAI.
Incase you want to handle the F4 event then create the handler method as follows
METHODS handle_f4
FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname
e_fieldvalue
es_row_no
er_event_data
et_bad_cells
e_display.
Regards,
Ankur Parab
2009 Jun 18 9:13 AM
Hi,
Call the method CHECK_CHANGED_DATA in PAI.
Incase you want to handle the F4 event then create the handler method as follows
METHODS handle_f4
FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname
e_fieldvalue
es_row_no
er_event_data
et_bad_cells
e_display.
Regards,
Ankur Parab
2009 Jun 18 9:26 AM
Hello Ankur,
I am not able to understand when to use "check_changed_data" and how does it help.
Thanks,
Kunal.
2009 Jun 18 9:30 AM
Hi,
The method Check_changed_data can be called while saving the contents of the modified ALV.
CALL METHOD g_grid->check_changed_data
IMPORTING
e_valid = l_valid.
Regards,
Mansi.
2009 Jun 18 9:37 AM
Hello Ankur,
Well the problem is, I am not saving the contents of the ALV to the database until the enter key is pressed. So until then i would like to have all modified data in er_data_changed->mt_good_cells.
As of now, when i change the first data using F4, the change is recorded in er_data_changed->mt_good_cells, but as i go on and modify secong record using F4, the first change is deleted and the new change is only recorded.
Hopefully u have a better picture of my problem now.
Thanks,
kunal.
2009 Jun 18 10:10 AM
Hi,
In that case in your handler method call sender->REFRESH_TABLE_DISPLAY.
So that the changed data is passed to teh grid.
regards,
Ankur Parab
2009 Jun 18 10:45 AM
Hello Ankur,
I have tried the same. But No success.
Thanks,
Kunal.
2009 Jun 18 11:01 AM
Hi,
Refer to the below code snippet:-
**Class Definition
CLASS: lcl_event_receiver DEFINITION DEFERRED.
SET HANDLER v_event_receiver->handle_item_changed FOR v_ref_grid.
CLASS lcl_event_receiver DEFINITION.
METHODS :
handle_item_changed FOR EVENT data_changed_finished
OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver IMPLEMENTATION.
*--- modifying updated data in internal table
METHOD handle_item_changed.
PERFORM modify_table USING e_modified
et_good_cells.
ENDMETHOD. "handle_item_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
In this perform you can use code like:-
FORM modify_table USING e_modified
et_good_cells TYPE lvc_t_modi.
DATA: ls_good1 TYPE lvc_s_modi.
READ TABLE et_good_cells INDEX 1 INTO ls_good1.
IF sy-subrc = 0.
CASE ls_good1-fieldname.
*--- When Material
WHEN 'MATNR'. "<--field name
READ TABLE it_zmm_spice_conv INTO wa_zmm_spice_conv
INDEX ls_good1-row_id.
IF sy-subrc = 0.
wa_zmm_spice_conv-matnr = ls_good1-value.
MODIFY it_zmm_spice_conv FROM wa_zmm_spice_conv
INDEX ls_good1-row_id TRANSPORTING matnr.
ENDIF.
ENDCASE.
ENDIF.
ENDFORM.
Similarly code for other fields (columns) as well.
Hope this helps you.
Regards,
Tarun
2009 Jun 18 11:15 AM
in that case u need to play with values like this .
*Registering Fields for F4 function.
refresh: gt_f4a.
gt_f4_wa-fieldname = 'BELNR'.
gt_f4_wa-register = 'X'.
*gt_f4_wa-getbefore = 'X'.*
*gt_f4_wa-chngeafter = 'X'.*
.
--> Based on these values , your container get refreshed.
for more info , please check its documentations.
regards
Prabhu