cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform Preview Disabled when PDF download is implemented

venkateswaran_k
Active Contributor
0 Kudos

Dear All

I incoproated the PDF download option in the smartform. It is working as expected, However it disables the Preview Option. I ddid not know where I am missing. I like to have both Preview option as well as PDF download.

Very much helpful if someone throw light on it.

Regards,

Venkat

Accepted Solutions (0)

Answers (7)

Answers (7)

koolspy_ultimate
Active Contributor
0 Kudos

hi,

try this


form call_smartform_function  using    f_sf_formname
                                       f_sf_fmname.



  call function 'SSF_FUNCTION_MODULE_NAME'
          exporting
            formname                 = f_sf_formname
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
          importing
            fm_name                  =  f_sf_fmname
         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.

  endif.
 st_control_parameters-no_dialog = 'X'.
 st_control_parameters-preview = 'X'.
* st_control_parameters-LANGU = 'E'.
* st_control_parameters-DEVICE = 'PRINTER'.
 st_output_options-tddest = 'WINE'.
* st_output_options-TDTITLE = 'THE ZS00 ---> VST Industries Limited '.
* st_output_options-TDNEWID = 'X'.
* st_output_options-TDIMMED = 'X'.
* st_output_options-TDDELETE = 'X'.

  call function f_sf_fmname
   exporting
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
     control_parameters         =  st_control_parameters
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
     output_options             = st_output_options
   USER_SETTINGS              = ''
   importing
     document_output_info       = st_document_output_info
     job_output_info            = st_job_output_info
    job_output_options         =  st_job_output_options
    tables
      it_output                  = it_output
      it_final                   = it_final
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 4
*   OTHERS                     = 5
            .
  if sy-subrc = 0.
 endif.

koolspy_ultimate
Active Contributor
0 Kudos

after useing the above code then write pdf download i.e


*&      Form  DISPLAY_PDF_OUTPUT
form display_pdf_output  using    f_sf_formname
                                       f_sf_fmname.
  call function 'SSF_GET_DEVICE_TYPE'
    EXPORTING
      i_language             = v_language
      i_application          = 'SAPDEFAULT'
    IMPORTING
      e_devtype              = v_e_devtype
    EXCEPTIONS
      no_language            = 1
      language_not_installed = 2
      no_devtype_found       = 3
      system_error           = 4
      others                 = 5.
  if sy-subrc <> 0.
  endif.
  st_output_options-tdprinter = v_e_devtype.
  st_control_parameters-no_dialog = 'X'.
  st_control_parameters-getotf = 'X'.
  call function 'SSF_FUNCTION_MODULE_NAME'
          exporting
            formname                 = f_sf_formname
          importing
            fm_name                  =  f_sf_fmname
         exceptions
           no_form                  = 1
           no_function_module       = 2
           others                   = 3            .
  if sy-subrc <> 0.
  endif.
  call function f_sf_fmname
   exporting
*   ARCHIVE_INDEX              =
     control_parameters         =  st_control_parameters
*   MAIL_APPL_OBJ              =
     output_options             = st_output_options
*   USER_SETTINGS              = 'X'
   importing
     document_output_info       = st_document_output_info
     job_output_info            = st_job_output_info
    job_output_options         =  st_job_output_options
    tables
      it_output                  = it_output
      it_final                   = it_final
* EXCEPTIONS
*   OTHERS                     = 5
            .
  if sy-subrc <> 0.
  endif.
*--------------------------------------------------------------------*-
*Conveting to PDF
  call function 'CONVERT_OTF_2_PDF'
* EXPORTING
*   USE_OTF_MC_CMD               = 'X'
*   ARCHIVE_INDEX                =
     importing
       bin_filesize                 = v_bin_filesize
     tables
       otf                          = st_job_output_info-otfdata
       doctab_archive               = it_docs
       lines                        = it_lines
     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.

*........................GET THE FILE NAME TO STORE....................*

  concatenate 'Tax_Invoice' '- ALL' sy-datum '.pdf' into v_name.
  create object v_guiobj.

  call method v_guiobj->file_save_dialog
    EXPORTING
      default_extension = 'pdf'
      default_file_name = v_name
      file_filter       = v_filter
    CHANGING
      filename          = v_name
      path              = v_path
      fullpath          = v_fullpath
      user_action       = v_uact.
  if v_uact = v_guiobj->action_cancel.
    exit.
  endif.

*..................................DOWNLOAD AS FILE....................*
  move v_fullpath to v_filename.
  call function 'GUI_DOWNLOAD'
    exporting
      bin_filesize                    = v_bin_filesize
      filename                        = v_filename
      filetype                        = 'BIN'
