cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform is not printed immediately

Former Member
0 Kudos

Hi all,

I have some problems with my code below. My requirements are to get the form print immediately without the dialog, as well as create a spool for next print purposes.

Can someone please tell me what is wrong with my code?

Many thanks in advance.


  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.

  data: LS_CONTROL_PARAM TYPE SSFCTRLOP.
  data: LS_OUTPUT_PARAM TYPE SSFCOMPOP.
  DATA: ls_job_info TYPE ssfcrescl.

  LS_OUTPUT_PARAM-TDNOPREV  = 'X'.
  LS_OUTPUT_PARAM-TDNOPRINT = 'X'.
  LS_OUTPUT_PARAM-tdimmed   = SPACE.
  LS_OUTPUT_PARAM-tdcopies  = 1.
  LS_OUTPUT_PARAM-tddelete  = 'X'.
  LS_OUTPUT_PARAM-tdnewid   = 'X'.
  LS_OUTPUT_PARAM-tddest    = 'P098'.
  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   = 'X'.
  LS_CONTROL_PARAM-no_open   = 'X'.
  LS_CONTROL_PARAM-no_close  = 'X'.

  call function 'SSF_OPEN'
    exporting
      USER_SETTINGS            = SPACE
      OUTPUT_OPTIONS           = LS_OUTPUT_PARAM
      control_parameters       = LS_CONTROL_PARAM
    exceptions
      formatting_error         = 1
      internal_error           = 2
      send_error               = 3
      user_canceled            = 4
      others                   = 5.

  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 function 'SSF_CLOSE'
    exceptions
      formatting_error       = 1
      internal_error         = 2
      send_error             = 3
      others                 = 4.

  call function 'SSF_READ_ERRORS'
       importing
            errortab = errtab.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Myahsam,

Refer this [Link|http://help.sap.com/saphelp_nw70/helpdata/en/64/bf2f12ed1711d4b655006094192fe3/content.htm]

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

u should pass the below values to OUTPUT_OPTIONS & Contol_parameters..

l_t_out-tddest = 'LOCL'.

l_t_out-tdimmed = 'X'.

l_t_out-TDNOPRINT = 'X'.

l_t_out-tddelete = 'X'.

l_t_control-no_dialog = 'X'.

Hope it hellps!!

Rgds,

Pavan

Former Member
0 Kudos

Hi vishnu,

I tried this, it is still not immediately printed.

LS_OUTPUT_PARAM-TDNOPREV  = 'X'.
  LS_OUTPUT_PARAM-TDNOPRINT = 'X'.
  LS_OUTPUT_PARAM-tdimmed   = 'X'.
  LS_OUTPUT_PARAM-tdcopies  = 1.
  LS_OUTPUT_PARAM-tddelete  = 'X'.
  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   = 'X'.
  LS_CONTROL_PARAM-no_open   = 'X'.
  LS_CONTROL_PARAM-no_close  = 'X'.

Former Member
0 Kudos

Hi,

first u try to pass the values only for those given in my earlier thread...

what actually u r getting? r u still getting the print preview?

I had just tried with my program by passing only those values, it went to printer immediately & also i had taken the printout...

Rgds,

Pavan

Former Member
0 Kudos

Hi pavan,

Appreciate for your help. When I executed the program, first, it prompts me the selection option screen. After I filled all the necessary fields, I clicked on "execute" button, it will goes to the preview screen.

What my requirement is the print out should also execute immediately after the preview screen display.

Also, my requirement needs to create a spool id in SP01.

Can it be done?

Thanks.

Former Member
0 Kudos

hi,

while exporting control parameters to the FM which calls smart form pass 'X' to the no_dialog parameter. this will not show you any dialog box.

wa_ctrl_param-no_dialog = 'X'.

make sure u pass control parameters as export parameters

Former Member
0 Kudos

Hi,

If you read my post above, I have already set 'X' into LS_CONTROL_PARAM-no_dialog.

Former Member
0 Kudos

you can choose, either print preview OR print out, But you can NOT goto preview and expect him to create an output as well.

venkat_o
Active Contributor
0 Kudos

Wong, Please create one test program and test this program. It prints directly and keeps spool number. I can see that in SP01. This code is same as before i posted yesterday except one line commented.


REPORT  ztest_smartform.
DATA:it_nfal   TYPE nfal OCCURS 0 WITH HEADER LINE.
DATA:fm_name   TYPE rs38l_fnam.
DATA:ssfctrlop TYPE ssfctrlop.
"START-OF-SELECTION.

START-OF-SELECTION.
  "select data
  SELECT * FROM nfal INTO TABLE it_nfal UP TO 10 ROWS.

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

  "Get Function module name for given smartform
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname = 'ZTEST_SMARTFORM'
    IMPORTING
      fm_name  = fm_name.
  "Call Smartform function module.
  CALL FUNCTION fm_name
    EXPORTING
      control_parameters = ssfctrlop
*      output_options     = ssfcompop  "commented one
    TABLES
      it_nfal            = it_nfal.
Thanks Venkat.O

Former Member
0 Kudos

Hi venkat,

Thanks for the follow up.

I have copied your code (the latest one) and created a dummy smartforms.

Program and smartforms compiled successfully. Now, I execute it, the print dialog is prompt again.

Is there any profile settings difference between you and me?

Why the print dialog is still displaying?

Very strange.

Former Member
0 Kudos

Hi Wong,

You have to use "user_settings = space" as well, because else it always takes your settings from your user profile (SU01).

Hopefully helps.

Pavol

venkat_o
Active Contributor
0 Kudos

Hi Wong, <li>Instead of using SS_OPEN and SSF_CLOSE, you can use directly function module which is generated when you activate smartform. <li>Check the program and see what needs to be done to get what u want.

REPORT  ztest_smartform.
DATA:it_nfal   TYPE nfal OCCURS 0 WITH HEADER LINE.
DATA:fm_name   TYPE rs38l_fnam.
DATA:ssfctrlop TYPE ssfctrlop.
"START-OF-SELECTION.
START-OF-SELECTION.
  "select data
  SELECT * FROM nfal INTO TABLE it_nfal UP TO 10 ROWS.

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

"Get Function module name for given smartform
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname = 'ZTEST_SMARTFORM'
    IMPORTING
      fm_name  = fm_name.
"Call Smartform function module.
  CALL FUNCTION fm_name
    EXPORTING
      control_parameters = ssfctrlop
      output_options     = ssfcompop
    TABLES
      it_nfal            = it_nfal.
I hope that it solves your requirement. Thanks Venkat.O

Former Member
0 Kudos

Hi Venkat,

Thanks for your input. I have tried that, but it is not working

Do you have any idea? The form is not printed immediately and there is no record created in Spool.

premal_mistry2
Active Participant
0 Kudos

Hi Wong,

You need to rectify as specified below.

LS_OUTPUT_PARAM-TDNOPRINT = SPACE.
  LS_OUTPUT_PARAM-tdimmed   ='X'.

Regards,

Premal

Former Member
0 Kudos

Hi Premal,

Thanks for your reply. The form is shown in Preview, but it is not printed immediately at printer, and no spool id is created.

Whats wrong? Somebody please help.