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

ALV Grid Display

Hi experts,

I have 3 variables

g_var1,

g_var2 and

g_var3.

I need to display these 3 variables on the top of page of an ALV Grid Display. Kindly help me, if possible with a sample code on how do i go about this and what parameters to pass in the FM for top of page.

Points will be rewarded.

Thanks and regards,

Frank.

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 Mar 20, 2008 at 04:59 AM

    Hi,

    check this sample one

    ----


    • FORM ALV_TOP_OF_PAGE *

    ----


    FORM alv_top_of_page.

    DATA: l_title(100).

    DATA: l_recs TYPE i,

    l_recs_c(10),

    l_exdate(10),

    l_stext(80),

    l_svalue(80),

    l_index LIKE sy-tabix,

    l_count TYPE i.

    CLEAR: i_list_comments[].

    WRITE sy-datum TO l_exdate.

    l_title = sy-title.

    DESCRIBE TABLE gt_output LINES l_recs.

    l_recs_c = l_recs.

    w_list_comments-typ = 'H'. " H=Header, S=Selection, A=Action

    w_list_comments-key = ''.

    w_list_comments-info = l_title.

    APPEND w_list_comments TO i_list_comments.

    w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action

    w_list_comments-key = ''.

    CONCATENATE text-td1 l_exdate INTO w_list_comments-info

    SEPARATED BY space.

    APPEND w_list_comments TO i_list_comments.

    w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action

    w_list_comments-key = ''.

    CONCATENATE text-td2 l_recs_c INTO w_list_comments-info

    SEPARATED BY space.

    APPEND w_list_comments TO i_list_comments.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    • i_logo = ''

    it_list_commentary = i_list_comments.

    ENDFORM. "alv_top_of_page

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • i_background_id = 'SIWB_WALLPAPER'

    i_callback_program = w_repid

    i_callback_html_top_of_page = w_html_top_of_page

    • i_structure_name = 'TRDIR'

    i_default = 'X'

    i_save = 'A'

    is_variant = w_variant

    is_layout = w_layout

    i_callback_user_command = w_callback_ucomm

    it_fieldcat = i_fieldcat_alv

    it_events = i_events

    it_event_exit = i_event_exit

    it_excluding = i_excluding

    is_print = w_print

    TABLES

    t_outtab = gt_output.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 04:59 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 05:07 AM

    Hi

    data: it_listheadr TYPE slis_t_listheader WITH HEADER LINE ,

    wa_listheadr LIKE LINE OF it_listheadr.

    FORM top_of_page.

    REFRESH it_listheadr.

    wa_listheadr-typ = 'H'.

    wa_listheadr-info = text-001.

    APPEND wa_listheadr TO it_listheadr.

    CLEAR wa_listheadr.

    wa_listheadr-typ = 'H'.

    wa_listheadr-info = text-001.

    APPEND wa_listheadr TO it_listheadr.

    CLEAR wa_listheadr.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_listheadr[]

    i_logo = 'ENJOYSAP_LOGO'. "From OAER transaction

    • I_END_OF_LIST_GRID = I_END_OF_LIST_GRID

    • I_ALV_FORM = I_ALV_FORM

    ENDFORM. "TOP_OF_PAGE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 05:08 AM

    Hi ,

    Kindly let me know as to where do i use g_var1, g_var2 and g_var3.........these are the 3 variables that i need to display in the Top of Page.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 05:27 AM

    Hi Frank,

    Here is the procedure to handle TOP_OF_PAGE event in ALV GRID display.

    1.

    declare events table like this.

    data :
           i_events  type slis_t_event,
          w_events  like line of i_events.

    2.

    Build events table .

    w_events-name = 'TOP_OF_PAGE' .
        w_events-form   = 'TOP_OF_PAGE' .
        append w_events to i_events.
        clear w_events.

    3.

    pass this events table through REUSE_ALV_GRID_DISPLAY.

    4.

    TOP_OF_PAGE call back should be like this in your case. This is nowhere called using PERFORM statement in ur program.

    *&---------------------------------------------------------------------*
    *&      Form  top_of_page
    *&---------------------------------------------------------------------*
    FORM top_of_page.
    
      DATA :li_header TYPE slis_t_listheader,
            w_header LIKE LINE OF li_header.
    
      w_header-typ  = 'S'.
      w_header-info = g_var1.
      APPEND w_header TO li_header.
      CLEAR w_header.
    
      w_header-typ  = 'H'.
      w_header-info = g_var2.
      APPEND w_header TO li_header.
      CLEAR w_header.
    
      w_header-typ  = 'A'.
      w_header-info = g_var3.
      APPEND w_header TO li_header.
      CLEAR w_header.
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = li_header.
    
    ENDFORM.                    " top_of_page

    5.

    Instead of all 1and 2 steps you can just pass TOP_OF_PAGE the above subroutine theough REUSE_ALV_GRID_DISPLAY in the exporting parameters.

    I hope that u will get it.

    Regards,

    Venkat.O

    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.