*     APPEND                          = ' '
*     WRITE_FIELD_SEPARATOR           = ' '
*   IMPORTING
*     FILELENGTH                      =
    tables
      data_tab                        = it_lines
*     FIELDNAMES                      =
    exceptions
      file_write_error                = 1
      no_batch                        = 2
      gui_refuse_filetransfer         = 3
      invalid_type                    = 4
      no_authority                    = 5
      unknown_error                   = 6
      header_not_allowed              = 7
      separator_not_allowed           = 8
      filesize_not_allowed            = 9
      header_too_long                 = 10
      dp_error_create                 = 11
      dp_error_send                   = 12
      dp_error_write                  = 13
      unknown_dp_error                = 14
      access_denied                   = 15
      dp_out_of_memory                = 16
      disk_full                       = 17
      dp_timeout                      = 18
      file_not_found                  = 19
      dataprovider_exception          = 20
      control_flush_error             = 21
      others                          = 22
            .
  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.                    " DISPLAY_

venkateswaran_k
Active Contributor
0 Kudos

Closing the thread

Former Member
0 Kudos

hi

u might have used ls_ssfctrlop-no_dialog = 'X'. if u wat preview also then use the below parameter

ls_ssfctrlop-preview = 'X'.

thanks &regards,

sandeep reddy.K

Former Member
0 Kudos

Hi,

Data Declaration for T_SSFCOMPOP :

DATA: T_SSFCOMPOP TYPE SSFCOMPOP.

And while generated fucntion module pass T_SSFCOMOPOP aslo like:

CALL FUNCTION FNAME
    EXPORTING
      CONTROL_PARAMETERS = T_SSFCTRLOP
      OUTPUT_PARAMETERS = T_SSFCOMPOP
    IMPORTING
      JOB_OUTPUT_INFO    = T_SSFCRESCL
    TABLES
      T_FORMDATA         = T_FORMDATA.

BR

Dep

Former Member
0 Kudos

Hi,

Also try with passing,

T_SSFCOMPOP-tddest = 'LP01'.

BR,

Dep

Former Member
0 Kudos

Hi,

Also pass device type like below:

DATA v_e_devtype     TYPE rspoptype.

 	CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
 	  EXPORTING
 	    i_language          = v_language
 	    i_application       = 'SAPDEFAULT'
 	  IMPORTING
 	    e_devtype           = v_e_devtype.

 	T_SSFCOMPOP-tdprinter = v_e_devtype.
 	T_SSFCTRLOP-no_dialog = 'X'.
 	T_SSFCTRLOP-getotf = 'X'.

Let me know if any more info required.

BR

Dep

Former Member
0 Kudos

Also pass

T_SSFCTRLOP-PREVIEW = 'X'. So code becomes like:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME = 'YFF_INVOICE' 
      IMPORTING
        FM_NAME  = FNAME.
 
***Pass this three parameters
  T_SSFCTRLOP-NO_DIALOG = ' '.
  T_SSFCTRLOP-GETOTF = 'X'.
  T_SSFCTRLOP-LANGU = 'E'.
 T_SSFCTRLOP-PREVIEW = 'X'.

  CALL FUNCTION FNAME
    EXPORTING
      CONTROL_PARAMETERS = T_SSFCTRLOP
    IMPORTING
      JOB_OUTPUT_INFO    = T_SSFCRESCL
    TABLES
      T_FORMDATA         = T_FORMDATA.

Let me know if you require any more info.

BR

Dep

venkateswaran_k
Active Contributor
0 Kudos

Thankyou Very much Deepak..

It almost solved the issue. The issue pending is that I am getting the error as

"output type hplj4 does not have the device type PDF1."

Regards,

Venkat

Former Member
0 Kudos

Hi,

Do Like below:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME = 'YFF_INVOICE' 
      IMPORTING
        FM_NAME  = FNAME.
 
***Pass this three parameters
  T_SSFCTRLOP-NO_DIALOG = ' '.
  T_SSFCTRLOP-GETOTF = 'X'.
  T_SSFCTRLOP-LANGU = 'E'.
 
  CALL FUNCTION FNAME
    EXPORTING
      CONTROL_PARAMETERS = T_SSFCTRLOP
    IMPORTING
      JOB_OUTPUT_INFO    = T_SSFCRESCL
    TABLES
      T_FORMDATA         = T_FORMDATA.

Let me know if you need more info.

BR

Dep