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 Change Page Number in ALV List Report

Former Member
0 Kudos

HI,

I have creates a <b>ALV List report</b> and put a Header above it with all required information.

In the Header i have <b>Page Number</b> also.

But though <b>ALV List Report</b> contains multiple Page it is showing <b>PAGE NUMBER</b> as <b>1</b> on each and every page.

How can i change the <b>Page Number</b> as per Correct <b>Page No</b>.

I had posted code i have written for the <b>ALV</b> below.

<b>FORM f_build_events.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = i_events.

READ TABLE i_events

INTO wa_events

WITH KEY name = slis_ev_top_of_page.

IF sy-subrc = 0.

MOVE 'F_TOP_OF_PAGE' TO wa_events-form.

MODIFY i_events FROM wa_events INDEX sy-tabix.

ENDIF.

ENDFORM. "f_build_events

FORM f_build_layout.

i_layout-no_input = c_x.

i_layout-colwidth_optimize = c_x.

i_layout-totals_text = 'Totals'(201).

ENDFORM. " f_build_layout

FORM f_display_alv_report .

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

is_layout = i_layout

it_fieldcat = i_fieldcatalog[]

it_events = i_events

i_save = c_x

TABLES

t_outtab = i_alv_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " f_display_alv_report

And Finally TOP-OF-PAGE Perform is as below:

FORM f_top_of_page .

DATA: i_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

v_date(10) TYPE c,

v_time LIKE sy-uzeit,

v_pageno TYPE c,

v_separator(3) VALUE ' ',

v_separator1(7) VALUE ' ',

v_separator2(20) VALUE ' '.

v_pageno = sy-pagno.

WRITE sy-uzeit TO v_time USING EDIT MASK c_editmask.

WRITE sy-datum TO v_date USING EDIT MASK c_editmask1.

  • Header

wa_header-typ = c_h.

CONCATENATE text-011

sy-repid

INTO wa_header-info SEPARATED BY space.

CONCATENATE wa_header-info

text-012

INTO wa_header-info SEPARATED BY v_separator.

CONCATENATE wa_header-info

text-013

INTO wa_header-info SEPARATED BY space.

CONCATENATE wa_header-info

v_pageno

INTO wa_header-info SEPARATED BY space.

APPEND wa_header TO i_header.

CLEAR wa_header.

wa_header-typ = c_h.

CONCATENATE text-014

v_date

INTO wa_header-info SEPARATED BY space.

CONCATENATE wa_header-info

text-015

INTO wa_header-info SEPARATED BY space.

CONCATENATE wa_header-info

v_time

INTO wa_header-info SEPARATED BY space.

CONCATENATE wa_header-info

text-016

INTO wa_header-info SEPARATED BY v_separator1.

APPEND wa_header TO i_header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_header.

ENDFORM. " f_top_of_page</b>

Can anybody tell me what changes i have to make to above code so that my <b>Page Number</b> will change as per correct page number.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

1 More issue in Above <b>ALV List Report</b> is My Header is displayed upto <b>60</b> Characters in Every line above <b>ALV List</b>.

What ever extra characters i give are hidden off.

What i have to do to Make the <b>Header</b> displayed about <b>150-200</b> characters in every line.

Thanks in advance.

Thanks & Regards,

Prasad.

11 REPLIES 11

Former Member
0 Kudos

Hi,

1 More issue in Above <b>ALV List Report</b> is My Header is displayed upto <b>60</b> Characters in Every line above <b>ALV List</b>.

What ever extra characters i give are hidden off.

What i have to do to Make the <b>Header</b> displayed about <b>150-200</b> characters in every line.

Thanks in advance.

Thanks & Regards,

Prasad.

0 Kudos

Hi Prasad,

1. it is not possible to change your Page number dynamically in ALV list.

2. to increase your Header 150-200 then you should increase your display fields outputlength more.

<b>fieldcat-outputlen = 10</b> try to increase that to all in such a way that their sum should fall in 150-200 .

Regards

vijay

0 Kudos

Hi,

My ALV List Output sum is <b>250+</b> only.

But Header is not being allowed more than 60 why!

If i include all fields lengths in field catalog<b>[fieldcat-outputlen]</b> in code it is more than <b>200</b>, the problem is actually with the header above it.

Which i am writing using <b>REUSE_ALV_COMMENTARY_WRITE</b>.

Can anybody give the solution for the 2 issues i have raised in this post.

Thanks,

Prasad.

0 Kudos

Hi Prasad,

sorry, and are you using LIST FM or GRID FM.

if it is LIST FM then you can use write statements. don't use comentary write fm. for that.

if it is GRID then you can't , you have to saty with that....

Regards

vijay

0 Kudos

HI,

I am using ALV List F.M only. REUSE_ALV_LIST_DISPLAY

Thanks,

Prasad.

0 Kudos

Hi Prasad,

use Write statements instead of FM, then you will be able to see the full text. with the FM it is not possible. i hope you might be using the standard header in some other reports use the same in this also.

Regards

vijay

0 Kudos

HI,

I had replaced ALV Header part with Standard Header which we use for other Classical/Interactive Rrports.

Code is as below which is written in TOP-OF-PAGE event:

<b>* Write general header details

WRITE: / text-011,

14 sy-repid,

71 text-012,

134 text-013,

138 sy-pagno.

  • Write date/time and program name

WRITE: / text-014,

15 sy-datum,

25 text-015,

28 sy-uzeit USING EDIT MASK c_editmask,

67 text-016,

sy-uline.

SKIP 1.</b>

Now still page number is getting displayed in normal way as <b>PAGE NUMBER: 1</b> in each and every page.

How can i change it!

Thanks,

Prasad.

0 Kudos

Hi Prasad,

have u declared line-count

REPORT ZDEMO line-count 45(5).

0 Kudos

hi Prasad,

page number you can't capture ,since it is a ALV report. it is not possible to capture the page number and print in the top of page.

if it is normal report you can get that using some code.

Regards

vijay

0 Kudos

HI,

Yes LINE_COUNT 60 is alreay in place.

But after that also PAGE: 1 is displayed on every page.

Thanks,

Prasad.

0 Kudos

HI,

Can anybody tell me how to change my Page NUmber diplayed above ALV List Report to be changed on every page.

It is currently being displayed as 1 on every page.

My code is as below:

The below code is in TOP-OF-PAGE PERFORM.

<b>* Write general header details

WRITE: / text-011,

14 sy-repid,

71 text-012,

134 text-013,

138 sy-pagno.

  • Write date/time and program name

WRITE: / text-014,

15 sy-datum,

25 text-015,

28 sy-uzeit USING EDIT MASK c_editmask,

67 text-016,

sy-uline.

SKIP 1.</b>

Can anybody have the solution for the same.

Thanks in advance.

Thanks & Regards,

Prasad.