04-29-2010 6:35 AM
hi all,
I have searched this question in the SDN but I am not getting a clear answer. SO need helping hand from the expert.
I am using a ALV grid and in the toolbar there is a button " CHANGEREP" which display another ALV grid based on the date entered in the pop-up window.
in the first time when I clicked this button, the value displayed correctly then I change new date and click the button again, the old value is displayed in the ALV grid.
I checked in debugging mode , ts_output is getting updated but not displayed correctly in the ALV grid.
please find the piece of code
MODULE status_1002 OUTPUT.
DATA : gr_event_handler2 TYPE REF TO lcl_event_handler .
SET PF-STATUS 'Z_ALV2'.
* Create Container the first time Only
* IF NOT g_custom_container2 IS INITIAL.
* EXIT.
* ENDIF.
* Create CONTAINER & GRID for ALV
CREATE OBJECT g_custom_container2
EXPORTING
container_name = g_container2.
CREATE OBJECT grid2
EXPORTING
i_parent = g_custom_container2.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
is_layout = ga_layout
it_toolbar_excluding = ty_exclude
CHANGING
it_outtab = ts_output
it_fieldcatalog = gt_fieldcat[].
CALL METHOD grid2->refresh_table_display.
ENDMODULE. "status_1002 OUTPUT
MODULE user_command_1002 INPUT.
CASE sy-ucomm.
* For EXIT, CANCEL,BACK
WHEN 'EXIT' OR
'BACK' OR
'CANCEL' OR
'&F03'.
CLEAR : gt_fieldcat[],
ty_exclude[],
ts_output[].
FREE grid2.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_1002 INPUT
04-29-2010 6:41 AM
Hi,
Free Container also.
I mean,
R_cont->free().
MODULE status_1002 OUTPUT.
DATA : gr_event_handler2 TYPE REF TO lcl_event_handler .
SET PF-STATUS 'Z_ALV2'.
* Create Container the first time Only
* IF NOT g_custom_container2 IS INITIAL.
* EXIT.
* ENDIF.
* Create CONTAINER & GRID for ALV
CREATE OBJECT g_custom_container2
EXPORTING
container_name = g_container2.
CREATE OBJECT grid2
EXPORTING
i_parent = g_custom_container2.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
is_layout = ga_layout
it_toolbar_excluding = ty_exclude
CHANGING
it_outtab = ts_output
it_fieldcatalog = gt_fieldcat[].
CALL METHOD grid2->refresh_table_display.
ENDMODULE. "status_1002 OUTPUT
MODULE user_command_1002 INPUT.
CASE sy-ucomm.
* For EXIT, CANCEL,BACK
WHEN 'EXIT' OR
'BACK' OR
'CANCEL' OR
'&F03'.
CLEAR : gt_fieldcat[],
ty_exclude[],
ts_output[].
FREE grid2.
g_custom_container2->free( ). "add This statement
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_1002 INPUT
Regrads,
Raghava Channooru.
04-29-2010 6:41 AM
Hi,
Free Container also.
I mean,
R_cont->free().
MODULE status_1002 OUTPUT.
DATA : gr_event_handler2 TYPE REF TO lcl_event_handler .
SET PF-STATUS 'Z_ALV2'.
* Create Container the first time Only
* IF NOT g_custom_container2 IS INITIAL.
* EXIT.
* ENDIF.
* Create CONTAINER & GRID for ALV
CREATE OBJECT g_custom_container2
EXPORTING
container_name = g_container2.
CREATE OBJECT grid2
EXPORTING
i_parent = g_custom_container2.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
is_layout = ga_layout
it_toolbar_excluding = ty_exclude
CHANGING
it_outtab = ts_output
it_fieldcatalog = gt_fieldcat[].
CALL METHOD grid2->refresh_table_display.
ENDMODULE. "status_1002 OUTPUT
MODULE user_command_1002 INPUT.
CASE sy-ucomm.
* For EXIT, CANCEL,BACK
WHEN 'EXIT' OR
'BACK' OR
'CANCEL' OR
'&F03'.
CLEAR : gt_fieldcat[],
ty_exclude[],
ts_output[].
FREE grid2.
g_custom_container2->free( ). "add This statement
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_1002 INPUT
Regrads,
Raghava Channooru.
04-30-2010 12:10 AM
04-29-2010 7:25 AM
Hi,
Can you tell me what code u have written for under CHANGEREP button.
Eg: MODULE user_command_screenno INPUT.
CASE sy-ucomm.
WHEN 'CHANGEREP'
Code.********
I think when u r clicking the same button it is not updating your corresponding table.
send me ur code for CHANGEREP button.
Regards,
Raj.
04-29-2010 8:13 AM
I guess, you should call the ALV Method refresh_table_display.
your_alv_object->refresh_table_display
exporting
is_stable = ls_s_stbl
exceptions
finished = 1
others = 2.
This method refreshs the ALV after e.g. a data change in your internal table. You don't need to destroy your ALV after a data update.
Regards,
Martin