ABAP Change length of ALV header text

  Report Program

Over View

ALV header title is short! I want to make it longer! Have you ever thought that?
When each item refers to a data element, four texts of short, medium, long and header are registered.
The text will be automatically adjusted to the appropriate length according to the data length.
In such a case, try changing the value of ddictxt in the field catalog.

Sample Code

DATA: 
  it_fieldcat        TYPE slis_t_fieldcat_alv,
  wa_fieldcat        TYPE slis_fieldcat_alv.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name       = 'XXXXXXXXXX'
    i_client_never_display = 'X'
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2
    OTHERS                 = 3.

LOOP AT it_fieldcat INTO wa_fieldcat.
  wa_fieldcat-ddictxt = 'L'.
  MODIFY it_fieldcat FROM wa_fieldcat INDEX sy-tabix.
ENDLOOP.

Description

If you are using the global structure, you can use the function module: REUSE_ALV_FIELDCATALOG_MERGE to get the field catalog.
The field catalog has an item called ddictxt, so update that value according to the length of the text you want to display.
Values are S, M, and L for short, medium, and long, respectively.
In addition, it is possible to change the display position, hide, set the previous zero, and set the reference unit in the case of quantity or amount, and make various other settings.
If you need a special display, we recommend that you check the items in the field catalog.
Please see here for the basic method of making an ALV