Business requirement description:
A truck loaded many materials for different unloading positions. Before setting off, the driver needs to get the forms which consists of the header pages and subpages.
The header pages hold the general information about the orders, materials and start point and end point of the whole trip.
Each set of subpage is for a middle point to unload the material of certain orders. The subpages also hold the information about the orders, materials, and start point and end point of the partial trip.
Originally, we tried to abstract all the information of the shipment into internal tables and export to the smartforms interface altogether. Then in the smartforms, we using the logic control to output the informations into different pages.
It is really complex and very difficult to control and test.
Worse, we need to print the page info on all the pages, which should be independent among the header info pages and each set of subinfo pages.
For example, we have 2 pages for header info, we have 2 set of subpages(1 middle unload point), first set of subpage has 3 pages, second set of subpage has 5 pages.
We need to print page info: 1 of 2, 2 of 2 on the header info pages.
And 1 of 3, 2 of 3, 3 of 3 for first set of subpage.
And 1 of 5,2 of 5, 3 of 5, 4 of 5, 5 of 5 for second set of subpage.
We can not use the standard page info supplied by SAP. We need to use the logic and programed logic to control the page info.
Finally, we give up. We were looking for a better way for this requirement.
We tried the following way:
Collect all the header info for each set of page into an internal tabe in which each line of record is according to a set of page.
Collect all the item info into another internal table in which containing a key field relating to the header info internal table.
loop at the internal table for the header info.
get the item info into a temp internal table.
call the smartform function module, exporting the header info line and the item info temp internal table.
At the same time, we set the output_options of the smartforms.
When call the smartform function for the first time, we set to create a new spool request, otherwise don’t create a new spool request.
So that we can collect all the pages into a single spool request which can be output at one time.
This way greatly make the logic in the smartform easier. And easily solved the page info problem.
If you are facing with simliar requirment, you can have a try to use this solution.
May it give you a big suprise.