cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform NODIALOG , OTF issue

Former Member
0 Kudos

Hi Experts,

My requirement is to convert Smartform to PDF and download it in local drive. I wanted to suppress the Print option dialog, I have done the coding to suppress it but still the Print Option dialog opens and It asks for Print . If i give print Preview also, When i check the return parameter ( it_jobout1-otfdata[ ]) from Smartform function module , the OTF data is Empty. I have attached my code below. Please suggest me what i am missing to suppress the dialog and to get the OTF data in return ?

v_control_parameters-getotf = 'X'.

v_control_parameters-no_dialog = 'X'.

v_control_parameters-device = 'PRINTER'.

wa_compop-tddest = 'LOCL'.

*TO CALL THE FUNCION MODULE TO PRINT THE SMART FORMS

CALL FUNCTION v_fun_name

EXPORTING

control_param = v_control_parameters

output_options = wa_compop

  • user_settings = ' '

is_ekko = is_ekko

v_tot = v_tot

v_menge = v_menge

v_meins = v_meins

IMPORTING

job_output_info = it_jobout1

TABLES

it_tab1 = it_tab1

it_tab2 = it_tab2

it_tab3 = it_tab3

it_hedr = it_hedr

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_conv_file = it_jobout1-otfdata[].

*TO CONVERT THE OTF DATA TO PDF

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = l_file_size

TABLES

otf = wa_conv_file

lines = wa_dwld_file_format

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

IF sy-subrc <> 0.

LOOP AT wa_dwld_file_format INTO wa_tline.

ASSIGN wa_tline TO <p> CASTING TYPE x.

CONCATENATE outputx <p> INTO outputx IN BYTE MODE.

ENDLOOP.

EXPORT outputx TO MEMORY ID id_itab.

ENDIF.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

I have tried Everything from NO_OPEN , NO_CLOSE etc .. But still the Printer Dialog screen is coming up and OTF data is not getting populated. Am i missing something on the SMARTFORM side. This particular program in i am trying is PO print, Custom smartform and Program configured in the output type. Please let me know the solution at the earliest.

Thanks,

Murali

Former Member
0 Kudos

Hello Murali,<br />

<br />

Have you tried what i suggested ?<br />

<br />

It is because of the parameter USER_SETTINGS.<br />

<br />

Please read <a class="jive-link-external" href="http://help.sap.com/saphelp_470/helpdata/en/d5/6243ea8a4111d4b605006094192fe3/frameset.htm" target="_newWindow">USER_SETTINGS</a><br />

<br />

Only if the parameter is not set i.e. USER_SETTINGS = SPACE , Smart Forms evaluates parameters of the structure for the output options ( SSFCOMOP ).<br />

<br />

If you check the smart form by default USER_SETTINGS = 'X'.<br />

<br />

Pass USER_SETTINGS = SPACE along with the other parameters which i mentioned<br />

<br />

Regards

Edited by: Rajvansh Ravi on Jun 28, 2010 6:42 AM

Former Member
0 Kudos

Ravi,

I have tried that Too. USER_SETTINGS = SPACE, but still it is not resolving the issue. Even i am amazed by this issue. Could not figure out what is the problem. Please let me know if i am missing something on the Smartform side

Thanks,

Murali

Former Member
0 Kudos

Hi Murali,

Very strange. After passing the parameters, the pop up will only come if there are mandatory parameters which are not passed.

I am attaching my complete code below

DATA
       : l_control_parameters TYPE ssfctrlop,
         l_output_options     TYPE ssfcompop,
         l_bin_filesize       TYPE i,
         l_file_name          TYPE string,
         l_text               TYPE string.

  DATA
       : lit_job_output_info  TYPE ssfcrescl,
         lit_pdf              TYPE TABLE OF tline.

  l_control_parameters-no_dialog = c_x.
  l_control_parameters-preview   = c_x.

  l_output_options-tddest    = 'LP01'. "--> Make sure the printer name is correct (Check table TSP03)
  l_output_options-tdnoprint = c_x.

  IF x_pdf = c_x. "--> Based on selection screen input i decide to convert to PDF
    l_control_parameters-getotf = c_x.
  ENDIF.

CALL FUNCTION p_l_form
    EXPORTING
      control_parameters = l_control_parameters
      output_options     = l_output_options
      user_settings      = space
      i_bukrs            = p_l_final-bukrs
      i_gsber            = p_l_final-gsber
      i_butxt            = p_l_final-butxt
      i_gtext            = p_l_final-gtext
      i_budat_from       = g_budat_from
      i_budat_to         = g_budat_to
      it_final           = it_final
    IMPORTING
      job_output_info    = lit_job_output_info
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  IF sy-subrc EQ 0.

    IF x_pdf = c_x.

      PERFORM convert_otf_pdf
              USING lit_job_output_info-otfdata
              CHANGING lit_pdf
                       l_bin_filesize.
    ENDIF.
 ENDIF

FORM convert_otf_pdf
     USING p_it_otfdata TYPE tsfotf
     CHANGING p_it_pdf TYPE tline_t
              l_bin_filesize TYPE i.

  DATA
       : lit_docs TYPE TABLE OF docs.

  CALL FUNCTION 'CONVERT_OTF_2_PDF'
* EXPORTING
*   USE_OTF_MC_CMD               = 'X'
*   ARCHIVE_INDEX                =
 IMPORTING
      bin_filesize                 = l_bin_filesize
    TABLES
      otf                          = p_it_otfdata
      doctab_archive               = lit_docs
      lines                        = p_it_pdf
   EXCEPTIONS
     err_conv_not_possible        = 1
     err_otf_mc_noendmarker       = 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.

ENDFORM.                    " CONVERT_OTF_PDF

Former Member
0 Kudos

Hi ,

Try this ...

gs_ctrlop-getotf = 'X'.

gs_ctrlop-device = 'PRINTER'.

gs_ctrlop-preview = 'X'.

gs_ctrlop-no_dialog = 'X'.

gs_outopt-tddest = 'LOCL'.

Let me know if any concerns........

Regards,

Lokesh

Former Member
0 Kudos

Hi,

I think it is because of the parameter user_settings

Try as given below

l_control_parameters-no_dialog = c_x.
  l_control_parameters-preview   = c_x.

  l_output_options-tddest    = 'LP01'.
  l_output_options-tdnoprint = c_x.

  IF x_pdf = c_x.
    l_control_parameters-getotf = c_x.
  ENDIF.

  CALL FUNCTION p_l_form
    EXPORTING
      control_parameters = l_control_parameters
      output_options     = l_output_options
      user_settings      = space
      i_bukrs            = p_l_final-bukrs
      i_gsber            = p_l_final-gsber
      i_butxt            = p_l_final-butxt
      i_gtext            = p_l_final-gtext
      i_budat_from       = g_budat_from
      i_budat_to         = g_budat_to
      it_final           = it_final
    IMPORTING
      job_output_info    = lit_job_output_info

Regards

Former Member
0 Kudos

HI..

Please try using the parameters

v_control_parameters-no_close = 'X' or

v_control_parameters-no_open = 'X'.

Regards,

Karthik