09-23-2008 11:34 AM
Hi Experts
I have created a dynamic table then filled this dynamic table with the help of field symbols and then passed this dynamic table to grid1->set_table_for_first_display and hence the dynamic alv is shown on the screen. Now, can I do something to make this alv editable and store these values in z table. I have tried the method get_changed_cell method, but no help.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVC_CAT
IMPORTING
EP_TABLE = LP_TABLE.
ASSIGN LP_TABLE->* TO <LT_DATA>.
*Create structure = structure of the internal table
CREATE DATA LP_STRUCT LIKE LINE OF <LT_DATA>.
ASSIGN LP_STRUCT->* TO <HEADER>.
* SORT gt_data BY erdat.
*sort IT_VEWAO by MATNR.
LOOP AT IT_VEWZO INTO WA_VEWZO.
AT NEW VKBUR.
CLEAR <HEADER>.
*
ASSIGN COMPONENT 'VKBUR' OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-VKBUR.
ENDAT.
MOVE WA_VEWZO-PD_HIER TO L_COL.
ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-PLAN_QTY.
CONCATENATE WA_VEWZO-PD_HIER '_AP' INTO WA_VEWZO-PD_HIER .
MOVE WA_VEWZO-PD_HIER TO L_COL.
ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-APROV_QTY.
**********************************************************************
AT END OF VKBUR.
APPEND <HEADER> TO <LT_DATA>.
*
ENDAT .
ENDLOOP.
CREATE OBJECT CUSTOM_CONTAINER1
EXPORTING
CONTAINER_NAME = 'CUST_CONT'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = CUSTOM_CONTAINER1.
CALL METHOD grid1->REGISTER_EDIT_EVENT
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_STRUCTURE_NAME = lv_lp_struct
IS_LAYOUT = LS_LAYOUT
CHANGING
* IT_SORT = LT_SORT1
IT_FIELDCATALOG = LT_FIELDCAT
IT_OUTTAB = <LT_DATA>.
09-23-2008 12:39 PM
Hi ,
You have to call checked_changed_data method of cl_gui_alv_grid which will call your handle data changed method for event data_changed.
09-23-2008 12:39 PM
Hi ,
You have to call checked_changed_data method of cl_gui_alv_grid which will call your handle data changed method for event data_changed.
09-23-2008 12:43 PM
Hi,
What help u need?
to activate the editable field u need to pass the field catalog parameter
EDIT = 'X'
Then Edit values in your alv
and press enter or define any icons in ur alv list useing user command
check the changed values using the method
CALL METHOD g_alvgrid1->check_changed_data( ).
It will help you i think.
Regards,
Nandha
09-23-2008 1:13 PM
Thanks, but I guess this will only verify the value that has been changed not the information about what field has been changed.
What I am trying to figure out is how to get the information on what all cells have been changed and also the new value.
09-23-2008 1:20 PM
If you implement the DATA_CHANGED event you can get the information of what cell and what is the value changed.
data_changed for event data_changed
of cl_gui_alv_grid
importing er_data_changed "<---This holds the information
e_onf4
e_onf4_before
e_onf4_after,
er_data_changed is of type CL_ALV_CHANGED_DATA_PROTOCOL, so here you can find the Following information from the attributes of the object.
MT_MOD_CELLS
MP_MOD_ROWS
MT_GOOD_CELLS
MT_DELETED_ROWS
MT_INSERTED_ROWS
03-17-2011 5:52 AM
Hello Vijay,
I am too trying to get the changed values. I read your reply to this post. Can you please give the detaile description as how the data_changed method can be used? I created object of class cl_gui_alv_grid. And when i said
call method obj->data_changed
importing
er_data_changed.
It gives error that "data_changed might be protected or private".
What to do? as i am not quite familiar with OO ABAP.
10-01-2008 4:49 AM