Direct Conversion of smartform into PDF system has to take spool request ?

does anybody know:
Direct Conversion of smartform into PDF, system has to take spool request dynamically..
i don't mean to use the SE38 calling PRG RSTXPDFT4 to transfer SAP sript into PDF.
thanks
SRIDHAR

--strike Yes this is what I understood.
In the structure job_output_info of your function you'll find your OTF data :
st_ssfcrescl-otfdata --
  CALL FUNCTION smartform_fonction_name
        EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
      control_parameters         = st_ssfctrlop
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
      output_options             = st_ssfcompop
      user_settings              = ' '
    IMPORTING
     document_output_info        = st_ssfcrespd
     job_output_info             = st_ssfcrescl " This is the one which contains OTF data
     job_output_options          = st_ssfcresop
    TABLES
   EXCEPTIONS
     formatting_error           = 1
     internal_error             = 2
     send_error                 = 3
     user_canceled              = 4
     OTHERS                     = 5.
-- Then you just have to convert, using something like that : --
* Convert OTF to PDF
  LOOP AT otf_data INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
    INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
  ENDLOOP.
  CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
      format_src      = 'OTF'
      format_dst      = 'PDF'
    CHANGING
      transfer_bin    = w_transfer_bin
      content_txt     = i_content_txt
      content_bin     = i_content_bin
      objhead         = i_objhead
      len             = v_len_in
    EXCEPTIONS
      err_conv_failed = 1
      OTHERS          = 2.
  v_size = v_len_in.
  pdf_itab_size = v_size.
  it_pdfout[] = it_pdf[].
* Create the PDF File
  CLEAR it_pdfdata.
  REFRESH it_pdfdata.
*  it_pdfdata[] = it_pdfout[].
  LOOP AT it_pdfout.
    MOVE it_pdfout-tline TO it_pdfdata-line.
    APPEND it_pdfdata.
    CLEAR it_pdfdata.
  ENDLOOP.
-- The smartform creation and the PDF creation are done in the same time...--
OK, So what do'nt you want to use the RSTXPDFT4 program ?
Hope this helps,
Erwan
Edited by: Erwan LE BRUN on Aug 28, 2008 12:02 PM
Edited by: Erwan LE BRUN on Aug 28, 2008 12:03 PM

