‎2007 Sep 13 9:49 PM
Dear SAP friends,
My program displays ALV grid in PBO:
gs_layout-cwidth_opt = 'X'. " optimize column width
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'IT_REPORT_X'
is_layout = gs_layout
is_print = gs_print
it_toolbar_excluding = it_exclude
CHANGING
it_outtab = it_report_x
it_fieldcatalog = gt_fcat.I have a custom button in the standard toolbar which I use to repopulate the grid if a certain criteria is met. To repopulate the grid I am using method:
CALL METHOD grid1->refresh_table_display.
So on initial display the grid has column width optimized.
But when I do refresh - the columns don't get optimized.
What is wrong?
Thank you,
Tatyana
‎2007 Sep 13 10:01 PM
Hello Tatyana
It seems that you have to call method go_grid->set_frontend_layout a second time but please do not ask me when and where (PBO vs. PAI, before/after REFRESH_TABLE_DISPLAY).
However, you are definitely on the safe side if you simply call the entire
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'IT_REPORT_X'
is_layout = gs_layout
is_print = gs_print
it_toolbar_excluding = it_exclude
CHANGING
it_outtab = it_report_x
it_fieldcatalog = gt_fcat.again at PBO. Disadvantage: scroll positions get lost.
Regards
Uwe
‎2007 Sep 13 10:01 PM
Hello Tatyana
It seems that you have to call method go_grid->set_frontend_layout a second time but please do not ask me when and where (PBO vs. PAI, before/after REFRESH_TABLE_DISPLAY).
However, you are definitely on the safe side if you simply call the entire
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'IT_REPORT_X'
is_layout = gs_layout
is_print = gs_print
it_toolbar_excluding = it_exclude
CHANGING
it_outtab = it_report_x
it_fieldcatalog = gt_fcat.again at PBO. Disadvantage: scroll positions get lost.
Regards
Uwe
‎2007 Sep 13 11:31 PM
I can confirm that this should work if you call
set_frontend_layout
before
refresh_table_display
This was a problem that I had for a while, and this solved it. I called it in the PBO.
Good luck
Brian
Message was edited by:
Brian Sammond
‎2007 Sep 14 1:32 PM
Thank you guys! Very Much!
I need to keep my scrool.
So the 'set_frontend_layout' before 'refresh_table_display' resolves the problem.
CALL METHOD grid1->set_frontend_layout
EXPORTING
is_layout = gs_layout.
CALL METHOD grid1->refresh_table_display.Tatyana.
‎2007 Sep 18 12:08 AM
If you question is answered, please mark the question as answered so that people will know.
Brian
‎2021 Sep 24 3:45 PM
FORM FRM_REFRESH_ALV.
DATA:LS_STABLE TYPE LVC_S_STBL.
CALL METHOD G_GRID->SET_FRONTEND_FIELDCATALOG
EXPORTING
IT_FIELDCATALOG = GT_FIELDCAT.
CALL METHOD G_GRID->SET_FRONTEND_LAYOUT
EXPORTING
IS_LAYOUT = GS_LAYOUT.
LS_STABLE-ROW = 'X'. "固定行
LS_STABLE-COL = 'X'. "固定列
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
EXPORTING
IS_STABLE = LS_STABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " FRM_REFRESH_ALV
SPAN {
font-family: "Consolas";
font-size: 10pt;
color: #F8F8F2;
background: #282A36;
}.L0S31 {
font-style: italic;
color: #6272A4;
}.L0S32 {
color: #BD93F9;
}.L0S33 {
color: #F1FA8C;
}.L0S52 {
color: #66D9EF;
}.L0S55 {
color: #50FA7B;
}.L0S70 {
color: #50FA7B;
}