This website is not affiliated with, sponsored by, or approved by SAP AG.

Page no's in ALV Grid

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Page no's in ALV Grid

Postby guest_hr » Tue Aug 19, 2003 8:48 am

Hi,

Does anyone have any idea on how to get page no's printed on an ALV List?... Have tried sy-pagno on top_of_page event ... Does not seem to work :cry:
guest_hr
 

Postby Pistache » Tue Aug 19, 2003 11:32 am

See the example bcalv_grid_01.

1) create a local class
2) Create the object
3) Add after the method
set_table_for_first_display

********
* ->Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
*
* § 4. Link used print events and event handler methods.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_TOP_OF_LIST FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_TOP_OF_PAGE FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_END_OF_LIST FOR GRID1.
SET HANDLER EVENT_RECEIVER->HANDLE_END_OF_PAGE FOR GRID1.
*
********

i just make it this morning
Pistache
 
Posts: 29
Joined: Wed Aug 13, 2003 12:39 pm

Postby Guest » Tue Oct 14, 2003 2:32 am

Hi Postache,

I also have the same question guest_hr.
I have go through the example 'bcalv_grid_01' but it does not work.
If I put the sy-pagno in the 'Print Top of Page', it will only show 'Page 0' for all pages.

Do you have any existing example to share?

Thanks in advance.

Regards,
June
Guest
 

Postby june65 » Tue Oct 14, 2003 2:38 am

:shock:
june65
 
Posts: 44
Joined: Tue Jul 15, 2003 8:42 pm
Location: Singapore

Postby Pistache » Tue Oct 14, 2003 6:36 am

Hi June 65

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.


Then it will display the number of page at each end-of page but dont forgette to reserve space for the end of page when you creat your grid.
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.



Pistache
Pistache
 
Posts: 29
Joined: Wed Aug 13, 2003 12:39 pm

Postby june65 » Wed Oct 15, 2003 7:43 pm

Hi Pistache,

Thanks greatly for your help.

Have you try to print the total pages? Example like, Page 1 of 4.

Thanks & Regards.
june :wink:
june65
 
Posts: 44
Joined: Tue Jul 15, 2003 8:42 pm
Location: Singapore

Postby Guest » Thu Oct 16, 2003 6:39 am

Regrettably not, it would be necessary to look at the structures and at the methods of the class it has there probably an information which SAP returns to us but me I not yet taken time to look that. :cry:

Pistache
Guest
 

TOP_OF_PAGE in ALV GRID

Postby mns40 » Mon Jun 13, 2005 11:04 pm

Hi

Can some one please send me a sample code for Top_OF_PAGE using ALV GRID. I declared the local class and method but no luck.

Thanks in advance
mns40
 


Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 10 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.