Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Smartform and page numbering

$
0
0

Hello gurus,

I'm facing an odd requirement; shortly, I have a custom smartform which will print out a Purchase order which contains both material items and service items.

That smartform is build in the following way: first, it processes the material items. After that, page break and process services.

 

In a certain way, it produces a document which could be considered as the union of the material item list (first part) and the service summary (second part).

 

Now, the tricky requirement: I want to enumerate page numbers so that each page contains a windows reporting:

" Page X of Y"

 

where:

X represents the current page of the sub-document (material/service) and Y represent the total on that section (material/service)

 

Providing an example: suppose that a purchase order has a lot of material items, so that their output would fill 4 pages. Service items will fill the last 2 pages.

Here's the page numbering required for that document:

page 1 (material) : "Page 1 of 4"

page 2 (material) : "Page 2 of 4"

page 3 (material) : "Page 3 of 4"

page 4 (material) : "Page 4 of 4"

page 5 (service) : "Page 1 of 2"

page 6 (service) : "Page 2 of 2"

 

Is there any way to achieve such a desiderata?

SFSY-PAGE could be used to calculate X on each page, as for the first part it represents exactly the page number, while at the break for the services we could obtain X by subtracting from SFSY-PAGE the number of pages processed before the break (which we could store in a global variable).

 

The problem is Y; as far as I know, SFSY-JOBPAGES returns the overall number of pages for the smartform. So, for the services part, I could again retrieve Y by subtracting from SFSY-JOBPAGES the number of pages processed before the break page command.

But how can I - a priori - know how many pages of materials will be printed out?

 

Any suggestion/hint would be appreciated, thanks


Viewing all articles
Browse latest Browse all 8332

Trending Articles