cancel
Showing results for 
Search instead for 
Did you mean: 

SAPScript - multi-page form - add last page

Andy_Knapp
Explorer
0 Kudos

Hi folks,

Newcomer to SAPScript here, so forgive me in advance.

I have a custom PO form, whose MAIN window is in the middle of the page. Below that, I have other VAR windows for totals, signatures, etc. These windows have code in them that check IF &NEXTPAGE& EQ 0 in order to determine if it's the last page of output. So on a 5-page PO, the total only appears on the last page. Very logical.

New requirement is to add a followup page to print after the PO that contains an Acknowledgement Form.

Here's what I've tried so far:

(1)

Define a new page ACK with the required window, page window, and text elements. That's great. Change the main page (called FIRST) 's Next page value to ACK. Result - 5 page PO prints the ACK page after the 1st page of output, rest of output is lost.

(2)

Add code to text element of MAIN window on FIRST page:

IF &NEXTPAGE& EQ 0.

NEW-PAGE ACK.

ENDIF.

This never runs as I've surmised that in a MAIN window SAPScript cannot determine if it's the end of output yet. Remember that it's in the middle of the screen, and there other windows to draw below it.

(3)

Add code to text element SIGN (where the PO signature box is, toward the bottom) on FIRST page:

IF &NEXTPAGE& EQ 0.

...other text stuff...

NEW-PAGE ACK.

ENDIF.

The "other text stuff" prints, but my ACK page does not. I've learned that NEW-PAGE is not allowed outside of a MAIN window.

So I've coded myself into a corner. The MAIN window can't tell when it's the last page, and when I can tell it's the last page, I can't do page break to show my last page.

Any help would be appreciated.

thanks

Andy Knapp

Enwin Utilities

Accepted Solutions (0)

Answers (1)

Answers (1)

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Couldn't you use the NEW-PAGE ACK command as the very last element printed in the main window? Your print program has control of which element is printed when, so when you already processed all other information, you could just print this new element in the main window.