cancel
Showing results for 
Search instead for 
Did you mean: 

smartform problem

Former Member
0 Kudos

hi experts

i have to print 20 customers data using customer statement smartform, i put a smartform between the customers internal table. but every customer ouput dialog window coming.

my requirement is i give range of customers in selection screen, it give output one shot(for all customers), with asking print dialog every time, how to acheive this and how to pass smart form output to excel sheet as attachement.

thanks

sitaram

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear jsitaram,

You can make use of the no_open and no_close in the control parameters when calling the smart form

example:


DESCRIBE TABLE it_cust LINES t_lines.

loop at it_cust.         "customer internal table
   t_tabix = sy-tabix.
  
   PERFORM frm_set_print_ctrl USING t_lines t_tabix.

   CALL FUNCTION fm_name
      EXPORTING
        control_parameters         = print_para
        output_options             = print_dev
        user_settings              = space
        zcust                         = it_cust-cust
      EXCEPTIONS
        formatting_error           = 1
        internal_error             = 2
        send_error                 = 3
        user_canceled              = 4
        OTHERS                     = 5.

endloop.

FORM frm_set_print_ctrl USING p_lines p_index.
  CLEAR print_para.
  REFRESH print_para.
  MOVE: 'PRINTER' TO print_para-device,
        'X'       TO print_para-preview.
        'X'       TO print_para-no_dialog.

  CASE p_lines.
    WHEN 1.
      print_para-no_open = space.
      print_para-no_close = space.
    WHEN 2.
      CASE p_index.
        WHEN 1.
          print_para-no_open = space.
          print_para-no_close = 'X'.
        WHEN 2.
          print_para-no_open = 'X'.
          print_para-no_close = space.
      ENDCASE.
    WHEN OTHERS.
      CASE p_index.
        WHEN 1.
          print_para-no_open = space.
          print_para-no_close = 'X'.
        WHEN p_lines.
          print_para-no_open = 'X'.
          print_para-no_close = space.
        WHEN OTHERS.
          print_para-no_open = 'X'.
          print_para-no_close = 'X'.
      ENDCASE.
  ENDCASE.

  CLEAR: print_dev.
  MOVE:
        1 TO print_dev-tdcopies,
        'X'  TO print_dev-tdimmed,
        'X'  TO print_dev-tddelete.
endform.

The output will contains multiple page under 1 spool request. It will not ask for dialog box for every customer. Try it out.

Former Member
0 Kudos

hi Yong

i modified my code according to your example code.it not working, when i run it , it ask dialog window and execute it goes to selection screen, after that i saw spool tranaction any spool request is created, no spool requests were created.

please suggest me.

thanks

sitaram

Former Member
0 Kudos

hi yong

my code is here

form ouput.

DESCRIBE TABLE t_kna LINES t_lines.

loop at t_kna.

PERFORM Populate_Data.

*loop at t_kna. "customer internal table

t_tabix = sy-tabix.

PERFORM frm_set_print_ctrl USING t_lines t_tabix.

CALL FUNCTION form_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = wa_ctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = wa_outopt

USER_SETTINGS = space

W_FROMDATE = s_bldat-low

W_TODATE = s_bldat-high

W_KUNNR = t_kna-kunnr

  • W_SMTP_ADDR =

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

T_OPENINGBAL = t_openbal

T_STATEMENT = t_stmt

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.

*wa_outopt-tdnoprev = 'X'.

*wa_ctrlop-no_dialog = 'X'.

endloop.

ENDFORM.

FORM frm_set_print_ctrl USING p_lines p_index.

CLEAR wa_ctrlop.

  • REFRESH wa_ctrlop.

MOVE: 'PRINTER' TO wa_ctrlop-device,

'X' TO wa_ctrlop-preview,

'X' TO wa_ctrlop-no_dialog.

CASE p_lines.

WHEN 1.

wa_ctrlop-no_open = space.

wa_ctrlop-no_close = space.

WHEN 2.

CASE p_index.

WHEN 1.

wa_ctrlop-no_open = space.

wa_ctrlop-no_close = 'X'.

WHEN 2.

wa_ctrlop-no_open = 'X'.

wa_ctrlop-no_close = space.

ENDCASE.

WHEN OTHERS.

CASE p_index.

WHEN 1.

wa_ctrlop-no_open = space.

wa_ctrlop-no_close = 'X'.

WHEN p_lines.

wa_ctrlop-no_open = 'X'.

wa_ctrlop-no_close = space.

WHEN OTHERS.

wa_ctrlop-no_open = 'X'.

wa_ctrlop-no_close = 'X'.

ENDCASE.

ENDCASE.

CLEAR: wa_outopt.

MOVE:

1 TO wa_outopt-tdcopies,

'X' TO wa_outopt-tdimmed,

'X' TO wa_outopt-tddelete.

endform.

thanks

sitaram

Former Member
0 Kudos

Hi, jsitaram,

If you specify wa_ctrlop-no_dialog = 'X', you need to assign the printer name to <printer> to wa_outopt-tddest.

There are 2 options:

1) With Dialog Box(prompt for printer)


* wa_ctrlop-no_dialog = 'X'.           "Remark this

2) Without Dialog Box


wa_ctrlop-no_dialog = 'X'.
wa_outopt-tddest = 'EPSON'.      "EPSON is example

If you want to leave a copy on the spool, please remark this


* wa_outopt-tddelete = 'X'.            "remark this

Please try it out.

Edited by: Yean Nean Yong on Sep 18, 2008 8:44 AM

Former Member
0 Kudos

You need to pass the OUTPUT_OPTIONS parameter in your smart form function Module

Former Member
0 Kudos

Hi every body. The present I don't extract from a smartforms to a file .doc or .rtf. Can help me, please? Thanks you very much.