2011 Sep 20 10:13 AM
Hi All,
I have four buttons on the ALV toolbar of screen 100 and I am calling screen 200 when the user clicks on them. Each button will display different data. And every time when you click on the button I am refreshing the Outtab and Field Catalog.
The Data got filled correclty in the Outtab everytime you click on any of the four ALV toolbar buttons.
The data is displayed well and correct when the report is executed for the first time in a popup screen 200.
Now when I click on Back to Overview button on the Popup . The screen 100 data is displayed again. And now I click on the Second button from the ALV toolbar the data got filled correctly in OUTTAB. But not reflecting in the popup ALV 200 Instead it is displaying previous button's data which we clicked.
If I completely come back to Selection screen of the report and execute the same step I am getting correct data displayed.
Please help.
2011 Sep 20 10:25 AM
Hi
If after going back from screen 200 you don't destroy ALV completly, you need to use the method for refresh in order to update the output .
The method is refresh_table_display just as Sangeetha says
Max
Hi All,
I have four buttons on the ALV toolbar of screen 100 and I am calling screen 200 when the user clicks on them. Each button will display different data. And every time when you click on the button I am refreshing the Outtab and Field Catalog.
The Data got filled correclty in the Outtab everytime you click on any of the four ALV toolbar buttons.
The data is displayed well and correct when the report is executed for the first time in a popup screen 200.
Now when I click on Back to Overview button on the Popup . The screen 100 data is displayed again. And now I click on the Second button from the ALV toolbar the data got filled correctly in OUTTAB. But not reflecting in the popup ALV 200 Instead it is displaying previous button's data which we clicked.
If I completely come back to Selection screen of the report and execute the same step I am getting correct data displayed.
Please help.
2011 Sep 20 10:21 AM
have you called the method - "refresh_table_display" of your gui alv grid class while calling screen 200 i.e in PBO of 200?
2011 Sep 20 10:25 AM
Hi
If after going back from screen 200 you don't destroy ALV completly, you need to use the method for refresh in order to update the output .
The method is refresh_table_display just as Sangeetha says
Max
2011 Sep 20 10:44 AM
Even though I destroyed the ALV completely tthe output is Not changed.
Please find my code below
Form To Display Data for Statistics Button
Perform DISPLAY_STATISTICS Using TB_DISPLAY.
FORM DISPLAY_STATISTICS USING TB_DISPLAY Type Any.
Clear : G_CONT_STAT. -
> Every Time the code goes into If Part only.
IF G_CONT_STAT is initial.
Create a custom container control for our ALV Control
CREATE OBJECT G_CONT_STAT
EXPORTING
container_name = G_CONT_ON_DIALOG_STAT
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
Creating ALV Grid instance
CREATE OBJECT G_GRID_STAT
EXPORTING
i_parent = G_CONT_STAT
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5 .
IF sy-subrc <> 0.
Exception handling
ENDIF.
Display Data
CALL METHOD G_GRID_STAT->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_SAVE = 'X'
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_VARIANT = GS_VARIANT
CHANGING
IT_OUTTAB = TB_DISPLAY
IT_FIELDCATALOG = TB_FCAT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
Refresh Table Display
CALL METHOD G_GRID_STAT->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDFORM. " DISPLAY_STATISTICS
Edited by: VENKAT SESHA on Sep 20, 2011 11:57 AM
2011 Sep 20 11:08 AM
2011 Sep 20 11:11 AM
Hi
You need to destroy and refresh the container too, try to use FREE method
G_CONT_STAT->FREE( ).
Clear : G_CONT_STAT.
Max
2011 Sep 20 12:41 PM
Hi Max,
Thanks for the Update.
Now when I use G_CONT_STAT->FREE( ).
Clear : G_CONT_STAT.
I am getting a new issue.
i.e., When I first click on the First ALV toolbar button It is fine. and clicked on Back to Overview button in Popup screen 200
which will take me to screen 100 report output. And Now I clicked on the Second Button in ALV Toolbar Which will call the Popup Screen 200 with a new data. This Time there is nothing displayed on the Popup screen 200. even though the Set table for first display was success.
Please guide.
2011 Sep 20 12:49 PM
2011 Sep 20 1:06 PM
Hi
This sample works fine:
DATA: T_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT WITH HEADER LINE,
T_SFLIGHT_1 TYPE STANDARD TABLE OF SFLIGHT.
DATA: N_REC TYPE I.
DATA: OK_CODE TYPE SY-UCOMM.
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
START-OF-SELECTION.
SELECT * INTO TABLE T_SFLIGHT
FROM SFLIGHT.
CALL SCREEN 100.
MODULE USER_COMMAND_0100 INPUT.
CLEAR T_SFLIGHT_1 .
LOOP AT T_SFLIGHT FROM 1 TO N_REC.
APPEND T_SFLIGHT TO T_SFLIGHT_1.
ENDLOOP.
SET SCREEN 200. LEAVE SCREEN.
ENDMODULE. " USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0200 INPUT.
IF OK_CODE = 'BACK'.
SET SCREEN 100. LEAVE SCREEN.
ENDIF.
ENDMODULE. " USER_COMMAND_0200 INPUT
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS '200'.
IF G_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'MY_CONTAINER'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_CUSTOM_CONTAINER.
* Display Data
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
IT_OUTTAB = T_SFLIGHT_1.
ELSE.
CALL METHOD GRID1->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDMODULE. " STATUS_0200 OUTPUTI don't know how you've solved the problem, but if you see my sample above, I don't use any method to clear the container or ALV GRID, but the method for refresh and it works.
In my first screen I dont' have an ALV, but I think it's not important
Max
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |