cancel
Showing results for 
Search instead for 
Did you mean: 

Print document without Preview

Former Member
0 Kudos

Hi all,

I have a requirement to print a form that will develop using smartforms. In the program I have called function call 'SSF_FUNCTION_MODULE_NAME'. With below code, it will prompt a screen to enter the printer name and so and so.

How could the program to skip this screen?


  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = p_form
*                 variant            = ' '
*                 direct_call        = ' '
       importing  fm_name            = fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.

  if sy-subrc <> 0.
*   error handling
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    exit.
  endif.

* now call the generated function module
  data: LS_CONTROL_PARAM TYPE SSFCTRLOP,
        LS_COMPOSER_PARAM TYPE SSFCOMPOP.

  LS_COMPOSER_PARAM-TDNOPREV = ' '.
  LS_CONTROL_PARAM-no_open = SPACE.
  LS_CONTROL_PARAM-no_close = SPACE.
  LS_CONTROL_PARAM-no_dialog = 'X'.
  LS_CONTROL_PARAM-preview = SPACE.

  call function fm_name
       exporting
*                 archive_index        =
*                 archive_parameters   =
                 control_parameters   = LS_CONTROL_PARAM
*                 mail_appl_obj        =
*                 mail_recipient       =
*                 mail_sender          =
*                 output_options       = LS_COMPOSER_PARAM
*                 user_settings        = 'X'
                  customer             = customer
                  bookings             = bookings
                  connections          = connections
*      importing  document_output_info =
*                 job_output_info      =
*                 job_output_options   =
       exceptions formatting_error     = 1
                  internal_error       = 2
                  send_error           = 3
                  user_canceled        = 4
                  others               = 5.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

try the below code

LS_COMPOSER_PARAM-TDNOPREV = ' '.

LS_CONTROL_PARAM-no_open = SPACE.

LS_CONTROL_PARAM-no_close = SPACE.

LS_CONTROL_PARAM-no_dialog = 'X'.

LS_CONTROL_PARAM-preview = 'X'.

DATA: opopt TYPE ssfcompop,

opopt-tddest = 'XXXX'-----> device shoort name .

opopt-tdimmed = 'X'.

opopt-tddelete = 'X'.

CALL FUNCTION fname

EXPORTING

control_parameters = LS_COMPOSER_PARAM

output_options = opopt

user_settings = ' '

etc etc

thank you

surya reddy

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You just need to add 'X' to your LS_CONTROL_PARAM-preview = SPACE.

LS_CONTROL_PARAM-preview = 'X'.

Change this it will work

Regards

Sarves

Former Member
0 Kudos

Hi all,

It is still not working. Perhaps I did something wrong.

Please help see what is not right there


report zxxx_smartform.

data: carr_id type sbook-carrid,
      fm_name type rs38l_fnam.

parameter:      p_custid type scustom-id default 1.
select-options: s_carrid for carr_id     default 'LH' to 'LH'.
parameter:      p_form   type tdsfname   default 'SF_EXAMPLE_01'.

data: customer    type scustom,
      bookings    type ty_bookings,
      connections type ty_connections.

  select single * from scustom into customer where id = p_custid.
  check sy-subrc = 0.
  select * from sbook into table bookings
           where customid = p_custid
           and   carrid   in s_carrid
           order by primary key.
  select * from spfli into table connections
           for all entries in bookings
           where carrid = bookings-carrid
           and   connid = bookings-connid
           order by primary key.

  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = p_form
       importing  fm_name            = 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.
    exit.
  endif.

  data: LS_CONTROL_PARAM TYPE SSFCTRLOP,
        LS_COMPOSER_PARAM TYPE SSFCOMPOP.

  LS_COMPOSER_PARAM-TDNOPREV = ' '.
  LS_COMPOSER_PARAM-tdimmed = 'X'.
  LS_COMPOSER_PARAM-tddelete = 'X'.
  LS_COMPOSER_PARAM-tddest = 'P009'.

  LS_CONTROL_PARAM-no_open = SPACE.
  LS_CONTROL_PARAM-no_close = SPACE.
  LS_CONTROL_PARAM-no_dialog = 'X'.
  LS_CONTROL_PARAM-preview = 'X'.

  call function fm_name
       exporting
                 control_parameters   = LS_CONTROL_PARAM
                 output_options       = LS_COMPOSER_PARAM
                  customer             = customer
                  bookings             = bookings
                  connections          = connections
       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.

Former Member
0 Kudos

Hi,

your parameter LS_COMPOSER_PARAM -TDNOPREV is still not set to 'X'

LS_COMPOSER_PARAM -TDNOPREV = 'X'

Gr., Frank

Former Member
0 Kudos

Hi Bernsen,

Thanks for your input. Eventhough I set LS_COMPOSER_PARAM -TDNOPREV = 'X', the preview screen still prompts out.

Former Member
0 Kudos

hi,

i see anotgher one

LS_CONTROL_PARAM-preview = 'X'.

this one has to be space.

Gr., Frank

Former Member
0 Kudos

Hi Bernsen,

The preview screen still prompts out.

Former Member
0 Kudos

Hi,

I don't see any issue with the code when i run the same in my system its working fine.. It is not giving any Print Preview dialog.

And it is not necessary to give Preview as space because when you make preview as space it will not give any preview it will directly go for the print.

LS_CONTROL_PARAM-no_dialog = 'X'. If this is X then it will suppress the preview dialog.

Just re check it. It will work

Regards

Sarves

Former Member
0 Kudos

Hi all,

I am sorry that what I wanted is to disable the print preview dialog box.

Former Member
0 Kudos

Hi,

try this one:

LS_COMPOSER_PARAM -TDNOPREV = 'X'

do not forget to remove the comment star in your call function.

Gr., Frank