Register Login

Report Header & Report Footer For ALV

Updated May 18, 2018

refer to this example.

GD_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_ DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = GD_REPID
*      I_CALLBACK_PF_ STATUS_SET = 'STATUS'
      I_CALLBACK_TOP_ OF_PAGE   = 'TOP-OF-PAGE_ CCODE'  "see FORM
      I_CALLBACK_USER_ COMMAND  = 'USER_COMMAND_ CCODE'
      IT_FIELDCAT              = FIELDCATALOG[ ]
      I_SAVE                   = 'X'
      IS_VARIANT               = G_VARIANT
    TABLES
      T_OUTTAB                 = IT_FINAL_CCODE
    EXCEPTIONS
      PROGRAM_ERROR            = 1
      OTHERS                   = 2.
  IF SY-SUBRC <> 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                                                 *
*----------- --------- --------- --------- --------- --------- --------- --*
* ALV Report Header                                                 *
*----------- --------- --------- --------- --------- --------- --------- --*
FORM TOP-OF-PAGE_ CCODE.
  DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
        WA_HEADER TYPE SLIS_LISTHEADER,
        T_LINE LIKE WA_HEADER-INFO,
        LD_LINES TYPE I,
        LD_LINESC(10) TYPE C.
  WA_HEADER-TYP  = 'H'.
  WA_HEADER-INFO = 'Student Fees Due'.
  APPEND WA_HEADER TO T_HEADER.
  CLEAR WA_HEADER.
  WA_HEADER-TYP  = 'S'.
  WA_HEADER-KEY = 'Date: '.
  CONCATENATE  SY-DATUM+4(2) '.'
               SY-DATUM+6(2) '.'
               SY-DATUM(4) INTO WA_HEADER-INFO.   "todays date
  APPEND WA_HEADER TO T_HEADER.
  CLEAR: WA_HEADER.
  WA_HEADER-TYP  = 'S'.
  WA_HEADER-KEY = 'For Company Code'.

  APPEND WA_HEADER TO T_HEADER.
  CLEAR: WA_HEADER.

  LOOP AT S_CCD.
    WA_HEADER-TYP  = 'S'.
    WA_HEADER-KEY = ''.
    WA_HEADER-INFO = S_CCD-LOW.
    APPEND WA_HEADER TO T_HEADER.
    CLEAR: WA_HEADER.
  ENDLOOP.
  CALL FUNCTION 'REUSE_ALV_COMMENTA RY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY = T_HEADER.
ENDFORM.                    "TOP-OF-PAGE_ CCODE

On 4/9/2010 12:23 PM, Rajcoomar, Suresh (ZA - Johannesburg) wrote:


Comments

  • 10 Apr 2010 6:56 am Shalesh Singh Visen
    Use EVENTS in ALV Grid Display FM to Display Header and Footer.

    Use i_events of type slis_t_event.

    and put
    i_events-name = 'END_OF_LIST' . "'TOP_OF_PAGE'

    i_events-form = 'END_OF_LIST' . "TOP_OF_PAGE'

    APPEND i_events TO i_events.

    In the Form routine END_OF_LIST write your statements to display either using write command or using FM resuse_alv_commentr y_write

    I think this would be okay for you .

×