cancel
Showing results for 
Search instead for 
Did you mean: 

Control printing with ALTERNATIVE in several pages

Former Member
0 Kudos

Hello all,

I'm currently working on generating a PDF where each page needs to be conditional (ie user can print 1st & 2nd page, or 1st, 2nd & 3rd, or 1st & 3rd). Altogether there are about 20 pages.

The use of alternative + command with next page works great for the determining the print of the 2nd page, but I can't seem to get it to work the same for the printing of the 3rd page, etc. I did notice that in order for the contents of the 2nd page to print, they HAVE to be placed in a secondary window, but I can't put the next page commands in a secondary window. What I've tried is to have the secondary window first (with all the page content), then a main window (with alternatives & commands), but this doesn't seem to work. (Also, listing main widow then secondary doesn't work.)

When I add breakpoints, it seems as though the main window is never called. (I can see the breakpoints in the F01 include, but they are never called.)

Any ideas?

Here's what I'm needing:

Page 1

- alternative 1 -> TRUE -> go to page 2

- alternative 1 -> FALSE

--alternative 2 -> TRUE -> go to page 3

--alternative 2 -> FALSE

---alternative 3 -> TRUE -> go to page 4

....

Page 2

- alternative 1 -> TRUE ->go to page 3

- alternative 1 -> FALSE

--alternative 2 -> TRUE -> go to page 4

--alternative 2 -> FALSE

---alternative 3 -> TRUE -> go to page 5

....

Lisa

Edited by: Lisa Mychalishyn on Feb 2, 2012 4:13 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

OK, here's the technique I used to make this work.

I pass a table with pages to be printed (PAGETAB). In the main window, I loop thru PAGETAB and use it's value to use the layout for that particular page (grouped into a folder, with conditions). At the end of the main window, I check to see if this the last page to be printed, else I use Command to force a page break (otherwise, 2 forms may print on the same page).

Here's a sample of the code:

Page

Main window

- program lines -> get total # lines in PAGETAB into V_TOTAL

- loop @ PAGETAB

-- program lines -> add 1 to V_LOOP

-- folder 1 -> condition -> PAGETAB = "PAGE1"

--- page 1 layout stuff

--- alternative - if V_LOOP < V_TOTAL

-


TRUE

-


command -> go to next page -> Page

-- folder 2 -> condition -> PAGETAB = "PAGE2"

--- page 2 layout stuff

--- alternative - if V_LOOP < V_TOTAL

-


TRUE

-


command -> go to next page = Page

... rest of pages

Lisa

nabheetscn
Active Contributor
0 Kudos

What you can try is in main window only put these condition and implement page break. In that way you dont need to create so many pages.It will more of the dynmaic stuff happening by reusing the same two pages.

Nab heet

Former Member
0 Kudos

Hi friend,

I too tried out the same. We are not able to create page breaks for secondary window.

Why cant you go for main window at all the pages? Is there any issue in that ?

If you are really facing a problem in printing the specific pages, then you can have a look at the wiki which will give you a clear idea for selecting specific pages for print,

Link : [Specific pages for printing|http://wiki.sdn.sap.com/wiki/display/stage/Selectspecificpagesforprintinginsmart+form]

You can use the first piece of code for your requirement. But that needs to be done using a driver program.

I think this will solve your issue. If you have any issues please revert back to me i will help you.

Thanks,

Sri Hari