To determine the page length of each page individually, use the NEW-PAGE statement:
NEW-PAGE LINE-COUNT length .
This statement defines the page length of the following pages for length . length can be a variable. If you set length to zero, the system uses the standard page length (see also Structure of the Standard List ). The page header is part of the page and thus of the page length.
You cannot use NEW-PAGE to create or change a page footer. A page footer defined in the REPORT statement (see Determining the Page Length ) is kept as such, independent of a NEW-PAGE statement.
For the actual list output, length minus the page header length and the page footer length is available.
When using the LINE-COUNT addition of the NEW-PAGE statement, refer to the notes in Determining the Page Length .
To adapt the page length to the current window length, set length to sy-rows . The sy-rows system field contains the number of lines of the current window.
REPORT demo_list_new_page_line_c_1 LINE-SIZE 40 LINE-COUNT 0(1). END-OF-PAGE. ULINE. START-OF-SELECTION. NEW-PAGE LINE-COUNT 5. DO 4 TIMES. WRITE / sy-index. ENDDO. WRITE: / 'Next Loop:'. NEW-PAGE LINE-COUNT 6. DO 6 TIMES. WRITE / sy-index. ENDDO.
This program creates five pages of different lengths. The list header text element is defined as 'Standard Page Header' . The REPORT statement reserves one line of each page for the page footer. The page footer is defined in the END-OF-PAGE event as an underlining (horizontal) line. The first NEW-PAGE statement sets the page length to 5, the second to 6.
The first NEW-PAGE statement does not start a new page, since no output was written to the list before. The standard page header uses two lines of each page for the list header. The page footer uses one line. For the first DO loop, two lines per page can be used for the WRITE statement. All page breaks within the DO loop occur automatically as soon as the list processing reaches the page footer. The system then displays the page footer. The second NEW-PAGE statement creates a page break from the third to the fourth page. Here, the END-OF-PAGE event is not processed. For the second DO loop, three lines per page can be used to WRITE output. Page breaks again occur automatically . The page footer appears.
REPORT demo_list_new_page_line_c_2 NO STANDARD PAGE HEADING LINE-SIZE 40 LINE-COUNT 0(2). TOP-OF-PAGE. WRITE: 'Top of Page', sy-pagno, 'SY-SROWS:', sy-srows. ULINE. END-OF-PAGE. ULINE. WRITE: 'End of Page', sy-pagno. START-OF-SELECTION. * NEW-PAGE LINE-COUNT SY-SROWS. DO 100 TIMES. WRITE / sy-index. ENDDO.
This program creates one single endless page, since the NEW-PAGE statement is marked as comment:
The system displays as many lines as possible in the current window, which has a length of 12 lines. In the figure above, the 12 lines are made up of two self-defined header lines and 10 lines of the actual list. When you scroll vertically, the page header remains visible. If you remove the asterisk in front of the NEW-PAGE statement and keep the current window length, the output looks as follows:
The list is now separated into several pages where, according to sy-rows , each page is 12 lines long. Of these 12 lines, two are reserved for the page header and two for the footer. In this list, the user can scroll explicitly using Next page (for example, to page 11):