cancel
Showing results for 
Search instead for 
Did you mean: 

Can smartforms allows Print and Preview simultaneously?

Former Member
0 Kudos

Hi all,

As above, I am having problem print and preview at the same time.

I can only print immediately without the preview screen, or preview screen with without print immediately (need to press the printer button to trigger print).

I have an alternative way, but it seems writing the code in not proper way, however it is working.


  LS_OUTPUT_PARAM-TDNOPREV  = 'X'.
  LS_OUTPUT_PARAM-TDNOPRINT = SPACE.
  LS_OUTPUT_PARAM-tdimmed   = 'X'.
  LS_OUTPUT_PARAM-tdcopies  = 1.
  LS_OUTPUT_PARAM-tddelete  = SPACE.
  LS_OUTPUT_PARAM-tdnewid   = 'X'.
  LS_OUTPUT_PARAM-tddest    = 'LOCL'.
  LS_OUTPUT_PARAM-tdFINAL   = 'X'.

  LS_CONTROL_PARAM-device    = 'PRINTER'.
  LS_CONTROL_PARAM-getotf    = SPACE.
  LS_CONTROL_PARAM-no_dialog = 'X'.
  LS_CONTROL_PARAM-preview   = ''.

  call function fm_name
       exporting
                 control_parameters   = LS_CONTROL_PARAM
                 output_options       = LS_OUTPUT_PARAM
                 user_settings         = SPACE
                  customer             = customer
                  bookings             = bookings
                  connections          = connections
      importing
                 job_output_info      = ls_job_info
       exceptions formatting_error     = 1
                  internal_error       = 2
                  send_error           = 3
                  user_canceled        = 4
                  others               = 5.

*Call the PRINT function again to enable preview screen display*
  LS_OUTPUT_PARAM-TDNOPRINT = 'X'.
  LS_CONTROL_PARAM-preview  = 'X'.

  call function fm_name
       exporting
                 control_parameters   = LS_CONTROL_PARAM
                 output_options       = LS_OUTPUT_PARAM
                 user_settings         = SPACE
                  customer             = customer
                  bookings             = bookings
                  connections          = connections
      importing
                 job_output_info      = ls_job_info
       exceptions formatting_error     = 1
                  internal_error       = 2
                  send_error           = 3
                  user_canceled        = 4
                  others               = 5.

Is there a way to do both at the same time?

Accepted Solutions (0)

Answers (2)

Answers (2)

yang_aiolos
Active Participant
0 Kudos

ssfctrlop-no_dialog = 'X'. "Just set this one. It gives what you want.

ssfctrlop-preview = 'X'.

ssfcompop-tdimmed = 'X'.

After set these three parameters,you can do it.

I have tested it,worked normally.

LS_OUTPUT_PARAM-TDNOPRINT = 'X'.

do not set this one.

Regard

Edited by: yang Aiolos on Mar 4, 2010 8:03 AM

Former Member
0 Kudos

No it is not working. It only preview, but without print out the document.

What the user requested is, print and preview at the same time.

yang_aiolos
Active Participant
0 Kudos

try these code.

LS_OUTPUT_PARAM-tdimmed = 'X'.

LS_OUTPUT_PARAM-tddest = 'LOCL'.

LS_CONTROL_PARAM-no_dialog = 'X'.

LS_CONTROL_PARAM-preview = 'X'.

call function fm_name

exporting

control_parameters = LS_CONTROL_PARAM

output_options = LS_OUTPUT_PARAM

user_settings = SPACE

customer = customer

bookings = bookings

connections = connections

importing

job_output_info = ls_job_info

exceptions formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if still don't work,i have no idea.

in my system,it is working.

Former Member
0 Kudos

It is still the same.

It can print the form but I need to press on the printer button.

What I need is preview + print instantly.

Sandra_Rossi
Active Contributor
0 Kudos

It works like that. Why do you want to preview as it is already printed? In applications, you always have to either print without previewing, or preview before printing, but not print then preview.

Former Member
0 Kudos

Hi Sandra,

Thanks for your reply. I understand that this is can only be done either way, however this is the user requirement.

Sandra_Rossi
Active Contributor
0 Kudos

> however this is the user requirement

Ask twice the user why would you develop something different from all the other printouts, is there a good reason...

Now, if there is a good reason to do so, your "alternative way" is fine (print then preview), it works as if it was done at the same time (by the way, I wouldn't hardcode the output device name, but that's my only remark)

Former Member
0 Kudos

Solution seems to be this only (you have already mention it as well)

ls_control-no_dialog = 'X'.

*ls_control-preview = 'X'.

ls_output-tdimmed = 'X'.

Then again call the FM with following parameters for output and control data to preview the smartform

ls_control-no_dialog = 'X'.

ls_control-preview = 'X'.

*ls_output-tdimmed = 'X'.

Edited by: KULWINDER SINGH on Mar 5, 2010 8:02 AM