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: 

New Page with ALV O.O

Former Member
0 Kudos

Hello Everyone,

I am printing an ALV report using O.O (CL_GUI_ALV_GRID). Is there any Method or another way that I can start a new page during printing, like the command “NEW-PAGE” during list processing?

Thanks in advance.

Regards,

Roni.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You will be displaying the ALV using the method "SET_TABLE_FOR_FIRST_DISPLAY".

There is a changing parameter in that method called "IT_SORT" which is of the type LVC_T_SORT.Fill this table for specifying the sort criteria and the page break.For eg

data :

gt_sort type LVC_T_SORT,

wa_sort type LVC_S_SORT.

Now suppose you have to show a new page based on "Plant"(WERKS),you can fill the table like this

wa_sort-SPOS = '1'.

wa_sort-FIELDNAME = 'WERKS'.

wa_sort-UP = 'X'.

wa_sort-SUBTOT = 'X'.

wa_sort-GROUP = '*'. "Used to display page break

append wa_sort to gt_sort.

Just pass this table to the method "SET_TABLE_FOR_FIRST_DISPLAY" and you should get a new page based on plant.

5 REPLIES 5

Former Member
0 Kudos

You will be displaying the ALV using the method "SET_TABLE_FOR_FIRST_DISPLAY".

There is a changing parameter in that method called "IT_SORT" which is of the type LVC_T_SORT.Fill this table for specifying the sort criteria and the page break.For eg

data :

gt_sort type LVC_T_SORT,

wa_sort type LVC_S_SORT.

Now suppose you have to show a new page based on "Plant"(WERKS),you can fill the table like this

wa_sort-SPOS = '1'.

wa_sort-FIELDNAME = 'WERKS'.

wa_sort-UP = 'X'.

wa_sort-SUBTOT = 'X'.

wa_sort-GROUP = '*'. "Used to display page break

append wa_sort to gt_sort.

Just pass this table to the method "SET_TABLE_FOR_FIRST_DISPLAY" and you should get a new page based on plant.

Former Member
0 Kudos

Thanks.

It works.

0 Kudos

Hi Ravi,

I had a similar requirement, and your code works perfectly fine. But i am still having a problem while printing. Event top_of_page gets printed only in first page, not in other pages. So is there any other way i get the page break along with top_of_page content?

Regards,

Lavanya.

0 Kudos

Hi Lavanya,

If you want to print for each page break you can use the event PRINT_TOP_OF_PAGE.

Regards,

Roni.

0 Kudos

Hi Roni,

My roblem was resolved in conventional ALV reporting. In one of my other program, i am using OOALV and the container is split in two two part; top-of-page content is displayed in upper grid. When i print the report from lower grid, the content of top-of-page is not getting printed, though it appears on the screen. I tried print_top_of_page event as well. Is there any other printer settings that need to be passed?

Thanks,

Lavanya.