title: Multi-row headings in ALV grid
body: <p>I am trying to display 2 row multi heading in an alv grid display where each main heading should occupy 2 sub-headings as follows:</p>
  
  <pre><code>REPORT  zsam7.
  
  TYPE-POOLS: slis.  " SLIS contains all the ALV data
  
  TYPES: BEGIN OF ty_report,
           jan_deb  TYPE umxxs,
           jan_cred TYPE umxxh,
           feb_deb  TYPE umxxs,
           feb_cred TYPE umxxh,
         END OF ty_report,
         tt_report TYPE TABLE OF ty_report.
  
  DATA: lt_report   TYPE tt_report WITH HEADER LINE,
        wa          TYPE ty_report,
        lfc1_table  TYPE STANDARD TABLE OF lfc1,
        repid       TYPE sy-repid,
        wa_deb      TYPE saldv,
        wa_cred     TYPE saldv,
        it_fieldcat TYPE slis_t_fieldcat_alv,
        wa_fieldcat TYPE slis_fieldcat_alv,
        x_events    TYPE slis_alv_event,
        it_events   TYPE slis_t_event,
        l_layout    TYPE slis_layout_alv.
  
  FIELD-SYMBOLS: &lt;fs_rep&gt;  LIKE LINE OF lt_report,
                 &lt;fs_rep1&gt; LIKE LINE OF lfc1_table.
  
  SELECT * FROM lfc1 INTO CORRESPONDING FIELDS OF TABLE lfc1_table WHERE bukrs = '1000' AND gjahr  = 2003.
  
  LOOP AT lfc1_table ASSIGNING &lt;fs_rep1&gt;.
  
    APPEND INITIAL LINE TO lt_report ASSIGNING &lt;fs_rep&gt;.
  
    IF &lt;fs_rep1&gt;-um01s &gt; &lt;fs_rep1&gt;-um01h.
  
      &lt;fs_rep&gt;-jan_deb = &lt;fs_rep1&gt;-um01s - &lt;fs_rep1&gt;-um01h.
  
    ELSE.
  
      &lt;fs_rep&gt;-jan_cred = &lt;fs_rep1&gt;-um01h - &lt;fs_rep1&gt;-um01s.
  
    ENDIF.
  
    IF &lt;fs_rep1&gt;-um02s &gt; &lt;fs_rep1&gt;-um02h.
  
      &lt;fs_rep&gt;-feb_deb = &lt;fs_rep1&gt;-um02s - &lt;fs_rep1&gt;-um02h.
  
    ELSE.
  
      &lt;fs_rep&gt;-feb_cred = &lt;fs_rep1&gt;-um02h - &lt;fs_rep1&gt;-um02s.
  
    ENDIF.
  
  ENDLOOP.
  
  repid = sy-repid.
  
  *Build field catalog
  wa_fieldcat-fieldname  = 'JAN_DEB'.    " Fieldname in the data table
  wa_fieldcat-seltext_l  = 'deb'.   " ColuAN_DEBmn description in the output
  wa_fieldcat-col_pos = 1.
  APPEND wa_fieldcat TO it_fieldcat.
  
  
  wa_fieldcat-fieldname  = 'JAN_CRED'.
  wa_fieldcat-seltext_l  = 'cred'.
  wa_fieldcat-col_pos = 1.
  APPEND wa_fieldcat TO it_fieldcat.
  
  wa_fieldcat-fieldname  = 'FEB_DEB'.    " Fieldname in the data table
  wa_fieldcat-seltext_l  = 'deb'.   " Column description in the output
  wa_fieldcat-col_pos = 2.
  APPEND wa_fieldcat TO it_fieldcat.
  
  wa_fieldcat-fieldname  = 'FEB_CRED'.
  wa_fieldcat-seltext_l  = 'cred'.
  wa_fieldcat-col_pos = 2.
  APPEND wa_fieldcat TO it_fieldcat.
  
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = repid
      i_callback_user_command     = 'HANDLE_USER_COMMAND'
      i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
      it_fieldcat                 = it_fieldcat
    TABLES
      t_outtab                    = lt_report
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
  FORM html_top_of_page USING lw_document TYPE REF TO cl_dd_document .
  
    DATA : doctable TYPE REF TO cl_dd_table_element,
           col1_t1  TYPE REF TO cl_dd_area,
           col2_t1  TYPE REF TO cl_dd_area.
  
  *add quick table with five columns
    CALL METHOD lw_document-&gt;add_table
      EXPORTING
        no_of_columns = 12
        border        = '1'
        with_heading  = 'X'
        width         = '150%'
      IMPORTING
        table         = doctable.
  
  *Filling columns in row
    CALL METHOD doctable-&gt;add_column
      EXPORTING
        width  = '8%'
      IMPORTING
        column = col1_t1.
  
  *Filling columns in row
  
    CALL METHOD doctable-&gt;add_column
      EXPORTING
        width  = '8%'
      IMPORTING
        column = col2_t1.
  
    CALL METHOD doctable-&gt;new_row.
  
    CALL METHOD col1_t1-&gt;add_text
      EXPORTING
        text = 'JAN'.
  
    CALL METHOD col2_t1-&gt;add_text
      EXPORTING
        text = 'FEB'.
  
  ENDFORM. "html_top_of_page
  </code></pre>
  
  <p>As you can see I am trying to use html_top_of_page but the main headings are at the top and not inline with the subheadings. I know you can also use alv_list_display but I need grid display in-order to use filtering and sorting on the subheadings. The main headings does not need to use filtering or sorting or any other but they need to be on top of the subheadings and be inline with them where each heading should occupy two sub headings. It is possible to use one row scroll for the whole report? Also it is better if the main headings are self centered. How to achieve this?</p>