2021 Oct 19 9:38 AM
Hi,
In my class I have 3 methods which I am using:
CREATE DATA TABLE_REF TYPE TABLE OF (GS_PARAMS-GV_SELECTED_TAB).
CREATE DATA GS_PARAMS-LS_TABLE TYPE TABLE OF (GS_PARAMS-GV_SELECTED_TAB).
FIELD-SYMBOLS <FS_TABLE> TYPE STANDARD TABLE.
ASSIGN GS_PARAMS-LS_TABLE->* TO <FS_TABLE>.
ASSIGN TABLE_REF->* TO <FS_TABLE>.
Then I am selecting the data into <fs_table>, and I can refer to them in other methods by using TABLE_REF global attribute.
FIELD-SYMBOLS: <FS_TABLE> TYPE STANDARD TABLE.
ASSIGN TABLE_REF->* TO <FS_TABLE>.
TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
IMPORTING
R_SALV_TABLE = GO_ALV
CHANGING
T_TABLE = <FS_TABLE>.
CATCH CX_SALV_MSG.
ENDTRY.
My problem is that whatever I am trying to do, I cannot refresh my ALV (it's r_table parameter is the same after many attempts of refreshing). I thought that I could create a new instance of go_alv and it's working, but when I am clicking the back button the old version is displayed (with old data). Any ideas what we could do there different?
In your code, this line is useless and can be removed safely:
ASSIGN GS_PARAMS-LS_TABLE->* TO <FS_TABLE>.
You can refresh the screen with:
GO_ALV->REFRESH( ).
2021 Oct 19 10:39 AM
In your code, this line is useless and can be removed safely:
ASSIGN GS_PARAMS-LS_TABLE->* TO <FS_TABLE>.
You can refresh the screen with:
GO_ALV->REFRESH( ).
2021 Oct 19 11:42 AM
sandra.rossi I deleted two additional lines, and the beginning of my code looks like this now:
CREATE DATA TABLE_REF TYPE TABLE OF (GS_PARAMS-GV_SELECTED_TAB).
FIELD-SYMBOLS <FS_TABLE> TYPE STANDARD TABLE.
ASSIGN TABLE_REF->* TO <FS_TABLE>.
Second thing - I will show some more code from display ALV method to clarify what's wrong:
FIELD-SYMBOLS: <FS_TABLE> TYPE STANDARD TABLE.
ASSIGN TABLE_REF->* TO <FS_TABLE>.
if 1 = 2.
go_alv->REFRESH( ).
endif.
TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
IMPORTING
R_SALV_TABLE = GO_ALV
CHANGING
T_TABLE = <fs_table>.
CATCH CX_SALV_MSG.
ENDTRY.Then I am trying to call those lines after the user_command:
GO_ALV->REFRESH( REFRESH_MODE = IF_SALV_C_REFRESH=>FULL ).
CL_GUI_CFW=>FLUSH( ).
GO_ALV->REFRESH( ).Return is the same - old ALV is displayed. Like I said, TABLE_REF and GO_ALV are global attributes for my class, before calling refresh function I am checking the TABLE_REF and it's updated with the new information.
Problem may be solved with different parameter passed into T_TABLE, but I have no idea how to do that.
2021 Oct 19 12:05 PM
I am little bit lost. Your <fs_table> is not global, you declare it just before the factory.
Did you try to declare it in the public section ?
2021 Oct 19 12:11 PM
<fs_table> is declared locally in both methods - I couldnt figure out how to declare field symbol globally in a class.
2021 Oct 19 1:50 PM
No need to flush after REFRESH, it's doing the flush itself.
2021 Oct 19 1:54 PM
Are you recreating the internal table? SALV keeps reference of the original table only.
2021 Oct 19 2:05 PM
I am calling prepare data method after the handle user command method, so in my global attribute TABLE_REF is updated with the new data. The problem is that I don't know how to pass it back to the GO_ALV without creating a new instance
2021 Oct 19 5:59 PM
Execute CREATE DATA TABLE_REF ... and ASSIGN TABLE_REF->* TO <FS_TABLE> the first time, and the next times only execute ASSIGN TABLE_REF->* TO <FS_TABLE>.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |