Smartform Design Advice
I am currently writing a program the collects some contract data and prints them using a smartform.
The user enters a pair of dates, and the program collects all the contracts that have been billed within those dates. This part works fine, and I have 2 internal tables populated with data. One contains some header data for the contracts, the other contains the items for the contracts.
What I want to do is call the smartform an print all that data in one form. The smartform should print a new page for each contract, with all the items listed.
I know I could do it by looping on the 'header' table in the abap and then calling the smartform for each contract, but that would make lots of print spools. Is there any way I can put that loop within the smartform so that all the contracts are printed together?
max bianchi replied
If the system creates a spool for every contract it means you open your smartform for every contract.
If you want to create only one spool you need only to open smartforms only once.
You can do it calling direclty the fm to open and close smartforms:
data: ssfcompin type ssfcompin,
ssfctrlop type ssfctrlop.
ssfcompin-dialog = 'X'.
CALL FUNCTION 'SSF_OPEN'
input = ssfcompin
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ssfctrlop-no_open = 'X'.
ssfctrlop-no_close = 'X'.
LOOP AT ITAB.
CALL FUNCTION SMARTFORMS
CONTROL_PARAMETERS = ssfctrlop
USER_SETTINGS = 'X'
CALL FUNCTION 'SSF_CLOSE'.