Skip to Content
avatar image
Former Member

Printing multiple documents

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!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 27, 2009 at 12:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2009 at 12:43 PM

    Thanks, got it solved.

    Add comment
    10|10000 characters needed characters exceeded