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: 

finding total no.of pages in ALV.

Former Member
0 Kudos

Hello All,

I have used the class "CL_SALV_HIERSEQ_TABLE" to display Hierarchical-Sequential ALV.

I have got the event TOP_OF_PAGE from the method GET_EVENT and using this event

I am able to print the current page number(event has exporting parameter page)

on every page while printing.

Now I require the total no.of pages so that I can print in x of YY method.

x - currrent page

YY - total no.of pages.

As this is Hierarchical ALV I dont think it is a good idea to count the total no.of records

in internal table and calculate the no.of pages.

Help me in solving this

With regards,

Sandeep akella

Edited by: sandeep akella on Feb 4, 2011 10:20 AM

5 REPLIES 5

Ramneek
Advisor
Advisor
0 Kudos

Hello Sandeep,

I do not think there is a parameter / attribute to get the total number of pages. If you look at the call stack then the page number is also from the field SY-PAGNO (Current List Page). Hence I think you will have to calculate the total number of pages using the number of rows being displayed on the screen and the number of rows in the table as suggested in a lot of other posts on SDN.

Thank you,

Ramneek

Former Member
0 Kudos

Hello Ramneek,

But how can we calculate the no.of lines that can excatly fit in a page, because in normal ALV the rows are fixed

so by counting the no.of records in internal table we can come to a conclusion. But in hierarchical ALV there is user action involved with expanding the rows as well as closing them, changing the layout like making header or item details to appear in line1,line2 and line3. So I think it is very difficult in that way.

Could you please suggest any other method for this.

With regards,

sandeep akella.

Clemenss
Active Contributor
0 Kudos

Hi sandeep,

page totals online with user interaction does not make much sense - you may display the total number of table lines here.

When printed, the page number depends on the used printer format. You may count pages in top-of-page event.

Regards,

Clemens

Former Member
0 Kudos

Hello all,

Can we redefine the standard method for top_of_page event, so that the text is not printed,

but rather prepared for printing and buffered. Then we can manipulate it like we do in classical reporting or

Pick up the spool request after the program is finished and modify its data before printing and then print.

with regards,

sandeep akella.

Former Member
0 Kudos

An option for selecting 1. display in ALV and 2. Print in classical report is provided in the selection screen.

Depending on the selection ALV or classical report is dispalyed.

In Heirarchical ALV the option of print and print preview are disabled by setting the set_print method of class cl_salv_functions_list to flase.