‎2016 Jun 08 10:02 AM
Hi experts,
I have the following issue: I have to print 2 tables in a smartform (see image attached please, table "devengos" and "descuentos").
In the main program I have 2 internal table with the required information. If the entries of both records aren't less than X (I think it's 19 for the first table and 12 for the other) it works fine. The problem is when there are more entries in any of the tables. In that case I need to print those entries in another page.
At first, I didn't use the MAIN window but I think it's necessary. So, I create 2 different loops in the MAIN window controlling the number of entries. But when it goes to the second page it doesn't print the data correctly. Entries from table2 are printed in "Devengos" and entries from table1 are not printed.
Any suggestion please ? How can I do that ? Should I use only an internal table with all the data mixed?
Thanks in advance,
MarÃa
‎2016 Jun 17 12:50 PM
What I did to solve my issue is:
In table 1 I can only print 12 entries, in table 2 only 9. Between both tables I need 4 lines in the smartform. So I've mixed both tables in another one "i_data" adding 4 blank lines between table1 and table2. For example:
Table1: 12 entries
Table2: 14 entries
i_data:
12 entries from table1
4 blank lines
9 entries from table2
12 blank lines (corresponding to table1)
4 blank lines
5 entries from table2
Now in the smartform, in MAIN window I do a loop to i_data, so it works as usual.
After the loop: COMMAND forcing to "terms page" in case that's the last page.
Page1 next page: Page2
Page2 next page: Terms
Terms next page: blank
‎2016 Jun 08 10:43 AM
Hi Maria,
Are you using a table or template to print table entries?
Thanks,
Sowbhagya
‎2016 Jun 08 10:54 AM
When I was doing it without MAIN, I did it with templates. But now within the MAIN window I'm doing it with tables.
‎2016 Jun 08 11:07 AM
Hi Maria,
Can you please tell us what is the code present in the smartform now. Are you using loops. or is it only tables inside main window. Please paste the screen shot.
Thanks and Regards,
Vinay Mutt
‎2016 Jun 08 10:59 AM
Hi Maria,
By seeing your requirement, i think the two tables are independent. They are not Header and Item tables and hence dont create any separate loops.
Insert two tables in the main window of your smartform. Since the tables are in main window the page extension will happen automatically.
Thanks and Regards,
Vinay Mutt
‎2016 Jun 08 11:04 AM
Yes, both tables are independent. That's what I did: 2 tables in the main window controlling that I have to print only the first 18 rows for the first one and 12 for the second one. But it doesn't work.
Thanks,
MarÃa
‎2016 Jun 08 11:13 AM
May i know What is But it doesn't work.
Is it displaying more than 18 and 12. I hope you have to control it. In driver program you have to Get only 18 and 12 If they are having more than, desired records count.
‎2016 Jun 08 11:17 AM
What I mean is this:
Table1 has 20 records.
Table2 has 15 records.
How should print the smartform:
Page 1: table 1 with 18 records. Table 2 with 12 records.
Page 2: table 1 with 2 records. Table 2 with 3 records.
What it does at this moment:
Page 1: table 1 with 18 records. Table 2 with 12 records.
Page 2: table 2 with 3 records in the place that should appear table 1.
‎2016 Jun 08 11:26 AM
Hi Maria,
Now this is clear. But this is not in sink with the screen shot of the required receipt which you have attached. Could you please double confirm that you are trying to achieve to split tables across pages.
Regards,
Vinay Mutt
‎2016 Jun 08 11:33 AM
Yes, I need to split the tables (in case it is necessary) and print them in several pages, but in the space given to each tables, devengos and descuentos.
‎2016 Jun 08 11:06 AM
Hi Maria ,
First page - Use main-window and create 2 tables - one is for devengos" and another one is for "descuentos" Based on the records it will display means if your first table having 20 entries it will display first and after completing second table will display try it if you have any issues revert.
Thanks,
Osman.
‎2016 Jun 08 11:15 AM
‎2016 Jun 08 11:38 AM
Maria,
I think you can achieve this by using templates in the main windows of page 1 and page2.
In Page 1 create a template with 18 records and map these to first 18 rows of table 1.
In page 1 create another template with 12 records and map these to first 12 rows of table 2.
In Page 2 create a template with 2 records and map these to last 2 rows of table 1.
In page 2 create another template with 3 records and map these to last 3 rows of table 2.
Thanks,
Sowbhagya
‎2016 Jun 08 11:42 AM
In Page 2 (or 3, or 4, number of pages depends of entries in both tables) there can be also 18 records for the first table and 12 for the second one.
‎2016 Jun 08 12:06 PM
Hi Maria,
Please check the saptechnical link below
http://saptechnical.com/Tutorials/Smartforms/Command/Index.htm
This has the solution for your issue.
Thanks,
Sowbhagya
‎2016 Jun 08 12:58 PM
Thanks, I've already check this tutorial, with only one table it works fine, but the problem is when i'm working with 2 tables.
‎2016 Jun 17 12:40 PM
And what happens when there is a different number of records ?
‎2016 Jun 11 8:29 AM
Hi Maria,
I am not sure....
But you can use my idea if it is help full,
We know the two table entries as fix per page(18 and 12).
So we can use the describe table lines in initialization and the empty lines to the respected tables which are less for the page fix entries(18 and 12).
Ex1:
1st table has 20 entries(2 pages) and 2nd table has 10 entries.
To continue the 2nd table we have to add 3 empty entries to 2nd table.
then the entries will be 13 entries(2pages)
Ex2:
1st table has 10 entries and 2nd table has 30 entries(3 pages).
To continue the next pages we have to 27 entries add 1st table.
then the entries will be 37 entries(3pages)
Finally you can use your own logic depends upon the above idea.
Thanks,
Sivanadh.
‎2016 Jun 13 10:12 AM
i Sivanadh,
That's exactly what I did, i'm controling the change of page using the maximum lines per table and per page. It seems it woks.
But now I have another problem... After printing both tables I need to print an extra page with some fix data. When I have only one page the last page is printed correctly. When I have more than one page I'm not able to print it.
what I did is:
Page 1:
I have 2 windows, positions (1st table) and discounts (2nd table) where I do the loop to the tables.
Whenever I print the entries required for each table, I delete these rows.
At the end of this page 1 have a MAIN window with an alternative:
- IF positions[] is not initial or discounts[] is not initial -> goto page NEXT (similar to page 1)
- ELSE -> goto page LAST.
In page LAST I have a NON-MAIN window where I print the data I need.
Any idea of what I'm doing wrong ?
Thanks !!!
MarÃa
‎2016 Jun 13 11:56 AM
Hi Maria,
Tried reversing the condition?
IF positions[] is initial or discounts[] is initial -> goto page LAST
- ELSE -> goto page NEXT (similar to page 1).
Thanks,
Sowbhagya
‎2016 Jun 13 12:08 PM
‎2016 Jun 13 12:26 PM
Maria,
Have you already tried putting in the LAST page fix data inside a MAIN window and changed conditions?
Thanks,
Sowbhagya
‎2016 Jun 13 1:13 PM
Hi Maria,
if it possible please call the same ssf_function module or call fm_name with control parameters
ssfctrlop-startpage = 'your final page name'.
ex:
ssfctrlop-startpage = '%Page2'.
you will get another print out with last page.
Please put this entire code in if condition of the page values(table entries) are more than 2 pages.
Thanks,
Sivanadh.
‎2016 Jun 14 11:57 AM
I can't use 2 main different windows in different pages, can I ? I get a dump when I do that.
‎2016 Jun 14 12:04 PM
There is an extrange issue..
Both pages, page1 and page2 are similar. In the main window (which is at the bottom of the list of windows) I wrote the command to go to page2. Also I wrote a text element in order to see if the the code goes through it.
In page1 I can see the text but in the second one I can't see it, so this MAIN is not being executed.
‎2016 Jun 17 12:29 PM
‎2016 Jun 17 12:36 PM
How did you solve the issue. If You share it will be very useful to us.
‎2016 Jun 17 12:50 PM
What I did to solve my issue is:
In table 1 I can only print 12 entries, in table 2 only 9. Between both tables I need 4 lines in the smartform. So I've mixed both tables in another one "i_data" adding 4 blank lines between table1 and table2. For example:
Table1: 12 entries
Table2: 14 entries
i_data:
12 entries from table1
4 blank lines
9 entries from table2
12 blank lines (corresponding to table1)
4 blank lines
5 entries from table2
Now in the smartform, in MAIN window I do a loop to i_data, so it works as usual.
After the loop: COMMAND forcing to "terms page" in case that's the last page.
Page1 next page: Page2
Page2 next page: Terms
Terms next page: blank
‎2016 Jun 17 12:53 PM
‎2016 Jun 18 2:17 PM
Good that it is fixed.
You should pray the text in each line does not increase in future or someone do not change the paragraph format used for blank lines.
The precision would be lost.
Regards,
Vamshi.