Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV grid refresh - column name change

Former Member
0 Kudos

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

4 REPLIES 4

venkat_aileni
Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

                                                                               


anurag_abbi_tm
Participant
0 Kudos

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:

  • If no other text is specified, the text copied from the Data Dictionary is used. The ALV Grid Control choses the long field label (

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