Skip to Content

How to display Header for ALV list display similar to ALV Grid display.

PERFORM TOP_OF_PAGE.
PERFORM GET_JOB_DETAILS.
*&---------------------------------------------------------------------*
*&      Form  GET_JOB_DETAILS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_JOB_DETAILS .
*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*    EXPORTING
*      IT_FIELDCAT = IT_FCAT
*i_callback_top_of_page   = 'TOP-OF-PAGE'
*    TABLES
*      T_OUTTAB    = IT_TBTCO.
*  IF SY-SUBRC <> 0.
** Implement suitable error handling here
*  ENDIF.
*
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      IT_FIELDCAT = IT_FCAT
    TABLES
      T_OUTTAB    = IT_TBTCO.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
    WRITE: 'HI'.
  ENDIF.
ENDFORM.                    " GET_JOB_DETAILS



*&---------------------------------------------------------------------*

*&      Form  TOP_OF_PAGE

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM TOP_OF_PAGE .

  WA_HEADING-TYP = 'H' .

*  WA_HEADING-KEY = 'H' .

  WA_HEADING-INFO = 'IDOC Monitoring' .

  APPEND WA_HEADING TO I_HEADING .

  CLEAR WA_HEADING.



  WA_HEADING-TYP = 'S' .

  WA_HEADING-KEY = 'USERNAME' .

  WA_HEADING-INFO = SY-UNAME .

  APPEND WA_HEADING TO I_HEADING .

  CLEAR WA_HEADING.



  WA_HEADING-TYP = 'A' .

  WA_HEADING-KEY = 'DATE' .

  WA_HEADING-INFO = SY-DATUM .

  APPEND WA_HEADING TO I_HEADING .

  CLEAR WA_HEADING.



  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

      IT_LIST_COMMENTARY = I_HEADING

*     I_LOGO             = I_HEADING

*     I_END_OF_LIST_GRID =

*     I_ALV_FORM         =

    .



ENDFORM.                    " TOP_OF_PAGE
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 10 at 06:47 AM

    Hi,

    use the code which you have commented in

    call your subroutine TOP_OF_PAGE in parameter I_CALLBACK_TOP_OF_PAGE.

    already lots of threads available on this,

     CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          IT_FIELDCAT = IT_FCAT
       i_callback_top_of_page   = 'TOP-OF-PAGE'
        TABLES
          T_OUTTAB    = IT_TBTCO.
      IF SY-SUBRC <> 0.
      *  Implement suitable error handling here
      ENDIF.
    
    
    Add comment
    10|10000 characters needed characters exceeded

    • Yes, i did it for ALV Grid Display.But my question is how to get similar header for ALV List Display.

      As we don't have i_callback_top_of_page for ALV LIST

  • May 10 at 07:06 AM

    then try to use events some thing like this,

     CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
     EXPORTING
     i_list_type = 0
     IMPORTING
     et_events = it_events
     EXCEPTIONS
     list_type_wrong = 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.
    
     READ TABLE it_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
     IF sy-subrc EQ 0.
     wa_event-form = 'TOP_OF_PAGE'.
     MODIFY it_events FROM wa_event TRANSPORTING form WHERE name = wa_event-name.
     ENDIF.
     
    *now pass this events in list display
     
     CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
     I_CALLBACK_PROGRAM = SY-REPID
     IS_LAYOUT = WA_LAYOUT
     IT_FIELDCAT = it_fielDcat
     I_SAVE = 'X'
     it_events = it_events
     TABLES
     T_OUTTAB = IT_ITAB .
     IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.

    also check using event TOP_OF_LIST also..

    in subroutine TOP_OF_PAGE write your header data..

    Add comment
    10|10000 characters needed characters exceeded