Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture changed value in ALV Grid

Former Member
0 Kudos
2,372

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.

1 ACCEPTED SOLUTION

former_member376453
Contributor
0 Kudos
406

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.

5 REPLIES 5

former_member223537
Active Contributor
0 Kudos
406

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

Former Member
0 Kudos
406

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.

franois_henrotte
Active Contributor
0 Kudos
406

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)

former_member376453
Contributor
0 Kudos
407

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.

0 Kudos
406

Thanks you all. 'GET_GLOBALS_FROM_SLVC_FULLSCR' and ref_grid->check_changed_data solved the problem. Points rewarded to all.