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: 

alv page numbers

Former Member
0 Kudos

Hi,

iam displaying output using alv grid(function modulues).

i want to display the page numbers like 1 of 4(total pages) in top-of-page.

how can i display?

Regards,

suresh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Suresh,

Just a thought...if you know the no of records those will be displayed on each page and the total number of records to be displayed well in advance then , do the math in a small form and import that in variables. I doubt if there is any command for this. You will have to take into consideration the screen resolution etc though.

2 REPLIES 2

Former Member
0 Kudos

Suresh,

Just a thought...if you know the no of records those will be displayed on each page and the total number of records to be displayed well in advance then , do the math in a small form and import that in variables. I doubt if there is any command for this. You will have to take into consideration the screen resolution etc though.

Former Member
0 Kudos

This functionality can be triggerred only when u take a printout of the ALV!!

This code needs to be written in the END-of-Page event!

Here's come to to help u out

DATA:   v_temp TYPE f,
          v_rec TYPE i,
          v_page TYPE i,
          v_pagno TYPE string,
          v_cpage TYPE string,
          v_page2 TYPE string,
          v_div TYPE i,
          v_lincnt TYPE sy-linct.
* Calculate & Display the number of pages during printout
  v_lincnt = sy-linct.
  DESCRIBE TABLE it_output LINES v_rec.
 
  IF v_lincnt LE 11.
    v_lincnt = 58.
  ENDIF.
  v_div = v_lincnt - 11.
  v_temp = ( v_rec / v_div ).
 
  v_page = TRUNC( v_temp ).
  v_temp = FRAC( v_temp ).
  IF v_temp = 0.
  ELSE .
    v_page = v_page + 1.
  ENDIF.
  v_cpage = sy-pagno.
  v_page2 = v_page.
 
  CONCATENATE text-055 "page
              v_cpage 
              text-056 "of
              v_page2
              INTO
              v_pagno SEPARATED BY space.
  IF sy-linct GT 11.
    WRITE AT (sy-linsz)  v_pagno RIGHT-JUSTIFIED.
  ENDIF.

try this link also.

https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=27043

Hope this helps you.....

Regards

Hareesh