2007 Sep 18 9:46 AM
Hi Guys,
I have an ALV grid report where I have 'Edit On' for one of the quantity fields in the report. How do I capture the new (changed) value in the suboutine for user command when user changes the value in the report and clicks on a button ?
Points assured for helpful replies.
2007 Sep 18 10:04 AM
Hi,
Use the following code:
DATA: ref_grid TYPE REF TO cl_gui_alv_grid.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
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.
ENDFORM.
2007 Sep 18 9:53 AM
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM...........
Data ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data
ENDFORM.
Also chk the blog
/people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers
2007 Sep 18 9:56 AM
Hi Sandip,
If you have created ALV using oops then you can use method 'Get_modified_rows' with which you can very well capture the modified rows of ALV.
DATA: modified_rows TYPE sshelflife_keysid.
METHOD get_modified_rows.
modified_rows = me->modified_rows.
ENDMETHOD.
Rewards points if it is useful.
Regards,
Radhika.
2007 Sep 18 9:56 AM
your form routine must have two parameters:
UCOMM to get the user command
SLIS_FIELD of type SLIS_SELFIELD to get info about modified cell - tabname and tabindex, row and column
it would be far better to use event DATA_CHANGED and specify a form routine having parameter of type REF TO cl_alv_changed_data_protocol - this class allows much more options to manipulate modifications (and to display a protocol if required)
if you use a REUSE_ALV_ function you should set the grid_settings-edt_cll_cb flag so that modification of a cell will also raise an event directly (without pressing a button)
2007 Sep 18 10:04 AM
Hi,
Use the following code:
DATA: ref_grid TYPE REF TO cl_gui_alv_grid.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
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.
ENDFORM.
2007 Sep 19 8:02 AM
Thanks you all. 'GET_GLOBALS_FROM_SLVC_FULLSCR' and ref_grid->check_changed_data solved the problem. Points rewarded to all.