top_of_page Query in ALV

I have an ALV report.  I want the event top_of_page to occur only on the first page of the report output.
How can this be done?

I tried using top_of_list too, but using this the heading does not come at all.  Actually the report output is printed and so the heading in top_of_page is required only on the first page.

For print in top_of_page you can use following code.

  FORM top_of_page.
  DATA: ls_line TYPE slis_listheader.
  CLEAR : ls_line .REFRESH gs_line.
  DATA: ws_text(100),
  ws_todate(10),
  ws_frmdate(10),
  id_lines TYPE i,
  id_linesc(10) TYPE c,
  t_line LIKE ls_line-info.
  ls_line-typ = 'H'.
  ls_line-info = 'CUSTOMER C-FORM AND E-1 FORM DETAIL'.
  APPEND ls_line TO gs_line.
  CLEAR ls_line.
  DESCRIBE TABLE i_vbrk3 LINES id_lines.
  id_linesc = id_lines.
  CONCATENATE 'Total No. of Record Selected :- ' id_linesc INTO t_line SEPARATED BY space.
  ls_line-typ = 'A'.
  ls_line-info = t_line.
  APPEND ls_line TO gs_line.
  CLEAR: ls_line, t_line.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
  it_list_commentary = gs_line.
  ENDFORM. "top_of_page

Tips by : Gopal Arora

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.