Skip to Content
avatar image
Former Member

Top-of-page in ALV

How to include top of page in ALV grid?

I have one internal Table itab.

I want to display the records through ALv.

It is working fine.

But now i wantthe format like this:

Heading one Heading 2

Date:sy-datum

time: sy-uzeit. and below i want to display the grid.

All these things should be on one page

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 21, 2007 at 11:17 AM

    use REUSE_ALV_COMMENTARY_WRITE FM...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:21 AM

    Hi Dipika,

    Check out the following code,

    DATA: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

    DATA: gt_list_top_of_page TYPE slis_t_listheader.

    FORM display_output1.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = wa_repname

    i_callback_pf_status_set = 'STATUS_SET'(003)

    i_callback_user_command = 'USER_COMMAND'(004)

    i_callback_top_of_page = 'TOP_OF_PAGE'

    is_layout = i_layout1

    it_fieldcat = i_fieldcat1

    TABLES

    t_outtab = i_first.

    ENDFORM. " display_output

    FORM top_of_page.

    DATA: theader TYPE slis_t_listheader,

    waheader TYPE slis_listheader.

    *

    waheader-typ = c_h.

    CONCATENATE 'Selection Criteria '(t01) ' '

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Sales Organization'(s02)

    s_vkorg-low 'TO'(s03) s_vkorg-high

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Distribution Channel'(s04)

    s_vtweg-low 'TO'(s03) s_vtweg-high

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Sold-To-Party :'(s05)

    s_kunnr-low 'TO'(s03) s_kunnr-high

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Plant :'(s06)

    s_werks-low 'TO'(s03) s_werks-high

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Billing Date :'(s07)

    s_fkdat-low 'TO'(s03) s_fkdat-high

    INTO waheader-info SEPARATED BY space.

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Billing Type :'(s08)

    s_fkart-low 'TO'(s03) s_fkart-high

    INTO waheader-info SEPARATED BY space ..

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Billing Number :'(s09)

    s_vbeln-low 'TO'(s03) s_vbeln-high

    INTO waheader-info SEPARATED BY space ..

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Sales Order Number :'(s10)

    s_slord-low 'TO'(s03) s_slord-high

    INTO waheader-info SEPARATED BY space ..

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    waheader-typ = c_s.

    CONCATENATE 'Reference :'(s11)

    s_ihrez-low 'TO'(s03) s_ihrez-high

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    IF NOT rb_loc IS INITIAL.

    CLEAR v_filenam.

    v_filenam = p_avpf.

    PERFORM retrieve_filename CHANGING v_filenam.

    waheader-typ = c_s.

    CONCATENATE 'AVP Filename :'(s12)

    v_filenam

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    CLEAR v_filenam.

    v_filenam = p_sapf.

    PERFORM retrieve_filename CHANGING v_filenam.

    waheader-typ = c_s.

    CONCATENATE 'SAP Filename :'(s13)

    v_filenam

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    ELSEIF NOT rb_net IS INITIAL.

    waheader-typ = c_s.

    CONCATENATE 'Logical Path :'(s14)

    p_dsser

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    CLEAR v_filenam.

    v_filenam = p_avpfil.

    PERFORM retrieve_filename CHANGING v_filenam.

    waheader-typ = c_s.

    CONCATENATE 'AVP Filename :'(s12)

    v_filenam

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR waheader.

    *

    CLEAR v_filenam.

    v_filenam = p_sapfil.

    PERFORM retrieve_filename CHANGING v_filenam.

    waheader-typ = c_s.

    CONCATENATE 'SAP Filename :'(s13)

    v_filenam

    INTO waheader-info SEPARATED BY space .

    APPEND waheader TO theader.

    CLEAR: waheader, v_filenam.

    *

    ENDIF.

    *

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = theader.

    ENDFORM. " TOP_OF_PAGE

    <b>

    Reward points if this helps,</b>

    kiran

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:28 AM

    Hi....

    Just follow the coding below.....

    define a list header, event first.....

    data: l_tab_listheader type slis_t_listheader,

    l_wa_listheader type slis_listheader,

    l_tab_event type slis_t_event,

    l_wa_event type line of slist_t_event.

    perfrom list_heading using l_tab_listheader l_tab_event.

    form list_heading using p_tab_listheader type slis_t_listheader

    p_tab_event type slist_t_event.

    l_wa_listheader-typ = 'H'.

    l_wa_listheader-key = 'Heading one'. "write ur heading text here

    l_wa_listheader-info = 'Heading two'. "if u want u can have seperate typ & key for second heading

    append l_wa_listheader to p_tab_listheader.

    l_wa_llistheader-typ = 'A'.

    l_wa_listheader-key = sy-datum.

    append l_wa_listheader to p_tab_listheader.

    l_wa_llistheader-typ = 'A'.

    l_wa_listheader-key = sy-uzeit.

    append l_wa_listheader to p_tab_listheader.

    l_wa_event-form = slis_ev_top_of_page.

    l_wa_event-name = 'TOP_OF_PAGE'.

    append l_wa_event to p_tab_event.

    ****Now write a subroutine for top of page****

    form top_of_page

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    • i_logo = 'XXXXX'

    it_list_commentary = l_tab_header.

    endform.

    Hope i've answered to ur question.....and please dont forget to <b>reward points</b>.....

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:28 AM

    Hi Dipika

    chk this one

    FORM TOPPAGE.

    REFRESH I_LISTHEADER.

    DATA: ld_lines type i,

    ld_linesc(10) type c,

    I_DATE(10) TYPE C,

    I_INFO LIKE WA_LISTHEADER-INFO.

    WA_LISTHEADER-TYP = 'H'.

    WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.

    APPEND WA_LISTHEADER TO I_LISTHEADER.

    CLEAR WA_LISTHEADER.

    WA_LISTHEADER-TYP = 'S'.

    WA_LISTHEADER-KEY = 'DATE :'.

    CONCATENATE SY-DATUM+6(2) '.'

    SY-DATUM+4(2) '.'

    SY-DATUM(4) INTO I_DATE.

    WA_LISTHEADER-INFO = I_datE.

    APPEND WA_LISTHEADER TO I_LISTHEADER.

    CLEAR WA_LISTHEADER.

    describe table ITAB lines ld_lines.

    ld_linesc = ld_lines.

    concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc

    into I_INFO separated by space.

    WA_LISTHEADER-TYP = 'A'.

    WA_LISTHEADER-INFO = I_INFO.

    append WA_LISTHEADER to I_LISTHEADER.

    clear: WA_LISTHEADER , I_INFO.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    IT_LIST_COMMENTARY = I_LISTHEADER

    I_LOGO = 'ENJOYSAP_LOGO'.

    ENDFORM. "TOPPAGE

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = sy-repid

    • I_CALLBACK_PF_STATUS_SET = ' '

    I_CALLBACK_USER_COMMAND = 'USER-COMMAND'

    I_CALLBACK_TOP_OF_PAGE = 'TOPPAGE' -


    >

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    I_GRID_TITLE = I_TITLE_MARA

    • I_GRID_SETTINGS =

    IS_LAYOUT = I_LAYOUT

    IT_FIELDCAT = fieldcat

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    IT_SORT = SORT[]

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    IT_EVENTS = V_EVENTS

    • IT_EVENT_EXIT =

    IS_PRINT = PRINT_CONT

    TABLES

    T_OUTTAB = ITAB

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    .

    reward points to all helpful answers

    kiran.M

    Add comment
    10|10000 characters needed characters exceeded