cancel
Showing results for 
Search instead for 
Did you mean: 

Printing multiple documents

Former Member
0 Kudos

Hello FORM experts!

I have a question here..

In my program I generate multiple documents and then want to print them all at once with one button click.

Document info is in a table which is also written into the database table.

How should this work, should I give my smartform calling function some extra parameters to print them all or should I pass all the info to the smartform and make it print them all there with a loop or sth.?

I'll explain some more..

I have a report which then generates special kind of invoices...

when invoices are generated there's a list of them displayed...

Now I would like with one button to call out a smartform and print them.

I want 1 pop-up print screen for all the invoices.

Right now, I get a pop-up for every single invoice it is printing

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can try the following.....Loop at your final internal table and call subroutine printform.In which you will call ur smartform for printing.

Write the following code....

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZZSD_INVOICE_TRADE_FORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = LV_FM_NAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION LV_FM_NAME

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = CONTROL

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = OUTPUT_OPTIONS

USER_SETTINGS = ' '

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

IT_DISPLAY = IT_FINAL

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CONTROL-PREVIEW = 'X'. "Preview the output of Smartform

CONTROL-NO_DIALOG = 'X'. "Don't show Dialog

OUTPUT_OPTIONS-TDDEST = PRINTER. "Spool: Output device

OUTPUT_OPTIONS-TDNOPRINT = ' '. "No printing from print preview

OUTPUT_OPTIONS-TDCOPIES = 1. " number of print copies

OUTPUT_OPTIONS-TDIMMED = 'X'. " Print Immediately (Print Parameters)

OUTPUT_OPTIONS-TDDELETE = 'X'. " delete the request after printing

OUTPUT_OPTIONS-TDLIFETIME = '5'. " spool retention period

OUTPUT_OPTIONS-TDCOVER = ' '. " no cover print

REgards,

Kashyap

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks, got it solved.