cancel
Showing results for 
Search instead for 
Did you mean: 

Challenging Q: How to create certain no. of pages

Former Member
0 Kudos

Hi Experts,

I designed a label program. Firstly, a Dialog screen gets info from user. Then a Smartform prints it.

I have to print a page for every 8 labels requested by the user, as there is 8 labels per page.

Where or how do I tell the Smartform to print the correct no. of Pages?

I've checked my Smartform PDf's I have, even someone who does Smartforms in my company - no help. Hopefully someone in here can tell me?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Declare count variable globaly.

Make 8 secondary windows for lable printing.

increase count in each window.

Claculate no of lables. store in temp.

In main window make loop at internal table.

Which contains all the data related to lables.

Put condtion for loop count < temp.

create command node . Put same page as next page.

Note :

1. Count is used to track no of lables printed.

2. Temp is used to calculate total no of lables.

3. Loop will execute till count < temp.

means till all lables get printed.

i.e if u have 18 lables.

1. First page will print 8 lable.

Count is 8.

Temp is 18.

2. Loop will cal second page(first page itself). (count < page)

second page prints 8 lables

count 16.

temp = 18

3. again loop will cal third page(first page itself).(count < temp).

third page will print 2 lables

count will be 18

temp = 18

4. Loop wil not continue becz count< temp condition fails.

Lables should be in secondary window.

Use main window only for calling next page.

Try this. it works.

Former Member
0 Kudos

Hi Anil,

Thank you very much for your answer. it really helped me a lot.

I knew I had to have a condition in somewhere, I just didn't know it had to be inside the Loop.

The calling page node also works fine.

You gave me so much already, but I can noow print at the most 2 pages up to 16 labels. Even when i request 14, it prints 16. Hope you can help with this last bit.

Once again thank you very much.

Former Member
0 Kudos

Hi,

I think we have given one condition for loop.

Please give the same condition for all windows .

i.e

count < temp.

Try this.

Former Member
0 Kudos

I don't want to add to this, but I have to:

It still doesn't work. looks like a Condition, even if it is true, stops the window from processing.

When everything seems right, it only prints 16 labels - i.e. 2 pages. Hope someone looks at this thread again...

Answers (5)

Answers (5)

Former Member
0 Kudos

I managed to use the Table instead - the bar codes are not 100% (on the first cell it prints twice over one another.

Will have to get it right somehow.

Former Member
0 Kudos

Nogt solved yet - possible solutions looked good, but wasn't 100% done.

Former Member
0 Kudos

Hi,

I think the loop in which you have added in COMMAND node is not working properly.

Try this

If you have 24 labels.

24 / 8 = 3 pages should be printed.

So loop should be execute minimum two times.

1. 1 st page will display 8 lables.

2. For each lable increament count.

create loop node on any internal table having no. of records.

Put condition thr. count < 24(no of lables)

2. For second page count is 16. loop will again execute command node.

3. third page will be dispalyed. count becomes 24.

4. No page will display because count = 24.

Try this it will work.

Check the records in internal table which u r using for loop node.

Under loop create command node.

Former Member
0 Kudos

Hi,

I've changed from using a Template, to using a Table - which allows me to print all the labels - now my problem is that it is not aligned as it was, when I used the template.

Is there any way of setting up my table, with dedicated sized cells? I only find a "Minimum Height to set the height of the table, but I need something that allows me to determine a dedicated height, so that I know my 8 labels prints the same size on every page - or am I going to fiddle with each paragraph's spacing to get it right?

Or can I set up a Page Break after every 8th label?

Hope you can help. The template with calling the same page a few times, didn't seem to work. My system also doesn't have a node "COMPLEX', as according to the Smartform document available online, this would've been my solution.

Former Member
0 Kudos

Hi,

Is it solved? If not plz tel me your smartform logic.

Former Member
0 Kudos

Hi Anil,

I have solved it: I used a Table like I mentioned. I told someone that assisted, that the critical theoretical info we were missing, was that Tables will keep on printing over a few pages until the Int_tab has been completed printed inside the MAIN window.

So instead of having one entry in a int_tab, filling a template and trying to print the page 64 / 8 = 8 times, I changed it to a Table which will print the 64 entries I created in the int_tab. (I looped in the Report to get all 64 entries in there - or however many the user requested).

I would have loved to solve it your way, because my barcodes are now buggered. I struggle a lot with the spacing (when I get it rotated vertically, it printes twoo barcodes over each other - just on the first line where I want to start it - to the right of the label information.

To explain my Smartform logic: (I'll skip the headers and other easy stuff).

I have an int_tab that populates from a report, where I used dialog reporting to get all the label detail , including a number, which indicates how many labels should be printed.

In the table I add 1 to a counter, as I have to indicate the number of the label as well - which of course helps in seeing if all of them printed.

To get back to the original problem we had when using the Template: I tried using 2 pages, but in the end it would just print 16 labels MAX. I tried the Command to go to a new page, but that seemingly actually STOPPED it from printing on the next page - from reading docs about Smartforms, it seems that COMMAND is to force a page break, which is not what I needed to do (therefor I moved it to the end of my main window). The "NEXT PAGE" entry in the PAGE node, seemed to work fine to go to the next page. I think creating more pages could have solved the problem, but by then I had figured out the table method already and used it.

My template actually had 3 lines - the barcode going in to 2nd line, and the 3rd line I used as space to get the spacing correct between labels - it was perfect, except that I could not get the pages to print 8 times e.g.

Sorry for the long response - but did not want to get into e-mailing you.

Thank you once again for all your help. If you want to try to solve this with the template anyway, I'll really appreciate it. It's all us programmers' problem - to get things done the way we want it, not use the other easier method, hey?

lijisusan_mathews
Active Contributor
0 Kudos

hi,

I think you don need to actually find out the number of pages if you will always have 8 labels in a page. I recently had a similar problem, and my problem was used by the following link. Just check it out.

https://wiki.sdn.sap.com/wiki/x/zYCrAg

and if you only want to change your current program, then i think 1 way would be :

add a variable which stores the number of labels printed.(like the one you have in count).and in the text node where you actually write the data to be displayed, there will be a tab callde conditions.. In this tab , check if the variable value is less than Total number of labels(it is there in some variable already rite).... As a result this node will be written only when the count is less than total number of labels.. and you will your desired output.. if you want a illustrated explanation, it is tehre in the link provided..

Edited by: Suzie on Nov 4, 2008 4:24 PM

Former Member
0 Kudos

In label printing there's an issue that needs clarification: What happens to unusued labels in a page. If they are saved for the next time(as it's usually the case), your program that prints 8 per page will fail. So, one of the things the user must input before starting is the number of labels left in the first page.

You then do initial_page = 8 - input_page. This way you can start counting from the first label you print and don't have to have 8 labels per page always for the program to work.

Former Member
0 Kudos

Really a Challenging question to understand !!.

Have you read the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] about how to ask a question. Please do read before posting more.

Explain your requirement more clearly.

Regards

Karthik D