Skip to Content
0
Former Member
May 09, 2006 at 06:00 AM

How to Change Page Number in ALV List Report

36 Views

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.