on 2006 Apr 05 9:29 AM
Hello,
I should do a report with smartforms, that shows table data of materials and stuff. After every materialgroup change (prodh), I should accumulate the amounts of the materials in this group and show a special line with the totals.
The table of data, I give to smartforms, has also a field for the customer. When a customer changes, I should print another page and show the materials for this customer.
I have done it like that:
I have selected all data in my program and deliver the table to my smartform. In my smartform, I have added a table in my main window to show the data.
Before every line output inside the table node, I check, if the material group (prodh) has changed. If not, I´m accumulating, else I´m showing the totals in a special line. After my table I´m showing the totals for the last material group.
That is all working fine....
But now, I have tried to print only the materials for each customer, and for each, it should be processed a new page.
Therefore I have copied my first page. In the initialization, I have filled a table, which contains an entry for each customer. The field "line" is something like a key and the field "kunnr" contains the customerkey.
In my main window, I´m now selecting(before the table node) the customernumber from this table with the page-number as the key. So, on the first page, I have then the key (kunnr) of customer 1 and on the second the customer 2 and so on.....
In my table node, I´m now looping over my data table where the customer key = the customer key I get for that page.
I hope, it´s not too complicated to understand! ;o) Sorry, but it´s hard to explain.
The problem now is... it shows the data for the first customer on the first page, and I also get a second page. But on the second page, there isn´t any data shown in the table. And if I have more customers, I also get only 2 pages....
My table, I set in the initialization, is correct, I think. I´ve tested it in the program, before I´ve called the form.
Maybe somebody can see my mistake? Is it possible to debug the form? I can´t see, why it is working on the first page, but after that, it´s going worse... :o(
Thank You all for your help!
Cheers Michael
Michael,
Unfortunately, it was a bit complex for me to understand.
Well, over all I think you are tyring to get a break for the materials for each Customer.
Looks like you have written some code for doing the same.
Which version of SAP you are working on? If its 4.6 C there is no other way than writing code to get the totals and page-break. However, if you are on 4.7 then SORT and BREAK can be configured and also the calculations can be done automatically without writing any code.
Let me know, so that I can tell you how to do it.
Regards,
Ravi
Note : Please mark the helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Ravi,
I want to show all materials for each customer. And for each customer, a new page.
I´m working on 4.6C, so I have to do the sums, I think.
But that was not the problem. The problem is, that I can´t change the page inside the table. So I tried to check for each page, if the customer has changed and then I opnly want to show the data in the table for only that customer....
It´s a quite understandable idea, but it´s hard to realize, I think... :o(
Michael,
You can always suppress the PRINT options window by setting the required parameters in OUTPUT_OPTIONS and CONTROL_PARAMETERS.
Set the NO_DIALOG = 'X', PREVIEW = SPACE, DEVICE = PRINTER in the CONTROL_PARAMTERS and TDNOPREV = 'X'in the OUTPUT_OPTIONS and the print prompt will not come.
You can even get the user default print by reading the USER DEFAULTS from the function SUSR_USER_READ.
Regards,
Ravi
note : Please mark the helpful answers
Ok, I´ll do it that way!
But is it possible to show the options-page only the first time, when the functions of the form is called, and to use the setting then for all further function calls later on?
For example showing the options only for the first customer in the loop and for the further ones use the settings?
Cheers Michael
Michael,
It definitely should be possible. Two ways of doing it.
Call the SMART Form once outside the loop and hopefully the values the user has given will get captured in the same parameters. If yes you can use them inside the loop.
If you don't want to do that logic, then inside the loop see of specific parameter is null, then set the PREVIEW on, else switch if off.
Regards,
Ravi
Note : Please mark the helpful answers
Hi,
Your requirement is to display the materials in new page whenever the customer changes.
Please try the following
In the Table node containg the ITAB->Choose Data Tab
-> Click on the check box Already Sorted
-> Type the field name for Customer in Sort Criteria and select Event on sort Begin and Event on sort End
-> You will now get a new node 'Event on Sort begin" -> Add the command node below it
-> In the command node choose the Goto New Page (Default Page will be automatically displayed)
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
111 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.