Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform Design Advice

Former Member
0 Kudos

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

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.

start-of-selection.

ssfcompin-dialog = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

input = ssfcompin

EXCEPTIONS

error = 1

OTHERS = 2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ssfctrlop-no_open = 'X'.

ssfctrlop-no_close = 'X'.

LOOP AT ITAB.

CALL FUNCTION SMARTFORMS

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

.............

ENDLOOP.

CALL FUNCTION 'SSF_CLOSE'.

Max

3 REPLIES 3

Former Member
0 Kudos

Hi

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.

start-of-selection.

ssfcompin-dialog = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

input = ssfcompin

EXCEPTIONS

error = 1

OTHERS = 2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ssfctrlop-no_open = 'X'.

ssfctrlop-no_close = 'X'.

LOOP AT ITAB.

CALL FUNCTION SMARTFORMS

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

.............

ENDLOOP.

CALL FUNCTION 'SSF_CLOSE'.

Max

0 Kudos

Idea From Max is Good, But make sure you dont send FAX or EMail out of your spool .

You end up sendign to same vendor all your Contracts :-).

Rgds,

Mano Sri

Former Member
0 Kudos

Hi Stuart,

Yes you can incorporate the logic in Smart Form itself.

In the INITIALIZATION tab of yor form sort your internal tables by contract number. Then in the MAIN WINDOW take a TABLE node for the HEADER table and a LOOP node for the ITEM data within in the MAIN AREA of your HEADER table node. In the CONDITION tab of your TABLE LINE in the ITEM LOOP node check whether the contract item number is to the corresponding contract header number. Then after the ITEM LOOP take a COMMAND NODE and give NEXT PAGE. As Smart Form will process the nodes in the order your COMMAND NODE will be triggred only after looping at the ITEM LOOP NODE.

Thanks and Regards,

Bharat Kumar Reddy.V