Downtime Announcement: Please note that SAP Community Wiki will be unavailable due to a system upgrade on Tuesday, August 11th between 7 and 11 AM CEST
Skip to end of metadata
Go to start of metadata

This will give u two column header for alv:

REPORT ZII_RKP_TEST MESSAGE-ID AA .

TYPE-POOLS: slis.
DATA:
      x_fieldcat  TYPE slis_fieldcat_alv,
      it_fieldcat TYPE slis_t_fieldcat_alv,
      l_layout    TYPE slis_layout_alv,
      x_events    TYPE slis_alv_event,
      it_events   TYPE slis_t_event.

DATA:
      BEGIN OF itab OCCURS 0,
        vbeln LIKE vbak-vbeln,
        posnr LIKE vbap-posnr,
        in TYPE i,
        out TYPE i,
      END OF itab.

SELECT vbeln
       posnr
  FROM vbap
  UP TO 20 ROWS
  INTO TABLE itab.

x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'IN'.
x_fieldcat-seltext_l = 'IN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'OUT'.
x_fieldcat-seltext_l = 'OUT'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_events-name = slis_ev_top_of_page.
x_events-form = 'TOP_OF_PAGE'.
APPEND x_events TO it_events.
CLEAR x_events .

l_layout-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    is_layout          = l_layout
    it_fieldcat        = it_fieldcat
    it_events          = it_events
  TABLES
    t_outtab           = itab
  EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.
IF sy-subrc NE  0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_of_page.

*-To display the headers for main list
  FORMAT COLOR COL_HEADING.
  WRITE: / sy-uline(103).
  WRITE: / sy-vline,
  (8) ' ' ,
  sy-vline,
  (8) ' ' ,
  sy-vline,
  (19) 'PATIENT'(015) CENTERED,
  sy-vline.

  WRITE: / sy-vline,
  (8) 'VBELN'(013) ,
  sy-vline,
  (8) 'POSNR'(014) ,
  sy-vline,
  (8) 'IN'(016) ,
  sy-vline,
  (8) 'OUT'(017) ,
  sy-vline.

  FORMAT COLOR OFF.

ENDFORM.

result: