11-01-2013 5:29 PM
Hi all,
I'm using function module REUSE_ALV_GRID_DISPLAY to display an ALV, where I added two buttons. Those buttons will take a specific action, that I'm managing in USER_COMMAND form, and after they will update the ALV grid.
I'm using the following code to refresh the alv grid:
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
This all works fine to refresh the alv grid, but strange behaviour happens: the alv column names are changing from the data element short text to the data element long text.
Any ideas why this is happening?
Thanks in advance.
Best regards,
Sónia Gonçalves
11-01-2013 5:40 PM
Hi-
Can you paste your code for filling your field catalog internal table. Like: are you using FM: REUSE_ALV_FIELDCATALOG_MERGE or are you manully filling your field catalog?
Thanks,
Venkat
11-01-2013 5:55 PM
Hi,
I'm using REUSE_ALV_FIELDCATALOG_MERGE. My fieldcatalog code is this:
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = 'X'
i_structure_name = 'ZST_CNTRL_MB'
CHANGING
ct_fieldcat = gt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
gs_fieldcat-key = 'X'.
MODIFY gt_fieldcat FROM gs_fieldcat
TRANSPORTING key
WHERE fieldname = 'BUKRS'
OR fieldname = 'VBLNR'
OR fieldname = 'GJAHR'.
gs_fieldcat-tech = 'X'.
MODIFY gt_fieldcat FROM gs_fieldcat
TRANSPORTING tech
WHERE fieldname = 'XSELP'.
This only happens after clicking one the action buttons.
Thanks.
Sónia Gonçalves
11-01-2013 6:12 PM
Hi-
Not sure why:).
But say if you want to display only short text then you can use below logic:
*loop over your field catalog.
MOVE text-629 TO ls_fieldtab-seltext_s.
MOVE ls_fieldtab-seltext_s TO ls_fieldtab-seltext_m.
MOVE ls_fieldtab-seltext_s TO ls_fieldtab-seltext_l.
MOVE 'S' TO ls_fieldtab-ddictxt.
MODIFY it_fieldcat from ls_fieldtan INDEX l_counter TRANSPORTING seltext_m
seltext_l
ddictxt.
Hope this helps.
-Venkat
11-01-2013 5:43 PM
Hi,
Following is the explanation in SAP:
For fields with Data Dictionary reference, the system automatically adopts the field labels of the corresponding data element. The texts for the short, medium and long field labels as well as for the header are copied into the fields
SCRTEXT_S, SCRTEXT_M, SCRTEXT_L and REPTEXT of the field catalog.
There are several possibilities how the ALV Grid Control assigns text to a column:
SCRTEXT_L) as the tool tip and the text in the popup column selection. The column header is dynamically adjusted to the column width even if the user changes the column width. The ALV Grid Control always uses the longest DDIC text that still fits into the column.
Hope your column width is fixed. If not then assign a value.
Regards
Anurag