Continuous/Sequential Page Numbering in Multi-tab Webi Document
Many a time, we’ve seen users and/or developers wanting to be able to display (and/or print) continuous/sequential page numbers in a multi-tab Webi document.
Suppose, we’ve a Webi Document with 3 tabs, Tab 1 having 3 pages worth of data in Page mode, Tab 2 having 5 pages worth of data in Page mode, and Tab 3 having 10 pages worth of data in Page mode. We’d like to display (and/or print):
- Page numbers 1-3 in Tab 1
- Page numbers 4-8 in Tab 2 (instead of resetting and displaying 1-5) and
- Page numbers 9-18 in Tab 3 (instead of resetting and displaying 1-10)
This workaround will come handy.
Create the below variables:
- Total Number of Pages in Tab 1 = 0 (don’t worry, its OK, we’ll update it later, to function dynamically)
- Total Number of Pages in Tab 2 = 0 (don’t worry, its OK, we’ll update it later, to function dynamically)
- Total Number of Pages in Tab 3 = 0 (don’t worry, its OK, we’ll update it later, to function dynamically)
- Total Number of Pages in Document = [Total Number of Pages in Tab 1] + [Total Number of Pages in Tab 2] + [Total Number of Pages in Tab 3]
- Page Numbers in Tab 1 = Page() + ” of ” + [Total Number of Pages in Document]
- Page Numbers in Tab 2 = ([Total Number of Pages in Tab 1] + Page()) +” of ” + [Total Number of Pages in Document]
- Page Numbers in Tab 3 = ([Total Number of Pages in Tab 1] + [Total Number of Pages in Tab 2] + Page()) +” of ” + [Total Number of Pages in Document]
- In Tab 1, create a single value Input Control with the variable object [Total Number of Pages in Tab 1] with Entry Field option, so we’re able to manually type-in values.
- Similarly, create an input control in Tab 2 with [Total Number of Pages in Tab 2]
- Similarly, create an input control in Tab 3 with [Total Number of Pages in Tab 3]
Displaying the Page Numbers:
- Drag and drop a Vertical Table in Tab 1 in Header or Footer (wherever we want to show the Page Numbers), hide the Header row and add =[Page Numbers in Tab 1] variable for formula in its body cell/row. (Update as of 15th Nov, 2016 4pm EST: Page number to be displayed in a Vertical Table instead of a Blank Cell, as we want to do some conditional formatting. Blog will be updated in the near future.)
- Similarly, in Tab 2, using [Page Numbers in Tab 2]
- Similarly, in Tab 3, using [Page Numbers in Tab 3]
Voila, we’re done.
1. Every time we refresh the report or update the structure of the report by adding tables or charts, we need to open each tab and manually check the last page number and type that number in the Input Control of that tab. And then, we can print it or save it to PDF.
Note: This will display (and/or print) page numbers as 1 of 18 and so on, as we’ve a [Total Number of Pages in Document] variable. We can customize if we don’t need that ” of 18″ part.
2. Please make sure to type in Numbers only in the Input Control, if we type in text, it’ll mess up the formulas and hence the page numbers displayed in one or all the tabs may be wrong.
Try it and let me know your feedback.
Cool Mahboob!!! This will come handy.
What about if schedule the report or publication?
If manually need to enter the the number in the input control then user can enter the total page in the footer/header or variables also?
Thanks for reading my blog post!!!
That's a good question, the problem with making it work for Scheduled Reports and/or Publication is that, we don't a way to find out NumberofPages() per each tab, if there are more than 1 tabs. Meaning, we can create a formula as =NumberofPages() where (ReportName()="Tab 1"), as ReportName() changes with the tab.
I'd like to see if someone can come up with a logic to save the NumberofPages() which shows Total Number of Pages in a tab in a variable without having to use the Input Control as I did. If someone can do it, this truly will be a relief for many Users and/or Developers.
Perhaps, SAP should come up with a function or feature.
Nice idea. You could probably take it a step further with conditional formatting by having a number of pages cell that gets overwritten when you fill in the input control for that tab. Colour it yellow initially to show that the input control needs populating then set the background to white once the input control has been entered.
Great idea Mark!
A fully automated solution would be to develop an extension to post-process the exported PDF (the user usually cares less about the numbering in the html viewer). For that you would need some basic Java skills and a PDF processing library like iText. You can write a standalone program, or wrap it as a program to be scheduled in BIP, a Webi ui extension or a publication extension. See sample code here:
That is great Andrey!!! The reason why I’m doing it this way is, I don’t have basic Java skills, and not to mention the big picture how Java works and/or other things needed per this document.
Thanks for letting me know about this document though!!!
Five years later, there is still no standard feature and this workaround still works.
Glad you liked and/or used it, Henry!