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

alv

hw to insert header and footer in alv.(grid display).

urgent..

thanks..

waiting....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2007 at 10:55 AM

    Have a look at below link.

    Report" target="_blank">http://www.sap-img.com/abap/example-of-a-simple-alv-grid-report.htm">Report: ALV Header

    Also look into BCALV* in se38 for sample codes.

    I hope it helps.

    Best Regards,

    Vibha

    *Please mark all the helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2007 at 11:02 AM

    Use FM REUSE_ALV_COMMENTARY_WRITE to display header.

    &----


    *& Form sub_event_call

    &----


    • text

    ----


    • -->P_V_EVENTS_REPL text

    ----


    FORM sub_event_call USING p_v_events.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = p_v_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.

    ENDFORM. " sub_event_call

    *&----


    *& Form POPULATE_EVENT

    *&----


    • text

    *----


    • --> p1 text

    • <-- p2 text

    *----


    FORM populate_event.

    CLEAR wa_event.

    READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.

    IF sy-subrc EQ 0.

    wa_event-form = 'TOP_OF_PAGE'.

    MODIFY v_events FROM wa_event TRANSPORTING form

    WHERE name = wa_event-form.

    ENDIF.

    endform.

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    ----


    FORM top_of_page.

    DATA: t_header TYPE slis_t_listheader,

    wa_header TYPE slis_listheader,

    l_date LIKE sy-datum.

    l_date = sy-datum - 1.

    • Title

    wa_header-typ = 'S'.

    wa_header-key = 'Yesterday Report : '.

    IF rb_crt = 'X'.

    wa_header-info = 'Job Creation Summary'. "todays date

    ELSEIF rb_rpl = 'X'.

    wa_header-info = 'Job Re-plan Summary'. "todays date

    ELSE.

    wa_header-info = 'Planned for Completion Summary'. "todays date

    ENDIF.

    APPEND wa_header TO t_header.

    CLEAR: wa_header.

    wa_header-typ = 'S'.

    wa_header-key = 'Date : '.

    CONCATENATE l_date+6(2) '.'

    l_date+4(2) '.'

    l_date(4) INTO wa_header-info. "todays date

    APPEND wa_header TO t_header.

    CLEAR: wa_header.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = t_header.

    • i_logo = 'Z_LOGO'.

    ENDFORM. "TOP_OF_PAGE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2007 at 11:06 AM

    Hi chang,

    Here are the steps for that:

    • work area and internal table for top of page.

    DATA: it_list_top_of_page TYPE slis_t_listheader,

    it_events TYPE slis_t_event,

    gs_layout TYPE slis_layout_alv,

    lwa_line TYPE slis_listheader.

    • constant to store top of page

    CONSTANTS: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

    PERFORM eventtab_build USING it_events[].

    PERFORM list_header USING it_list_top_of_page[].

    PERFORM layout_build USING gs_layout.

    PERFORM display.

    FORM eventtab_build USING lit_events TYPE slis_t_event.

    DATA: lit_alv_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = lit_events.

    READ TABLE lit_events WITH KEY name = slis_ev_top_of_page

    INTO lit_alv_event.

    IF sy-subrc = 0.

    MOVE gc_formname_top_of_page TO lit_alv_event-form.

    APPEND lit_alv_event TO lit_events.

    ENDIF.

    ENDFORM. "EVENTTAB_BUILD

    FORM list_header USING lt_top_of_page TYPE slis_t_listheader.

    CLEAR lwa_line.

    lwa_line-typ = 'S'.

    lwa_line-key = description for field.

    lwa_line-info = <field name or date ot time, etc> .

    APPEND lwa_line TO lt_top_of_page.

    lwa_line-key = description for field.

    lwa_line-info = <field name or date ot time, etc>.

    APPEND lwa_line TO lt_top_of_page.

    CLEAR lwa_line.

    lwa_line-typ = 'S'.

    lwa_line-key = description for field.

    lwa_line-info = sy-datum.

    APPEND lwa_line TO lt_top_of_page.

    CLEAR lwa_line.

    lwa_line-typ = 'S'.

    lwa_line-key = description for field.

    lwa_line-info = sy-uname.

    APPEND lwa_line TO lt_top_of_page.

    ENDFORM. "COMMENT_BUILD

    FORM top_of_page.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_list_top_of_page.

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form LAYOUT_BUILD

    &----


    ----


    • -->LS_LAYOUT for zebra pattern between records

    ----


    FORM layout_build USING ls_layout TYPE slis_layout_alv.

    ls_layout-zebra = 'X'.

    ENDFORM. "LAYOUT_BUILD

    &----


    *& Form display

    &----


    • text

    ----


    FORM display.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = sy-repid

    is_layout = gs_layout

    it_fieldcat = it_fieldcat

    it_events = it_events[]

    TABLES

    t_outtab = lit_field

    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. "display

    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.