2009 Mar 11 3:44 AM
Hello Experts,
I have an ALV output, in which I have a column as editable. I have generated the output using 'REUSE_ALV_GRID_DISPLAY'. I got to know that after changing the editable cell's value, if we double click the cell or if operate with any PF-status components, the value will automatically get changed in internal table also. For double click I am getting the expected result. But If I click a button the value doesn't get changed in internal table. Is there any other change I have to do for this. If I have checkbox in ALV will it be rectified. But my requirement is when I click the button only It has to be modified in the database table.
Thanks and regards,
Venkat.
2009 Mar 11 4:28 AM
Hi Venkat,
In your form for User Command
write following
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.
Case 'User-Command'.
......
Endcase.
or
data : i_grid_settings type lvc_s_glay.
"Calling ALV grid for display
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = i_callback_user_command
i_grid_settings = i_grid_settings
is_layout = is_layout
it_fieldcat = it_fieldcat
tables
t_outtab = it_final
"for call back values from editable grid cells
i_grid_settings-edt_cll_cb = 'X'.
Hope it helps you,
Pratik
2009 Mar 11 3:53 AM
In PAI need to modify the internal table
MODIFY <Itab> index <table control-current_line>
2009 Mar 11 3:54 AM
Hi
Which is the button from which you need changes ?
Did you get the code of that button and write code for it in your program ?
Can you send the extract of it ?
2009 Mar 11 4:05 AM
Hi,
The button I am using is coming from PF-status of ALV . If I click the button the following code will trigger.
FORM user_command USING ok_code TYPE sy-ucomm sf TYPE slis_selfield.
if ok_code = 'EDIT'.
MODIFY ysdinvoicerpt from table t_invoice_rpt.
commit WORK.
endif.
ENDFORM.
This user_command form has been given as input parameter of i_callback_user_command of ALV grid display. If I double click the cell in ALV some system code is triggered and internal table is automatically changed. But If I click the cell, that updation doesn't get changed. Is there any way to take the value of the ALV cell.
Thanks for your response,
Venkat
2009 Mar 11 4:08 AM
2009 Mar 11 4:13 AM
Hi
When you click the button does the debugger come inside 'if ' and internal table t_*rpt gets changed .
OR modify is not working ?
2009 Mar 11 4:15 AM
Hi Venkat ,
You should use Event handler ,
in the event handler method you can write code to modify internal table as well as to update the Database table .
Thanks
Sreenivas reddy
2009 Mar 11 4:01 AM
Hi Venkat,
The other option is the refresh button on the grid, if u assign the function code of the refresh button to any of your custom button the data shall be saved authomatically ..
try this..
it will work
thanks
ravi
2009 Mar 11 4:13 AM
in your "REUSE_ALV_GRID_DISPLAY' use the export Parameter
i_callback_user_command = 'USER_COMMAND' and also in the User_command form you can user fm
'GET_GLOBALS_FROM_SLVC_FULLSCR' and METHOD ref1->check_changed_data to capture changed Data
Br,
Dilum
2009 Mar 11 4:28 AM
Hi Venkat,
In your form for User Command
write following
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.
Case 'User-Command'.
......
Endcase.
or
data : i_grid_settings type lvc_s_glay.
"Calling ALV grid for display
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_user_command = i_callback_user_command
i_grid_settings = i_grid_settings
is_layout = is_layout
it_fieldcat = it_fieldcat
tables
t_outtab = it_final
"for call back values from editable grid cells
i_grid_settings-edt_cll_cb = 'X'.
Hope it helps you,
Pratik