Application Development 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: 

how to display page no: in alv grid display

Former Member
0 Kudos

hi..

how to display page no: in alv grid display

5 REPLIES 5

Former Member
0 Kudos

Hi,

If you want it at the bottom or top of page

trigger the end-of-page or top-of-page accordingly

and use sy-pagno to display it

Former Member
0 Kudos

hi,

in REUSE_ALV_GRID_DISPLAY fm once check for I_CALLBACK_TOP_OF_PAGE export parameter.

EXIT routine for handling TOP-OF-PAGE

Description

If the caller specifies an EXIT routine, this routine must have the following form:

FORM top_of_page.

Module REUSE_ALV_COMMENTARY_WRITE can then be called within the EXIT routine. This module is responsible for formatting the header information and also ensures online HTML formatting. In the print preview or in batch mode, the text passed is then output in the normal format.

If module REUSE_ALV_COMMENTARY_WRITE cannot be used, you must use two parameters instead. In I_CALLBACK_TOP_OF_PAGE you pass the form routine that is responsible for normal formatting in batch mode or in the print preview mode. The form routine that is responsible for online formatting, is passed in parameter I_CALLBACK_HTML_TOP_OF_PAGE. If one of these parameters is not filled, top-of-page is not output in the respective mode.

i think it will help u

Former Member
0 Kudos

Hello to you..

I'm not sure if you're pertaining to the display of page number in ALV Grid Report when printing. Anyway, hope this might help.

1. Run the report.

2. Select 'Change Layout'.

3. Go to 'Display Tab'.

4. Check 'Printout with Date, Title, and Page Number.

April

Former Member
0 Kudos

You cannot use sy-pagno because Grid does not use those variables system. You have to catch the event of creation of page of the class. It is what demonstrates the example bcalv_grid_01. Decide where you want to put the number of page finds the event to connect, in this case it is at the end of the page, then makes a conter in this method which you make show the number of page. In bcalv_grid_01 the method ANDLE_END_OF_PAGE was called at end of page event is thus logical to tell to put a conter which will indicate the number of page, because it will be call each time a new page is called.

SO first create a local class

CLASS LCL_EVENT_RECEIVER DEFINITIOn.

PUBLIC SECTION.

HANDLE_END_OF_PAGE

FOR EVENT PRINT_END_OF_PAGE OF CL_GUI_ALV_GRID.

PRIVATE SECTION.

DATA: PAGENUM TYPE I.

ENDCLASS.

CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.

METHOD HANDLE_END_OF_PAGE.

DATA: TABLENAME(30) TYPE C.

ADD 1 TO PAGENUM.

WRITE: /,'Event: PRINT_END_OF_PAGE'(003),

'Number of pages so far: '(004), PAGENUM.

ENDMETHOD. "handle_end_of_page

Endclass.

Then in your report

Put some where

CREATE OBJECT EVENT_RECEIVER.

SET HANDLER EVENT_RECEIVER->HANDLE_END_OF_PAGE FOR GRID1.

<b>Then it will display the number of page at each end-of page but don't forget to reserve space for the end of page when you create your grid.</b>

GS_PRINT-RESERVELNS = 2.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

IS_PRINT = GS_PRINT

IS_LAYOUT = GS_LAYOUT

CHANGING IT_OUTTAB = GT_SFLIGHT.

Regards,

Pavan

Former Member
0 Kudos

hi

check the below thread, it has the same query as yours

<b>reward points if helpful

Regards</b>