Quantcast
Channel: SCN : All Content - Output Management
Viewing all articles
Browse latest Browse all 1353

Page Break on main window and Dynamic Page Sequence in SAP Script

$
0
0

Hello Experts,

 

I have a requirement that in Sap script I have to dynamically determine the next page, trigger page break when the main window is full on current page.

(Basic requirement is to print maximum line items in minimum number of pages, provided pages are printed as per conditions listed below)

 

The scenario is as follows. I have three pages in script.

FIRST      -  Contains MAIN, and Multiple Variable Windows ( Can print limited line items )

SECOND -  Contains only Main Window ( Can print maximum line items as full page dedicated for main window )

LAST       -  Contains MAIN and one Variable Window. ( Can print line items less than SECOND page as has another VAR Window )

 

Depending on the number of Line items the count of pages can be as follows:

 

FIRST      -  Always 1.

 

SECOND -  Between 0 and N . ( Where N >=1 )

 

LAST        - Either 0 or 1.

 

Total no of pages = Number of FIRST page + Number of SECOND page(s) + Number of LAST page

 

 

Conditions:-

 

1. If the Line items can be fitted on FIRST PAGE, then only 1 Page is printed.

( Second and Last not called )

Total Number of pages = 1. ( FIRST = 1, SECOND = 0, LAST = 0 )

 

2. If the Line items can be fitted on FIRST AND LAST PAGE, then only two pages are printed in that order

( Second page Not called ).

Total Number of pages = 2 ( FIRST = 1, SECOND = 0, LAST = 1.)

 

3. If the Line items are greater than above two conditions, then FIRST, SECOND and LAST are called in that order.

( There can be multiple SECOND pages depending on line items )

Total Number of pages = 2 + N ( FIRST = 1, SECOND = N, LAST = 1.) where N>=1

 

Page Sequence :- ( as per conditions above )


1. FIRST


2  FIRST->LAST


3. FIRST -> SECOND ->LAST ( assuming  there are three Second pages then FIRST->SECOND->SECOND->SECOND->LAST ).



Current Solution :-

I tried achieving the same through counting the number of line items that can be printed in the space on each page in main window. I successfully implemented the logic. For example in my logic I Counted FIRST page can print 6, second can print 12 and last can print 10 line items.

 

Problem in Current Solution:

But the Problem came as a line item can contain variable number of lines in printing (one line item may be printed in 1 line, another in 10 lines. )

So the counting logic failed.

 

Question:-

Now how do I achieve dynamic page break ( and correct next page call ) after main window is filled on current page? Also to determine how many first, second and last pages are there in printing?


Viewing all articles
Browse latest Browse all 1353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>