Similar Messages

  • Unable to print directly from vf03 txn after converting  smartform into PDF

    Dear All,
    I have converted ond smartform into pdf.now when i am trying to print one document using vf03 transaction whatever button i click(ex-print preview/print) it is asking to save the pdf as local file. but i want to print that document as pdf directly from vf03 without saving it into local file.
    I am giving you the code below:-
    (all modification done by me are in BOLD)
         Print of a invoice by SAPscript SMART FORMS               *
    REPORT zrlb_invoice5.
    declaration of data
    INCLUDE zrlb_invoice_data_declare5.
    *INCLUDE ZRLB_INVOICE_DATA_DECLARE.
    *INCLUDE rlb_invoice_data_declare.
    definition of forms
    INCLUDE zrlb_invoice_form015.
    *INCLUDE ZRLB_INVOICE_FORM01.
    *INCLUDE rlb_invoice_form01.
    INCLUDE zrlb_print_forms5.
    *INCLUDE ZRLB_PRINT_FORMS.
    *INCLUDE rlb_print_forms.
    START-OF-SELECTION.
          FORM ENTRY
    FORM entry USING return_code us_screen.
      DATA: lf_retcode TYPE sy-subrc.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing USING us_screen
                         CHANGING lf_retcode.
      IF lf_retcode NE 0.
        return_code = 1.
      ELSE.
        return_code = 0.
      ENDIF.
    ENDFORM.                    "ENTRY
          FORM PROCESSING                                               *
    FORM processing USING proc_screen
                    CHANGING cf_retcode.
      DATA: lv_medium LIKE tnapr-nacha.
      DATA: lwa_print_data_to_read TYPE lbbil_print_data_to_read.
      DATA: lwa_bil_invoice TYPE lbbil_invoice.
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: lwa_control_param      TYPE ssfctrlop.
      DATA: lwa_composer_param     TYPE ssfcompop.
      DATA: lwa_recipient          TYPE swotobjid.
      DATA: lwa_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: lwa_addr_key           LIKE addr_key.
      DATA: ls_dlv-land           LIKE vbrk-land1.
      DATA:lv_job_output_info      TYPE ssfcrescl,
             lv_document_output_info TYPE ssfcrespd,
             lv_job_output_options   TYPE ssfcresop,
             lv_bin_filesize          TYPE i,
             gt_docs  TYPE STANDARD TABLE OF docs,
             gt_lines TYPE STANDARD TABLE OF tline,
             gt_otf TYPE TABLE OF itcoo, " OTF Structure
             lv_name                  TYPE string VALUE 'INVOICE',
             lv_guiobj                TYPE REF TO cl_gui_frontend_services,
             lv_path                  TYPE string  VALUE 'D:\',
             lv_fullpath              TYPE string VALUE 'D:\INVOICE',
             lv_filter                TYPE string,
             lv_uact                  TYPE i,
             lv_filename              TYPE string,
    ++lv_fm_name               TYPE rs38l_fnam.         +*****************************************
    SmartForm from customizing table TNAPR
      lf_formname = tnapr-sform.
      lv_medium = tnapr-nacha.
    determine print data
      PERFORM set_print_data_to_read USING    lf_formname
                                     CHANGING lwa_print_data_to_read
                                     cf_retcode.
      IF cf_retcode EQ 0.
    select print data
        PERFORM get_data USING    lwa_print_data_to_read
                         CHANGING lwa_addr_key
                                  ls_dlv-land
                                  lwa_bil_invoice
                                  cf_retcode.
      ENDIF.
      IF cf_retcode EQ 0.
        PERFORM set_print_param USING    lwa_addr_key
                                         ls_dlv-land
                                CHANGING lwa_control_param
                                         lwa_composer_param
                                         lwa_recipient
                                         lwa_sender
                                         cf_retcode.
      ENDIF.
      IF cf_retcode EQ 0.
    determine smartform function module for invoice
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
             EXPORTING  formname           = lf_formname
                    variant            = ' '
                    direct_call        = ' '
             IMPORTING  fm_name            = lf_fm_name
             EXCEPTIONS no_form            = 1
                        no_function_module = 2
                        OTHERS             = 3.
        IF sy-subrc NE 0.
      error handling
          cf_retcode = sy-subrc.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
      IF cf_retcode EQ 0.
        PERFORM check_repeat.
        IF lwa_composer_param-tdcopies EQ 0.
          nast_anzal = 1.
        ELSE.
          nast_anzal = lwa_composer_param-tdcopies.
        ENDIF.
        lwa_composer_param-tdcopies = 1.
        DO nast_anzal TIMES.
    In case of repetition only one time archiving
          IF sy-index GT 1 AND nast-tdarmod EQ 3.
            nast_tdarmod = nast-tdarmod.
            nast-tdarmod = 1.
            lwa_composer_param-tdarmod = 1.
          ENDIF.
          IF sy-index NE 1 AND repeat IS INITIAL.
            repeat = 'X'.
          ENDIF.
    call smartform invoice
         CALL FUNCTION lf_fm_name
              EXPORTING
                         archive_index        = toa_dara
                         archive_parameters   = arc_params
                         control_parameters   = ls_control_param
                    mail_appl_obj        =
                         mail_recipient       = ls_recipient
                         mail_sender          = ls_sender
                         output_options       = ls_composer_param
                         user_settings        = space
                         is_bil_invoice       = ls_bil_invoice
                         is_nast              = nast
                         is_repeat            = repeat
         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.
          lwa_control_param-getotf = 'X'.
          lwa_control_param-no_dialog = 'X'.
          lwa_control_param-device = 'PRINTER'.
          CALL FUNCTION lf_fm_name
            EXPORTING
             archive_index              = toa_dara
    Begin of Changes 24/10/2007*
      ARCHIVE_INDEX_TAB          =*
            ARCHIVE_PARAMETERS         = arc_params*
             control_parameters         = lwa_control_param
      MAIL_APPL_OBJ              =*
            MAIL_RECIPIENT             = lwa_recipient*
            MAIL_SENDER                = lwa_sender*
    *End of changes 04/12/2007
             output_options             = lwa_composer_param
             user_settings              = 'X'
              is_bil_invoice             = lwa_bil_invoice
              is_nast                    = nast
              is_repeat                  = repeat
              iv_medium                  = lv_medium
    Begin OF Changes 04/12/2007*
    IMPORTING
       document_output_info       = lv_document_output_info
       job_output_info            = lv_job_output_info
       *job_output_options         = lv_job_output_options     *
    End Of Changes 04/12/2007*
    EXCEPTIONS
       formatting_error           = 1
       internal_error             = 2
       send_error                 = 3
       user_canceled              = 4
       OTHERS                     = 5.
         CALL FUNCTION lf_fm_name
           EXPORTING
            ARCHIVE_INDEX              = toa_dara
      ARCHIVE_INDEX_TAB          =
            ARCHIVE_PARAMETERS         = arc_params
            CONTROL_PARAMETERS         = lWA_control_param
      MAIL_APPL_OBJ              =
            MAIL_RECIPIENT             = lwa_recipient
            MAIL_SENDER                = lwa_sender
            OUTPUT_OPTIONS             = lwa_composer_param
            USER_SETTINGS              = space
             IS_BIL_INVOICE             = LWA_BIL_INVOICE
             IS_NAST                    = nast
             IS_REPEAT                  = repeat
             IV_MEDIUM                  = lv_medium
    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
          gt_otf[] = lv_job_output_info-otfdata[].
                  CALL FUNCTION 'CONVERT_OTF'
             EXPORTING
               FORMAT                      = 'PDF'
               MAX_LINEWIDTH               = 132
            ARCHIVE_INDEX               = ' '*
            COPYNUMBER                  = 0*
            ASCII_BIDI_VIS2LOG          = ' '*
             IMPORTING
               BIN_FILESIZE                = lv_bin_filesize
            BIN_FILE                    =*
              TABLES
                otf                         = gt_otf
                lines                       = gt_lines
          EXCEPTIONS*
            ERR_MAX_LINEWIDTH           = 1*
            ERR_FORMAT                  = 2*
            ERR_CONV_NOT_POSSIBLE       = 3*
            ERR_BAD_OTF                 = 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.
    *.......................GET THE FILE NAME TO STORE.........
            CONCATENATE 'smrt' '.pdf' INTO lv_name.
          CREATE OBJECT lv_guiobj.
          CALL METHOD lv_guiobj->file_save_dialog
            EXPORTING
              default_extension = 'pdf'
              default_file_name = lv_name
              file_filter       = lv_filter
            CHANGING
              filename          = lv_name
              path              = lv_path
              fullpath          = lv_fullpath.
       user_action       = lv_uact.*
          IF lv_uact = lv_guiobj->action_cancel.
            EXIT.
          ENDIF.*
         MOVE lv_fullpath TO lv_filename.
           CALL METHOD cl_gui_frontend_services=>gui_download
             EXPORTING
              BIN_FILESIZE              =  lv_bin_filesize
               filename                  =  lv_fullpath
               FILETYPE                  = 'BIN'
       APPEND                    = SPACE
       WRITE_FIELD_SEPARATOR     = SPACE
       HEADER                    = '00'
       TRUNC_TRAILING_BLANKS     = SPACE
       WRITE_LF                  = 'X'
       COL_SELECT                = SPACE
       COL_SELECT_MASK           = SPACE
       DAT_MODE                  = SPACE
       CONFIRM_OVERWRITE         = SPACE
       NO_AUTH_CHECK             = SPACE
       CODEPAGE                  = SPACE
       IGNORE_CERR               = ABAP_TRUE
       REPLACEMENT               = '#'
       WRITE_BOM                 = SPACE
       TRUNC_TRAILING_BLANKS_EOL = 'X'
    IMPORTING
       FILELENGTH                =
             changing
               data_tab                  =   gt_lines.
    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
       NOT_SUPPORTED_BY_GUI      = 22
       ERROR_NO_GUI              = 23
       others                    = 24
            IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*
            ENDIF.
          Else.
           IF sy-subrc NE 0.*
      error handling
              cf_retcode = sy-subrc.
              PERFORM protocol_update.
    get SmartForm protocoll and store it in the NAST protocoll
              PERFORM add_smfrm_prot.
            ENDIF.
          ENDDO.
          lwa_composer_param-tdcopies = nast_anzal.
          IF NOT nast_tdarmod IS INITIAL.
            nast-tdarmod = nast_tdarmod.
            CLEAR nast_tdarmod.
          ENDIF.
        ENDIF.
    get SmartForm protocoll and store it in the NAST protocoll
    PERFORM ADD_SMFRM_PROT.
      ENDFORM.                    "PROCESSING
    kindly give me a sloution.

    Hi,
    Check for the print mode in the print options and set it as 3- print and archive .
    Regards,
    Ram

  • Convert SmartForm into PDF(PDF should be password protected)

    Hi Friends,
                  This is my requirement.
    Need to convert SmartForm into PDF and this PDF should be send as an email with attachment and PDF should be password protected.
    Can anyone plz help me???

    Dear Jena,
                   This is my code.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'ZBIN_SMARTFORM'
        IMPORTING
          fm_name  = v_fm.
    *&   ASSIGNING VALUES TO FORM CONTROL STRUCTURE AND FORM COMPOSER
      gs_ctrlop-getotf = 'X'.
      gs_ctrlop-device = 'PRINTER'.
      gs_ctrlop-preview = ' '.
      gs_ctrlop-no_dialog = 'X'.
      gs_outopt-tddest = 'LOCL'.
    *                   GETTING THE OTF DATA
      CALL FUNCTION v_fm
        EXPORTING
    *     ARCHIVE_INDEX        =
    *     ARCHIVE_INDEX_TAB    =
    *     ARCHIVE_PARAMETERS   =
          control_parameters   = gs_ctrlop
    *     MAIL_APPL_OBJ        =
    *     MAIL_RECIPIENT       =
    *     MAIL_SENDER          =
          output_options       = gs_outopt
          user_settings        = ' '
          wa_lfa1              = wa_lfa1
          wa_t001              = wa_t001
          wa_ekko              = wa_ekko
          wa_adrc              = wa_adrc
        IMPORTING
    *     DOCUMENT_OUTPUT_INFO =
          job_output_info      = gs_otfdata
    *     JOB_OUTPUT_OPTIONS   =
        TABLES
          it_ekpo              = it_ekpo
        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.
    *        ASSIGNING THE OTFDATA TO OTF STRUCTURE TABLE
      CLEAR gt_otf.
      gt_otf[] = gs_otfdata-otfdata[].
    *                   CONVERTING THE OTFDATA
      CLEAR gt_lines.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
    *     ARCHIVE_INDEX         = ' '
    *     COPYNUMBER            = 0
    *     ASCII_BIDI_VIS2LOG    = ' '
    *     PDF_DELETE_OTFTAB     = ' '
    *     PDF_USERNAME          = ' '
    *     PDF_PREVIEW           = ' '
    *     USE_CASCADING         = ' '
        IMPORTING
          bin_filesize          = bin_file
    *     bin_file              = bin_file
        TABLES
          otf                   = gt_otf
          lines                 = gt_lines
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 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.
      DATA l_file TYPE string  .
      CONCATENATE  'D:\usr\sap\CID\DVEBMGS00\work' '.PDF' INTO l_file.
      OPEN DATASET l_file FOR OUTPUT IN BINARY MODE  .
      IF  sy-subrc = 0 .
        LOOP AT gt_lines INTO gs_lines .
          TRANSFER gs_lines TO l_file .
        ENDLOOP.
        CLOSE DATASET l_file .
      ELSE.
        WRITE : / 'operating system could not open file' .
      ENDIF.
    *      ASSIGNING THE DESCRIPTION OF THE OBJECT SENT IN MAIL
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
      gs_docdata-obj_descr = gc_testing.
      gs_docdata-obj_langu = sy-langu.
    *        ASSIGNING THE EMAIL-ID TO STRUCTURE OF API RECIPIENT LIST TABLE
      CLEAR : gt_reclist,gs_reclist.
    ***IF INTERNAL MAIL-ID
    *  gs_reclist-receiver = sy-uname.
    *  gs_reclist-rec_type = 'B'.
    ***IF EXTERNAL MAIL-ID
      gs_reclist-receiver = '[email protected]'.
      gs_reclist-rec_type = 'U'.
      APPEND gs_reclist TO gt_reclist.
    *     PASSING THE SAP SCRIPT LINES TO SAP OFFICE
      CLEAR : gs_objbin,gs_lines.
      LOOP AT gt_lines INTO gs_lines.
        gv_pos = 255 - gv_len.
        IF gv_pos > 134.
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_lines(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255.
          APPEND gs_objbin TO gt_objbin.
          CLEAR : gs_objbin,gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_lines+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin.
      ENDIF.
    *           FILLING THE DETAILS IN SAP OFFICE
      DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + strlen( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'TEST'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
      DATA: BEGIN OF command_list OCCURS 0.
              INCLUDE STRUCTURE sxpgcolist.
      DATA: END OF command_list .
      DATA: BEGIN OF exec_protocol OCCURS 0.
              INCLUDE STRUCTURE btcxpm.
      DATA: END OF exec_protocol.
      DATA: status LIKE btcxp3-exitstat,
       commandname LIKE sxpgcolist-name VALUE 'ZB_TEST',
        sel_no LIKE sy-tabix.
    * GET LIST OF EXTERNAL COMMANDS
      CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
        EXPORTING
          commandname     = commandname
          operatingsystem = sy-opsys
        TABLES
          command_list    = command_list
        EXCEPTIONS
          OTHERS          = 1.
      CALL FUNCTION 'SXPG_COMMAND_CHECK'
        EXPORTING
          commandname                = command_list-name
          operatingsystem            = sy-opsys
        EXCEPTIONS
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          x_error                    = 6
          too_many_parameters        = 7
          parameter_expected         = 8
          illegal_command            = 9
          communication_failure      = 10
          system_failure             = 11
          OTHERS                     = 12.
      CLEAR command_list.
      REFRESH command_list.
      DATA: v_dir_input      TYPE sxpgcolist-parameters.
      DATA: v_dir_input1      TYPE sxpgcolist-parameters.
      command_list-name = 'ZB_TEST'.
      command_list-opsystem = 'Windows NT'.
      DATA : doc  TYPE string.
      DATA : pass TYPE string ,
            name(40).
      doc = 'invoice'.
      pass = '123456'.
      CONCATENATE   'cnd/c d:\pdf\encryptpdf.exe' doc'.PDF' INTO name.
      CONCATENATE 'cmd /c d:\pdf\encryptpdf.exe' '-i'  name  '-o ' name  '-u'  pass INTO v_dir_input SEPARATED BY space .
      READ TABLE command_list INDEX sel_no.
      CONCATENATE command_list-opcommand v_dir_input INTO command_list-opcommand SEPARATED BY space.
    * CHECK AUTHORIZATION
      command_list-addpar = 'X'.
      APPEND command_list.
      CONSTANTS: c_extcom    TYPE sxpgcolist-name VALUE 'ZB_TEST',
       c_oper      TYPE syopsys VALUE 'Windows NT'.
      DATA: t_result         TYPE STANDARD TABLE OF btcxpm.
      v_dir_input  =  command_list-opcommand.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = c_extcom
          additional_parameters         = v_dir_input
          operatingsystem               = c_oper
        TABLES
          exec_protocol                 = t_result
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
      OPEN DATASET l_file FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
        READ DATASET l_file INTO itab_attach.
        CLOSE DATASET l_file.
      ENDIF.
      CALL METHOD cl_bcs_convert=>xstring_to_solix
        EXPORTING
          iv_xstring = itab_attach
        RECEIVING
          et_solix   = t_attachment.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = gs_docdata
       PUT_IN_OUTBOX                    = 'X'
       COMMIT_WORK                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
        TABLES
          packing_list                     = gt_objpack
    *   OBJECT_HEADER                    =
       CONTENTS_BIN                     = gt_objbin
    *   CONTENTS_TXT                     =
       CONTENTS_HEX                     = t_attachment
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          receivers                        = gt_reclist
    * EXCEPTIONS
    *   TOO_MANY_RECEIVERS               = 1
    *   DOCUMENT_NOT_SENT                = 2
    *   DOCUMENT_TYPE_NOT_EXIST          = 3
    *   OPERATION_NO_AUTHORIZATION       = 4
    *   PARAMETER_ERROR                  = 5
    *   X_ERROR                          = 6
    *   ENQUEUE_ERROR                    = 7
    *   OTHERS                           = 8
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
        WRITE 'SENT SUCCESSFULLY'.
      ENDIF.
      SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.
    The mail is sent to inbox successfully,but when am opening the attachment am getting the below error as,
    ---> There was an error while opening this file.The file is damaged and couldnt be repaired.

  • Converting Smartform into pdf in encrypted format

    Hi All,
    I have a requirement to download smartform into pdf format. I have done this,but this pdf is editable with pdf editor tool.
    is there any way to encrypt pdf data and downloading it? I find some FM's in forum but those are used to encrypt and decrypt the passwords etc....
    Thanks in advance..
    Anji

    Hi
    SMART form to PDF
    https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertSmartformtoPDFformat
    smartform to MAIL
    https://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment

  • Smartform into PDF and store in folder of  application server

    Hi Gurus,
         I have to solve this issue please help meu2026
    1.Convert Smartform into PDF and store in folder of  application server
    2.print the PDF stored in folder(Application Server) automatically
    Please give suggestion for the above..
    Moderator message: "spec dumping", please work yourself first on your requirement.
    Edited by: Thomas Zloch on Oct 7, 2011 10:39 AM

    hi uma,
    http://www.kodyaz.com/articles/sap-smartforms-download-as-smartform-pdf-using-ws_download-and-cl_gui_frontend_services.aspx
    check this out...
    thanks,
    ram

  • Want to create a function module  which will convert smartform into PDF .

    Hi All ,
    Requirement : I want to create a function module/report  which will convert smartform into PDF .
    Thanks in advance

    Hi All ,
    zsuresh_test : for converting smartform into pdf.
    when I am excuting this report(zsuresh_test) and by passing the smartform name FOPCR_STANDARD_F1
    I am getting error :
    Incorrect parameter with CALL FUNCTION
    Can you  please help me out..
    REPORT zsuresh_test.
    Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'FOPCR_STANDARD_F1',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
    " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    JOB_OUTPUT_OPTIONS =
    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.
    t_otf[] = t_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 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.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    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.

  • CONVERTING SMARTFORM INTO PDF AND PRINTING DIRECTLY

    Hai guys,
       I got a problem.
    First the Smartform I created doesnt show all TABLE LINES(the rows coloumns)...
    so I have converted the SMART FORM to ADOBE FORM PROGRAMITICALY ...
    now in order to PRINT ..
    one has to first SAVE the FORM(adobe form) onto desktop(or whereever) and give it to PRINT...
    unfortunately my CLIENT doeasnt like the EXTRA STEP..
    so i best i can SAVE the file to a hardcoded location and
    OPEN it ..
    But then CAN I
    a)PRINT DIRECTLY without SAVING??
    b)ISSUE PRINT PROGRAMITICALY
    c)I learnt that a SMARTFORM can be GENERATED INTO PDF only at RUNNTIME(from SMARTFORMS>UTILITIES etc)..i briefly tried that..can I use that to GET THE PDF to PRINT when one gives PRINT from SPOOL REQUEST(sp01)
    hoping to give some quick points

    Hi,
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    or
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Regards,
    Kumar

  • Converting Smartform into PDF preview layout

    Hi ABAP experts,
    We have converted an existing invoice layout smart form into PDF layout in print preview mode. However, we have an issue with PDF layout alignment. Earlier, it used to print the documents correctly (layout is aligned properly at the middle of the page). But when use this 'PDF' preview layout (triggered from smart form) the layout is left aligned/ larger right margin (but not at the middle).
    We have gone through the existing forum links on this PDF layout generating from smart form. But no luck on this left alignment issue. Do we need to modify the OTF data that is being populated in the layout. Can it be modifed with the position of the layout dynamically. Please advise.
    Technical team has used "CONVERT_OTF_2_PDF" to populate the OTF data.
    In SAP note # 323736 (issued in 2006), the below limitation was mentioned. But do we have any way to resolve this page alignment issue.
    Page size for SAPscript/SmartForms: PDF conversion uses the page format from the form definition as page size for the PDF document. If this has been defined larger than the page size that is actually used (for example for INCH12, INCH11 and so on), a reduced document or a larger right margin are the
    result when you view/print in Acrobat Reader.
    Thanks in advance.
    Regards,
    Satya

    Hi Satya,
    'We tried that option of "PDF!" but it didn't work for this smart form. Do we need to include/activate any option for this in the smart form.'..What do you mean by it didn't work for this smartform.?
    Execute your smartform and when you are in the print preview mode of the form means you get the output, then type PDF! in the command and hit ENTER.  A popup will get displayed if you are using windows 7
    or Allow and decline type of radiobutton option will be displayed if you are using Windows XP. So just click Allow and your smartform output will be displayed in pdf. Now you can save the pdf output file while clicking the save option in PDF. Your smartform output will be aligned properly in the PDF.
    You don't need any activation or any FM for converting the output in pdf for this.
    Basically, we do this to attach the smartform output in test plan.
    NOTE: This is for only to get the output in PDF while you are in Print preview of the form.
    Regards
    Syed

  • How to convert smartform into pdf and send through mail

    Hi Guru,
    I want to send smartform to mail after converting into pdf format.
    if anyof u gives solution its greate.
    Thanks & Regards,
    Lakshmi..

    Hi,
    i can help you till
    downloading the smartform as pdf format
    check this
    DATA: GIT_BSIK LIKE BSIK OCCURS 0 WITH HEADER LINE.
    Variable declarations
    DATA:
    W_FORM_NAME TYPE TDSFNAME VALUE 'ZFII_EDD001',
    W_FMODULE TYPE RS38L_FNAM,
    W_CPARAM TYPE SSFCTRLOP,
    W_OUTOPTIONS TYPE SSFCOMPOP,
    W_BIN_FILESIZE TYPE I, " Binary File Size
    W_FILE_NAME TYPE STRING,
    W_FILE_PATH TYPE STRING,
    W_FULL_PATH TYPE STRING.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    T_OTF_FROM_FM TYPE SSFCRESCL,
    Internal table to hold the data from the FM CONVERT_OTF
    T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
        FORMNAME = W_FORM_NAME
        VARIANT = ' '
        DIRECT_CALL = ' '
        IMPORTING
        FM_NAME = W_FMODULE
        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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    W_CPARAM-NO_DIALOG = 'X'.
    W_CPARAM-PREVIEW = SPACE. " Suppressing the dialog box
    " for print preview
    W_CPARAM-GETOTF = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    W_OUTOPTIONS-TDDEST = 'ZPC_'.
          CALL FUNCTION W_FMODULE
          EXPORTING
          ARCHIVE_INDEX =
          ARCHIVE_INDEX_TAB =
          ARCHIVE_PARAMETERS =
          CONTROL_PARAMETERS = W_CPARAM
          MAIL_APPL_OBJ =
          MAIL_RECIPIENT =
          MAIL_SENDER =
          OUTPUT_OPTIONS = W_OUTOPTIONS
          USER_SETTINGS = 'X'
          IMPORTING
          DOCUMENT_OUTPUT_INFO =
          JOB_OUTPUT_INFO = T_OTF_FROM_FM
          JOB_OUTPUT_OPTIONS =
               TABLES
                ITAB                       = GIT_BSIK
          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.
    T_OTF[] = T_OTF_FROM_FM-OTFDATA[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
          CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
          FORMAT = 'PDF'
          MAX_LINEWIDTH = 132
          ARCHIVE_INDEX = ' '
          COPYNUMBER = 0
          ASCII_BIDI_VIS2LOG = ' '
          PDF_DELETE_OTFTAB = ' '
          IMPORTING
          BIN_FILESIZE = W_BIN_FILESIZE
          BIN_FILE =
          TABLES
          OTF = T_OTF
          LINES = T_PDF_TAB
          EXCEPTIONS
          ERR_MAX_LINEWIDTH = 1
          ERR_FORMAT = 2
          ERR_CONV_NOT_POSSIBLE = 3
          ERR_BAD_OTF = 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.
    *To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    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.
    thanks & regards,
    Venkatesh

  • Problem With Converting PO Smartform into PDF

    Hi All,
    I am trying to email the Smartform PO. I developed the program after reading several discuusions and blogs in forum. The PO is successfully created in PDF format and stored in the local directory. When i tried to view the pdf the PO is creatd twice in the PDF. I mean the original pdf is of 3 pages with PO and terms and conditons. But in the pdf which was created it has 6 pages. I am unable to understand why it has 2 copies of same PO.
    When i tried to email the pdf as attachement the email is delivered successfully. But when i tried to view the pdf its given an error that "the file is corrupted (For example the attachemnt is not coded properly)or the fle type is not supported. Even in the attachment also i have the two files one is of pdf another is also of the .pdf but the image is showing as Unknown file format.
    Any suggestions to resolve these issues.
    Thanks

    My code is as follows:
    FORM print_form .
    *Calling FM to retrieve the function module associated with the Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZMMS_MEDRUCK_LS'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = v_form_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.
    ENDIF.
    control_parameters-langu = sy-langu.
      control_parameters-no_dialog = 'X'.
      control_parameters-getotf    = 'X'.
    Excuting the FM associated with the SmartForm by input required internal tables
    CALL FUNCTION v_form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = control_parameters
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = output_options
      USER_SETTINGS              = 'X'
        IS_NAST                    = it_nast
        IS_PEKKO                   = it_pekko
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = output_data
       JOB_OUTPUT_OPTIONS         =
      TABLES
        IT_EKPO                    = it_ekpo
        IT_EKET                    = it_eket
        IS_EKKO                    = it_ekko
        IT_DRAW                    = it_draw
        IT_BUYER                   = it_buyer
    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.
    tab_otf_final[] = output_data-otfdata[].
    **removing the initial and final markers from the OTF data*********
    DELETE output_data-otfdata WHERE tdprintcom = '//'.
    searching for the end-of-page in OTF table************
    DATA : my_tabix TYPE sy-tabix.
    READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP'.
    my_tabix = sy-tabix + 1.
    appending the modified OTF table to the final OTF table****
    INSERT LINES OF output_data-otfdata INTO tab_otf_final INDEX my_tabix.
      CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
          FORMAT                      = 'PDF'
        MAX_LINEWIDTH               = 132
        ARCHIVE_INDEX               = ' '
        COPYNUMBER                  = 0
        ASCII_BIDI_VIS2LOG          = ' '
        PDF_DELETE_OTFTAB           = ' '
    IMPORTING
          bin_filesize                = bin_filesize
        TABLES
          OTF                         = tab_otf_final
          LINES                       = lt_lines
      EXCEPTIONS
        ERR_MAX_LINEWIDTH           = 1
        ERR_FORMAT                  = 2
        ERR_CONV_NOT_POSSIBLE       = 3
        ERR_BAD_OTF                 = 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.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE                    = bin_filesize
        FILENAME                        = 'D:TEST.PDF'
        FILETYPE                        = 'BIN'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_EOL                       = ABAP_TRUE
    IMPORTING
        FILELENGTH                      = file_size
      TABLES
        DATA_TAB                        = lt_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.
    loop at LT_LINES INTO wa_lines.
    translate wa_LINES using '~'.
    concatenate WA_BUFFER wa_LINES into WA_BUFFER.
    endloop.
    translate WA_BUFFER using '~'.
    do.
    I_RECORD = WA_BUFFER.
    append I_RECORD.
    shift WA_BUFFER left by 255 places.
    if WA_BUFFER is initial.
    exit.
    endif.
    enddo.
    Attachment
    refresh:
    I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    clear WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    APPEND I_RECORD.
    Create Message Body Title and Description****************
    I_OBJTXT = 'test with pdf-Attachment!'.
    append I_OBJTXT.
    describe table I_OBJTXT lines V_LINES_TXT.
    read table I_OBJTXT index V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text*****************************
    clear I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    append I_OBJPACK.
    Attachment (pdf-Attachment)*************
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 1.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smartform'.
    concatenate I_OBJPACK-OBJ_NAME I_OBJPACK-DOC_TYPE into I_OBJPACK-OBJ_DESCR separated by '.'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    append I_OBJPACK.
    Länge des Attachment ermitteln
    clear I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    I_RECLIST-EXPRESS = 'X'.
    data: TAB_LINES like SY-TABIX.
    describe table I_OBJBIN lines TAB_LINES.
    append I_RECLIST.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    exporting
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    tables
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_RECLIST
    exceptions
    TOO_MANY_RECEIVERS = 1
    DOCUMENT_NOT_SENT = 2
    DOCUMENT_TYPE_NOT_EXIST = 3
    OPERATION_NO_AUTHORIZATION = 4
    PARAMETER_ERROR = 5
    X_ERROR = 6
    ENQUEUE_ERROR = 7
    others = 8.
    if SY-SUBRC <> 0.
    write:/ 'Error When Sending the File', SY-SUBRC.
    else.
    write:/ 'Mail sent'.
    endif.
    ENDFORM.                    " print_form

  • Script error message when printing google maps driving direction into PDF

    My system; Win 7/ 64bits/IE 9 both 32 and 64 bits/Adobe Acrobats 10.1.1. Pro
    Intial problems in printing web sites into PDF files has been resolved when I upgraded into 10.0.1 after having installed IE9.
    However, with 10.1.1. version, I noticed that when I tried to convert google maps results for a driving direction (From A to B), script error message showed up and I could not convert it into PDF. I tried both IE 9 32bits and 64 bits version, but both failed to do it. Please fix the problem for the next updates.
    Thanks

    You might try running CHKDSK on the disk to where you try to save the file. You might have a corrupted file directory or a damaged track on that disk. I urge you to backup what you can before trying this.
    Ken F.

  • Convert SMARTFORM to pdf in rawstring format?

    Hi,
    I have requirement where i need to convert SMARTFORM into pdf in rawstring format. I am able to convert into pdf but in TLINE structure format using CONVERT_OTF function module.
    Is there a way to convert TLINE structure format to rawstring format or maybe a function module which directly converts SMARTFORMS into pdf in rawstringformat.
    I know the output direclty from Adobe lif cycle manager (t-code: sfp) is in type fpformoutput structure which has a field called pdf which is of type rawstring.
    The reason i need pdf in rawstring is that i need to transport the pdf into another system and it requires rawstring as input parameter.
    Any help or suggestion will be appreciated.
    Thanks

    Hi,
       Hope this code may helpful to resolve your probelm.
    DATA:
    w_form_name TYPE tdsfname VALUE 'ZSURESH_TEST',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    JOB_OUTPUT_OPTIONS =
    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.
    t_otf[] = t_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 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.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    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.
    Thanks,
    Phani Diwakar.

  • Content Not Coming Properly after converting a Smartform to PDF.

    I am converting a smartform into PDF format using CONVERT_OTF .
    This smart form will be triggered from the portal at the occurance of an event .After Conversion some texts are properly outputted in the PDF but some texts which are in  arabic are not coming properly ( shows some junk data in a language other than Arabic).
    Can any give a Solution ??
    Thanks
    Chaitanya Sharma
    Edited by: chaitanya  sharma on Jan 28, 2009 2:15 PM

    hi
    try using this fm CONVERT_OTF_2_PDF
    hope this helps
    regards
    Aakash Banga

  • Problem with Euro sign when converting it into PDF Format

    Hi all,
    i am facing problem with Euro (u20AC) sign,
    it is displayina s #
    when converting one smartform into PDF format.
    Can any body sugest me in doing this??
    it is appriciable if any body can help m??
    thanks in advance
    Regards,
    Srikanth.

    Hi Srikanth,
    I think I'm facing the same issue as you. I looked at the note 323736 but my system seems to be up to date (at least for this issue). I have SAP_BASIS release 700.
    Did you upgrade your system ? Did you do something else ?
    Thanks for your help.
    Best regards,
    Pierre

  • Convert Smartform to PDF

    Hi All
    I am getting a blank screen when i am trying to convert a smartform into PDF. Following are the steps i am using:
    1 ) I have created a FM which gives me data in OTF format.
    2) Then i called  'SSFCOMP_PDF_PREVIEW' FM.
    3) Finally i called 'CONVERT_OTF' FM
    CALL FUNCTION 'CO*NVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
    IMPORTING
       BIN_FILESIZE                = p_bin_filesize ( i )
       BIN_FILE                    = p_bin_file ( xstring )
    TABLES
        otf                         = p_job_output_info ( SSFCRESCL-otfdata )
        lines                       = p_lines ( tline )
    While debugging i checked that p_lines values was coming as '0' , rest values are coming fine.
    4) I binded p_bin_file to a context of type xstring and binded this context to Interactive Form UI.
    Please tell me if i missed something.
    Regards,
    Puneet

    Hi
    you may use the FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' to convert the fom
    into PDF.
    But first to get the printed form from the spool, use FUNCTION
    'RSPO_FIND_SPOOL_REQUESTS'.
    Then you may send it to your PC, email, fax, etc by reading the record in
    the lines of table IT_PDF_OUTPUT.
    Note: You may also use program RSTXPDFT4 as a reference to get code
    examples which uses different functions to perform the creation of PDFand
    download the form to the PC,etc.
    An example:
    CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
    EXPORTING
    RQOWNER = SY-UNAME
    TABLES
    SPOOLREQUESTS = SPOOL_REQUESTS.
    READ TABLE SPOOL_REQUESTS INDEX 1.
    GD_SPOOL_NR = SPOOL_REQUESTS-RQIDENT.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    SRC_SPOOLID = GD_SPOOL_NR
    NO_DIALOG = C_NO
    IMPORTING
    PDF_BYTECOUNT = GD_BYTECOUNT
    PDF_SPOOLID = PDFSPOOLID
    BTC_JOBNAME = JOBNAME
    BTC_JOBCOUNT = JOBCOUNT
    TABLES
    PDF = IT_PDF_OUTPUT
    EXCEPTIONS
    ERR_NO_OTF_SPOOLJOB = 1
    ERR_NO_SPOOLJOB = 2
    ERR_NO_PERMISSION = 3
    ERR_CONV_NOT_POSSIBLE = 4
    ERR_BAD_DSTDEVICE = 5
    USER_CANCELLED = 6
    ERR_SPOOLERROR = 7
    ERR_TEMSEERROR = 8
    ERR_BTCJOB_OPEN_FAILED = 9
    ERR_BTCJOB_SUBMIT_FAILED = 10
    ERR_BTCJOB_CLOSE_FAILED = 11.
    CHECK SY-SUBRC = 0.
    Hope this will help send you in the right direction.
    or you may use this link it might solve your query
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785
    Edited by: anand prakash rai on Oct 23, 2008 11:55 AM

Maybe you are looking for

  • Don't function applet

    Hello, I have problem, this applet shows error. How to fix it? I need this applet for school project. Thank you. [http://www.uvm.edu/~mfuris/INTRO_PHYSLETS/contents/optics/refraction/prob34_2.html]

  • Security: Adobe Standard X can sign, Adobe Reader 9 Cannot

    Hi all, I need some help with an issue I'm having. I have a PDF document that when viewed internally using Adobe Acrobat Pro X, the document security is displaying that everything is allowed (including signing). When I then email the same document ou

  • Error message 403 when connecting to live stream

    message 403 says that I don't have access. how do i get access?

  • Duplicate emails

    Since I upgraded to Snow Leopard some emails have been coming into my inbox in duplicate.  Can you help me?

  • PHOTOBOOTH ISN'T WORKING.. I know the reason but can't find a solution

    So yesterday I was going through my mac deleting what I thought was unneccessary files which was obviously not a smat decision since I know nothing about computers. I went to my Macintosh HD-> Library-> Compositions and I saw a few videos about fish