cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple page printing in sap scripts

Former Member
0 Kudos

Hi,

I have a requirement in scripts like how to print footer windows only after the end of main window.

Likewise in smartforms we check a option to print footer windows only after end of main window,but such option is not available in scripts.

I have even used the system defined variable PAGE(which stores present page number) and SAPSCRIPTS-FORMPAGES(which stores total number of pages) by comparing them with a if condition but it was unsuccessful because total number of pages is triggering at end of page printing.

So i need suggestions regarding that as i was working on a PO print form . If a PO has multiple line items amount in words,tax conditions,remarks and signature should be printed only after the end of all line items.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

TMNielsen
Contributor
0 Kudos

Hi Venkat

I'm almost sure that the way you describe: Compare if current page number equals total number of pages - will actually work.

I'm not sure however, why this was not successful in your case.

Best regards

Thomas

Former Member
0 Kudos

Hi Thomas,

I used the if condition like

IF sapscripts-formpages eq page.

Then the code for footer windows will be printed.

But in my case both variables have 1 but still if condition failed ,i checked in debugging for single page and multiple page PO's.

Is there any other way to read it.

Regards,

Venkat.

TMNielsen
Contributor
0 Kudos

Hi again

IF &PAGE& = &SAPSCRIPT-FORMPAGES&

should work

or you could check if &NEXTPAGE& = 0

both should work ... and actually by search on NEXTPAGE you will find lot of statements like this.

Best regards

Thomas

Former Member
0 Kudos

Hi Thomas,

If &nextpage& eq 0 option worked for me.

Thanks for the inputs.

Regards,

Venkat.

Answers (1)

Answers (1)

former_member196280
Active Contributor
0 Kudos

There are different ways of doing, for printing footer window only after the end of main window.

Option#1 : Count the number of line items that will be displayed in your main window, and place a condition in your footer window if line item count equal to the above count, then display the footer.

Example: Total line items are count = 15, and each page can only display 5 line items.

In you main window.

m_Counter = m_counter + 1.

In your footer window.

If count = m_counter.

***Display

Endif.

Option#2.

Create an element footer in your main window after your line items, once all line items are displayed then call the element footer in your main window. But only drawback is footer position will not be fixed it varies from form to form based on line items.

Option #3.

Count number of line items.

Ex: Total items are Count= 25, and first page of your script can print 10 and second page can print 10 and 3rd page can print 10 line items in main window.

Build a logic in your subroutine poll.

Total_count = count / 10. "Total_count = 25 / 10 that is 2.

Rem = count MOD 10. "REM = 25 MOD 10 that is 3.

IF Rem > 0.

Total_count = Total_count + 1. " 2 + 1 that is 3.

ENDIF.

In footer window.

IF TOTAL_COUNT = SAPSCRIPTS-FORMPAGES.

**Display footer

ENDIF.

I hope that above options may help your to close the thread.

Regards,

SaiRam

Former Member
0 Kudos

Hi sai,

Thanks for your reply...your inputs are really helpful but rather than going for your options,i have used the option given by Thomas if &nextpage& eq 0 and it worked.anyways thanks for your help.

Regards,

Venkat.