11-24-2004 12:55 PM
Hello all,
I added a refresh button on my ALV display List.
It should bring the latest sales data.
This is how it was handled.
List Header for Top-Of-Page
PERFORM comment_build.
Fill the Field Catlog details
PERFORM fieldcat_init USING 'IT_ALV_HBOM'.
Modify the Field Catalog
PERFORM modify_fieldcat.
Fill the necessary events
PERFORM eventtab_build USING gt_events.
Sort Fields
PERFORM sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = g_repid
i_callback_pf_status_set = gc_status
i_callback_user_command = gt_user_command
is_layout = gs_layout
it_fieldcat = v_fieldcat[]
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
it_sort = it_sort
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = p_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield .
case sy-ucomm.
when refresh.
select latest data from database.
and all call the ALv display again.
List Header for Top-Of-Page
PERFORM comment_build.
Fill the Field Catlog details
PERFORM fieldcat_init USING 'IT_ALV_HBOM'.
Modify the Field Catalog
PERFORM modify_fieldcat.
Fill the necessary events
PERFORM eventtab_build USING gt_events.
Sort Fields
PERFORM sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = g_repid
i_callback_pf_status_set = gc_status
i_callback_user_command = gt_user_command
is_layout = gs_layout
it_fieldcat = v_fieldcat[]
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
it_sort = it_sort
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = p_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
endcase.
endform.
PROBLEM I AM FACING IS ..
I get a display of ALV, but when i say BACK or CANCEL it goes to the previous list of ALV.
How do i over come this issue?
Regards,
Manohar E
11-24-2004 1:13 PM
There is no need to call reuse again within your callback routine.
Just change the field refresh of structure Structure RS_SELFIELD as described in the online help.
Christian
RS_SELFIELD contains the following information:
tabname : Name of the internal output table
tabindex : Index of the internal output table
fieldname: Field name
endsum : Cursor is located on the totals line
sumindex : If >0, the cursor is located on a subtotals line
value : Value of the field on the list
refresh : (Exporting) List should be set up again
Christian
11-24-2004 1:07 PM
Hi Manohar,
You should not call FM 'REUSE_ALV_GRID_DISPLAY' for the second time. In the callback routine USER_COMMAND you should just set the field REFRESH of structure rs_selfield.
Regards,
John.
11-24-2004 1:13 PM
There is no need to call reuse again within your callback routine.
Just change the field refresh of structure Structure RS_SELFIELD as described in the online help.
Christian
RS_SELFIELD contains the following information:
tabname : Name of the internal output table
tabindex : Index of the internal output table
fieldname: Field name
endsum : Cursor is located on the totals line
sumindex : If >0, the cursor is located on a subtotals line
value : Value of the field on the list
refresh : (Exporting) List should be set up again
Christian
11-24-2004 1:35 PM