Skip to Content
author's profile photo Former Member
Former Member

displaying header in alv list display

hi everyone,

i got to display header in REUSE_ALV_LIST_DISPLAY, can anyone guide me and send any sample reports

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 09:15 AM

    I am assuming you are already comfortable with displaying ALV list and your concern is just to display header. IF I am right, follow this.

    use WRITE statement in the FORM routine.data from this FORM will be displayed automatically at runtime.

    steps :

    1. i am populating ALV EVENTS to the IT_EVENTS internal table.

    2. for TOP OF LIST event i am populating the FORM name

    3. i defined the FORM HEADER and added my code there.

    4. i given IT_EVENTS internal table name to the LIST DISPLAY function module.

    &----


    *& Form SET_EVENTS

    &----


    • text : Assign form names to the Events

    ----


    FORM SET_EVENTS .

    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.

    *--Text To be displayed at TOP OF LIST

    CLEAR WA_EVENT.

    READ TABLE IT_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_LIST'. <--this event will be triggered at the end of the list output.

    WA_EVENT-FORM = 'HEADER'. <--this FORM will be called at runtime.we should create a FORM with this name and what ever we want to display at the TOP of the list we have to write them here.

    MODIFY IT_EVENTS FROM WA_EVENT INDEX SY-TABIX.

    ENDFORM. " SET_EVENTS

    &----


    *& Form HEADER

    &----


    • text :Text to be displyed at the TOP OF LIST

    ----


    FORM HEADER .

    WRITE YOUR brief footer here.

    WRITE :/ 'HEADER'.

    ENDFORM.

    If you are looking for GRID display HEADER just check this link

    alv-grid

    Regards

    Srikanth

    Message was edited by: Srikanth Kidambi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 09:16 AM

    Hi Venkat,

    In SE 80 -> the package SLIS for your alv grids.

    Try this example before you code..

    BCALV_TEST_HEADER

    Need any help ask.

    Regards

    Madhavi.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 09:16 AM

    hi,

    *&---------------------------------------------------------------------*
    *& Report  ZRICHA_ALV1
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ZRICHA_ALV1.
    TYPE-POOLS :SLIS.
    TYPES : BEGIN OF TY_MARA,
                MATNR LIKE MARA-MATNR,
                SPRAS LIKE MAKT-SPRAS,
                MAKTX LIKE MAKT-MAKTX,
            END OF TY_MARA.
    
    
    DATA : BEGIN OF T_MARA OCCURS 0,
                MATNR LIKE MARA-MATNR,
                SPRAS LIKE MAKT-SPRAS,
                MAKTX LIKE MAKT-MAKTX,
            END OF T_MARA.
    
    DATA:  X_MARA TYPE TY_MARA,
           T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
           X_FCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : V_REPID TYPE SY-REPID.
    
    SELECTION-SCREEN BEGIN OF BLOCK B.
    SELECT-OPTIONS:  S_MATNR FOR X_MARA-MATNR.
    SELECTION-SCREEN END OF BLOCK B.
    
    START-OF-SELECTION.
      V_REPID = SY-REPID.
      SELECT MATNR SPRAS MAKTX
        FROM MAKT
        INTO TABLE T_MARA
       WHERE MATNR IN S_MATNR
         AND SPRAS = 'E'.
    
    END-OF-SELECTION.
      PERFORM DISPLAY.
    
    *&---------------------------------------------------------------------*
    *&      Form  display
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM DISPLAY .
     IF T_MARA[] IS INITIAL.
         MESSAGE I999(ZMSG) WITH 'No data found'.
     ELSE.
      PERFORM FILL_FCAT.
      IF T_FCAT[] IS INITIAL.
        MESSAGE I999(ZMSG) WITH 'SOME ERROR : CANNOT DISPLAY'.
      ELSE.
        PERFORM FINAL_DISPLAY.
      ENDIF.
      ENDIF.
    ENDFORM.                    " display
    *&---------------------------------------------------------------------*
    *&      Form  fill_fcat
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM FILL_FCAT .
    
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = V_REPID
          I_INTERNAL_TABNAME     = 'T_MARA'
          I_INCLNAME             = V_REPID
        CHANGING
          CT_FIELDCAT            = T_FCAT
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
    ENDFORM.                    " fill_fcat
    *&---------------------------------------------------------------------*
    *&      Form  final_display
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM FINAL_DISPLAY .
    
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
       IT_FIELDCAT                    = T_FCAT
        TABLES
          T_OUTTAB      = T_MARA
        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.
    
    ENDFORM.                    " final_display

    Regards,

    Richa

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 09:18 AM

    Before calling the ALV Pass TOP_OF_PAGE to the event I_EVENT. Like below.

    &----


    • Events

    ----


    FORM get_events USING p_top_of_page.

    CLEAR: w_event, i_event.

    REFRESH: i_event.

    w_event-name = slis_ev_top_of_page.

    w_event-form = p_top_of_page.

    APPEND w_event TO i_event.

    ENDFORM. " get_even

    Fill the data which should be shown in the top in page using below code:

    &----


    *& Form top_of_page

    &----


    • Top of Page

    ----


    FORM top_of_page USING p_top.

    DATA: gs_line TYPE slis_listheader,

    i_header TYPE slis_t_listheader.

    gs_line-typ = c_a.

    gs_line-info = p_top.

    APPEND gs_line TO i_header.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = i_header.

    ENDFORM. " top_of_page

    In the Reuse_ALV FM, Pass the event I_EVENT.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 09:21 AM

    u can used.

    FORM top_of_page. "#EC CALLED.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = w_standard_header.

    ENDFORM. "top_of_page

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.