‎2009 Jul 06 10:21 AM
I copy a pf status from FG SALV and set 2 buttons in it, ADD & DELETE. But when I press the butten created by myself, the internal table of the data didn't reflesh, that is , the user's action didn't take any effect. For example, I changed one column in the internal table from 3 to 2, when I debugged and I found the value of the internal table was still 3.
The internal table was g_t_alv in this case.
My code is the following:
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = sy-repid
i_callback_pf_status_set = 'SUB_PF_STATUS_SET'
i_callback_user_command = 'SUB_USER_COMMAND'
is_layout_lvc = l_layout
it_fieldcat_lvc = l_t_fieldcat[]
tables
t_outtab = g_t_alv
exceptions
program_error = 1
others = 2.
‎2009 Jul 06 10:32 AM
Hi,
Use the below methods and FM
CALL METHOD gr_alvgrid_100_1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = git_po_temp
it_fieldcatalog = gt_fieldcat_100_1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
*--Input field can be modified
CALL METHOD gr_alvgrid_100_1->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
register enter key event
CALL METHOD gr_alvgrid_100_1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
register field modified event
CALL METHOD gr_alvgrid_100_1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ELSE.
USE this methods
DATA : lv_ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lv_ref1.
CALL METHOD lv_ref1->check_changed_data.
Now u can check the changed avlues..
Regards,
Nagaraj
‎2009 Jul 06 10:34 AM
Hi,
Can you tell me how yo editing the value in your internal table.?
Regards,
Dhasarathy.
‎2009 Jul 06 10:54 AM
Hi ,
I hope you have a check box to select the records to be deleted .
gs_glay-edt_cll_cb = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = gi_fieldcat
i_grid_settings = gs_glay
i_grid_title = 'Create Condition Record '
i_grid_title = gv_text
i_callback_pf_status_set = 'SET'
i_callback_user_command = 'USER_COMMAND'
i_default = 'X'
i_save = 'X'
TABLES
t_outtab = gi_display
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: text-005.
ENDIF.
You have to write the code for the delete button in " form user_command".
The selected records will have X in the checkbox column .
‎2009 Jul 06 10:59 AM
‎2009 Jul 06 10:46 AM
Hi,
Add Refresh button and add function code '&REFRESH' to that button.
After changing the value on the output. Refresh using created button.
You can check the changed value in the table in the user_command when you double click on the output.
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'.
"Put breakpoint here and check the final table which is displayed
ENDIF.
ENDFORM. "USER_COMMANDThanks
Venkat.O
‎2009 Jul 06 11:32 AM
hi,
try this..
after you perform the user action try the givn below code.
SELFIELD-REFRESH = 'X'. " to refresh the internal table
hope this helps
Regards
Ritesh J
‎2009 Jul 06 2:27 PM
I did set a check column in my data table as the first column. My problem is when I check the CHECK colum or change the other column's value and click the button created by me, it didn't update to the internal table.
After I debugged in the subroutine of USER_COMMAND, and check the value of the internal table g_t_alv, which is the data souce of REUSE_ALV_GRID_DISPLAY. I found Whatever the user click the checkbox , input or change the value in the ALV , the result will never update to the data internal table when I click the button created by myself. But when I click the standard button 'SAVE' , which is next to the TCODE input, all the changes made by user can update to the internal table.
It is the problem of the update of the ALV data. Why the standard SAVE button update all the changes to the internal table , but not my customized button .
It has nothing to do with SELFIELD-REFRESH = 'X', it is the internal table can not be updated ,but not the ALV display result didnot be refleshed.
Edited by: YICHAO SUN on Jul 6, 2009 3:31 PM
Edited by: YICHAO SUN on Jul 6, 2009 3:34 PM
‎2009 Jul 06 2:43 PM
I solved this problem...by adding the following code to update the internal table in the USER_COMMAND subroutine.
Thanks everyone~
DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
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.