cancel
Showing results for 
Search instead for 
Did you mean: 

SAPScript adjust total number of pages

Former Member
0 Kudos

So far the advice I have is 'forget it', 'convince the client it cannot be done' and 'change to Smartforms'... but I can't really let it rest. In the end it is just a variable that I would like to change, isn't it? Even if it's on an SAP 46C system

The issue we are having is that the client requested to insert a 'Terms and Conditions' page as second page in any invoice. However, this T&C page should not be taken into account when counting pages.

To get that to work, I can set the 'numbering type' for the page to HOLD. This has the desired effect on displaying the current page, but the total number of pages is still to high by 1. So in the end I have a final page stating it is 3 / 4, resulting in customers everywhere searching archives for an elusive fourth page.

I assume that when processing the form, SAP has to increment a counter somewhere to determine this value. When processing is done, it can proceed to print the total value to all pages. What we are printing is &PAGE(C)& / &SAPSCRIPT-FORMPAGES(C)&.

Tried the same with JOBPAGES, no difference.

Called a FORM from the T&C page trying to decrease the SAPSCRIPT-FORMPAGES value by 1, no luck so far.

I can't copy the value and print a variable, since the final value is only known after processing.

Is there any way of adjusting that value? Thanks in advance!

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member220028
Active Contributor
0 Kudos

Hi,

there are different designes for your sap-script programm

1.

1.1 call FM open_form

do all your normal logic inside here

1.2 call FM close_form

2.

2.1 call FM open_form

2.1.1 call FM START_FORM

do your normal logic inside here

2.1.2 call FM END_FORM

remember ITCPP-TDPAGES of returning parameter of END_FORM in your own global variable and use it as total page for your special page logic

2.1.3 call FM START_FORM

do your special page logic inside here

your special page can be a seperate SE71-Formular, or at least a seperate window in your formular you use for Start-end-form above. so you can directly call it here.

2.1.4 call FM END_FORM

2.2 call FM close_form

i did not test it, but it should work.

end_form contains the pages of all pages inside open and end-form.

close_form contains all pages of the whole job.

regards

Stefan Seeburger

former_member220028
Active Contributor
0 Kudos

Hi

Former Member
0 Kudos

When I set the numbering type for the Terms and Conditions page to HOLD, the &PAGE& variable will contain the correct value. It is not being printed on the T&C page itself, so we're good there. This now results in pages 1/4, T&C, 2/4 and 3/4.

So far I have seen that the &SAPSCRIPT-FORMPAGES& value is being incremented for every page it passes. After all pages have been processed, SAP prints that final value to all pages. It seems the system keeps a blank space for that value until end of processing.

Now when I read that value on every page and store it in my own global variable, that global variable would simply increase for every page. Resulting in pages 1/1, T&C, 2/2, 3/3.

Perhaps we're not talking about the same thing here, I get the feeling I don't fully understand what you are trying to tell me.

former_member220028
Active Contributor
0 Kudos

Hi,

i think you can not change this counter, but 2 other options comes to my mind.

1:

What you can try is to warp your special-page into an own "start_form / end_form" . so the total-formpages of your "form" does not change, only the pages of  JOBPAGES should increase.

i think even this method can only work when your special-page is the last page.

2.

another way is to use your own counter variable and increase it each time you print a new page.

But i duno if this is possible in 46C, since i never worked with lower releases.

regards

Stefan Seeburger

Former Member
0 Kudos

Thanks for your reply Stefan.

You are right on both options... starting a new form with the special page as a second page will mess up the pages for the document, it will simply reset on page 3 (of any).

Of course I can create my own variable to contain the number of pages, problem then is that I have to print it _after_ the entire document has been processed. Otherwise the page number will just increase with every page.

For the moment I have convinced the client it cannot be done and they kind of accepted that. Still would be nice to know a way to influence the number, but the more I look into it, the more I'm convinced it cannot be done.