Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv

Former Member
0 Likes
531

Hi,

Can we have header and footer in alv?

if s how ?

Pls help.

Regards,

kb

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
505
Read only

0 Likes
505

hi,

can i have the fn called z_yhead_print.

Regards,

kb

Read only

Former Member
0 Likes
505

refer program BCALV_TEST_GRID_EVENTS

Check for events: TOP_OF_LIST, END_OF_LIST, TOP_OF_PAGE, END_OF_PAGE.

Read only

Former Member
0 Likes
505

Hi,

<b>Add Title(heading) to ALV Grid </b>

In order to insert a report heading in to the ALV grid you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM

2. Create 'top-of-page' FORM

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • Form TOP-OF-PAGE *

----


  • ALV Report Header *

----


Form top-of-page.

*ALV Header declarations

data: t_header type slis_t_listheader,

wa_header type slis_listheader,

t_line like wa_header-info,

ld_lines type i,

ld_linesc(10) type c.

  • Title

wa_header-typ = 'H'.

wa_header-info = 'EKKO Table Report'.

append wa_header to t_header.

clear wa_header.

  • Date

wa_header-typ = 'S'.

wa_header-key = 'Date: '.

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum(4) INTO wa_header-info. "todays date

append wa_header to t_header.

clear: wa_header.

  • Total No. of Records Selected

describe table it_ekko lines ld_lines.

ld_linesc = ld_lines.

concatenate 'Total No. of Records Selected: ' ld_linesc

into t_line separated by space.

wa_header-typ = 'A'.

wa_header-info = t_line.

append wa_header to t_header.

clear: wa_header, t_line.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header.

  • i_logo = 'Z_LOGO'.

endform.

<b>

In order to add a footer</b> which is always displayed on screen to an ALV grid report you need to perform

the steps below. Please note this will not be displayed in the printed output

Step 1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'i_callback_html_end_of_list'

Step 2. Create new FORM 'END_OF_LIST_HTML' for building footer

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

i_callback_html_end_of_list = 'END_OF_LIST_HTML'

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

&----


*& Form end_of_list_html

&----


  • output at the end of the list - not in printed output *

&----


FORM end_of_list_html USING end TYPE REF TO cl_dd_document.

DATA: ls_text TYPE sdydo_text_element,

l_grid TYPE REF TO cl_gui_alv_grid,

f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.

ls_text = 'Footer title'.

  • adds and icon (red triangle)

CALL METHOD end->add_icon

EXPORTING

sap_icon = 'ICON_MESSAGE_ERROR_SMALL'.

  • adds test (via variable)

CALL METHOD end->add_text

EXPORTING

text = ls_text

sap_emphasis = 'strong'.

  • adds new line (start new line)

CALL METHOD end->new_line.

  • display text(bold)

CALL METHOD end->add_text

EXPORTING

text = 'Bold text'

sap_emphasis = 'strong'.

  • adds new line (start new line)

CALL METHOD end->new_line.

  • display text(normal)

CALL METHOD end->add_text

EXPORTING

text = 'Normal text'.

  • adds new line (start new line)

CALL METHOD end->new_line.

  • display text(bold)

CALL METHOD end->add_text

EXPORTING

text = 'Yellow triangle'

sap_emphasis = 'strong'.

  • adds and icon (yellow triangle)

CALL METHOD end->add_icon

EXPORTING

sap_icon = 'ICON_LED_YELLOW'.

  • display text(normal)

CALL METHOD end->add_text

EXPORTING

text = 'More text'.

*set height of this section

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = l_grid.

CALL METHOD l_grid->parent->parent->(f)

EXPORTING

id = 3

height = 14.

ENDFORM. "end_of_list_html

hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
505

thanks