Skip to Content
0

Sapscript check printing with two mains

Jan 11, 2017 at 01:16 PM

94

avatar image

Hi all Gurus, I have the following problem.

We're printing a check with sapscript. There is one MAIN window and a second copy of MAIN. (I think it's called a stub-check-stub).

The first stub is printed in the main. Then the Check is printed, followed by the copy of MAIN (Which is ripped off for archving)

While the LOOP is active on the logical databases I let the printprogram ZRFFOUS_US fill a table with already processed lines in the 1st stub. I know by fact that there are 10 line items possible in the MAIN, so once I reach the 10th entry, I'll write that copy table to the screen with WRITE_FORM_LINES in the second MAIN window. (It's actually not a real MAIN window..)

The tables are cleared right after that, so they can be used again. This works ok, but on the last page it repeats printing that copy table once more... while the tables are empty.

Do I have to initiate or clear something after using the WRITE_FORM_LINES function module?

10 |10000 characters needed characters left characters exceeded

I guess you need to restrict the output based on the last but one page see the below link explain how to find if its a last page

https://archive.sap.com/discussions/thread/1333313

0
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Stefan Seeburger Jan 11, 2017 at 01:57 PM
0

Hi,

duno about your Programm, but i can explain sap-script :)

additional "empty" pages are mostly printed because the window is full and automatically generates the next page.

also while your formular-Programm is aktive and executing the Loop. Make sure, that the data is stored in global variables, since only global-Variables are used in the script.

also please explain a bit more clearly: a main window is a window named MAIN which can have main-00, main-01 , main-02 and so on. this means that the data prionted in main window is first printed in window main-00 and when this window is full, it goes on printing the data in main-01 and so on, until al main Windows are full. than the next page is triggered. (the main window is the only window that can be placed multiple times on the same page.

if you have an other window, ist not a "main" window.

your Problem sounds like you want to fill the data of a table into 2 Windows. 1 is the main window and 1 is another window. Make sure, the data you are printing does not Trigger a next page. also take care of trailing spaces, that can also Trigger next pages. you might think the page is empty but 100 spaces might got printed!

regards

Stefan Seeburger

Share
10 |10000 characters needed characters left characters exceeded
Ron Dijkstra Jan 11, 2017 at 03:24 PM
0

Hi Stefan.

The first pages go very well. I have a check with 20 lines items so to say. That will print 2 pages with 10 items in both the MAIN and copy of Main window. (And in between Voided Checks).

On the third page a total is printed in the main window, followed by a check with values, and in the copy of main the items 11-20 are printed again: the same 10 entries as the page before...

Besides that, right after WRITE_FORM_LINES I'm clearing the internal table that goed with it... Keeps me puzzled!

Share
10 |10000 characters needed characters left characters exceeded
Stefan Seeburger Jan 11, 2017 at 03:46 PM
0

do you write both Windows with WRITE_FORM_LINES?

the only Thing that Comes to my mind is that the lines for the main window causes a new page, which is empty. and the lines of the copy of your main window is also too small, but cant create a new page, because ist not the main window.

and after that mechanism you clear the tables.

could you add screenshots?

regards

Stefan Seeburger

Show 1 Share
10 |10000 characters needed characters left characters exceeded

In addition to my previous post I added a breakpoint in the function module WRITE_FORM_LINES. Remarkable is that for the whole check printing cycle, it does *NOT* stop there twice, but on the form it still outputs the data twice..

0
Ron Dijkstra Jan 12, 2017 at 09:46 AM
0

Hello

I only use WRITE_FORM_LINES for the 2nd stub (Lower part; behind the Check).

See the output of pages 2 & 3 below. On page 3 you can see the items are printed again... :(


page2.jpg (115.6 kB)
page3.jpg (99.8 kB)
Share
10 |10000 characters needed characters left characters exceeded
Stefan Seeburger Jan 13, 2017 at 03:38 PM
0

Hi,

sry i dont get it. what part of the screenhot is your main window? and what part of the screenshot is the copy of your main window? how should page 3 look like when every Thing is correct? add screenshot from SE71 too plz.

what Comes to my mind is the implizit printing of windws. you can write a text in a window e.g. "HELLO WORLD". this text gets printed on every page, where you define the window.

but if you write the Command /E "Entry-Point" in the line befor, you have to call it explizit via your Formularprogramm.

regards

Stefan Seeburger

Share
10 |10000 characters needed characters left characters exceeded
Ron Dijkstra Jan 23, 2017 at 01:24 PM
0

Hi Stefan,

eventually I have managed to get a consistent output. The double output only was realised when the last page was empty. A bit complicated to explain in a few lines though.

In my previous screenshot the list on top is the MAIN window. The Check below it has its own window, as well as the copy of the LIST in the lower / bottom part in the form..

Share
10 |10000 characters needed characters left characters exceeded