This website is not affiliated with, sponsored by, or approved by SAP AG.

Getting total number of pages in the script dynamically

Development SAPscript/ Smartforms

Moderators: thx4allthefish, Snowy, Gothmog, YuriT

Getting total number of pages in the script dynamically

Postby ashaivl » Wed Nov 06, 2002 7:27 am

I have a script consisting of (for example) 5 pages. After printing the layout, each page is folded to get two pages (ie 5 * 2 = 10) total of ten pages . In the footer of each page I have to write " Page 1 of 10, 2 of 10 -----). If I take &SAPSCRIPT-FORMPAGES& or &SAPSCRIPT-JOBPAGES& , I will get answer as 5. But ineffect it has 10 pages.

If you know please share
ashaivl
 
Posts: 6
Joined: Wed Nov 06, 2002 7:15 am
Location: Trivandrum

Postby kumar » Wed Nov 06, 2002 7:42 am

You can just create a variable and do the calculation and display that variable i.e

TPAG = PAGS * VAR.

Where PAGS = &SAPSCRIPT-FORMPAGES& and VAR = the Variable in Your case = 2.

In the script you can display as

&PAGE& OF &TPAG&

KRK
kumar
 
Posts: 2012
Joined: Tue Oct 22, 2002 12:51 pm
Location: Basel, Switzerland

Postby ashaivl » Wed Nov 06, 2002 10:38 pm

Thank you for ur reply. Could I ask some doubts

1. Is multiplication directly permitted in Sap Script?
2. if we debugg the Script and see the value of
&SAPSCRIPT-FORMPAGES& we could see that it is dynamically incrementing, and when last page is reached, the
&SAPSCRIPT-FORMPAGES& symbol is replaced by its value. We can't get the total no of pages initially, for doing multiplication
If you know please share
ashaivl
 
Posts: 6
Joined: Wed Nov 06, 2002 7:15 am
Location: Trivandrum

Postby kumar » Thu Nov 07, 2002 5:05 am

1. You can call a SUBROUTINE from your Script to do this.
2. You can pass the same (&SAPSCRIPT-FORMPAGES&) to your Routine
and assign it to a Numeric field and do the Calculation.

KRK
kumar
 
Posts: 2012
Joined: Tue Oct 22, 2002 12:51 pm
Location: Basel, Switzerland

Postby kumar » Thu Nov 07, 2002 5:14 am

Sorry Ashaivl. Just debugged and found that FORMPAGES and JOBPAGES are passing the value of the Current Page No.

I will try to do more tests and get Back.

KRK
kumar
 
Posts: 2012
Joined: Tue Oct 22, 2002 12:51 pm
Location: Basel, Switzerland

Postby kumar » Thu Nov 07, 2002 5:30 am

I can just think of this.

If you can predetermine the No. of Pages, Eg. If there are 50 Lines in your internal table and you are printing 7 lines in a main window, then it can be predicted that you are going to print a Total of 8 Pages.

I can think of only the above, But we will just wait for more inputs.

KRK
kumar
 
Posts: 2012
Joined: Tue Oct 22, 2002 12:51 pm
Location: Basel, Switzerland


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 3 guests




This website is not affiliated with, sponsored by, or approved by SAP AG.