SMARTFORM to PDF generation

Hi Experts,
I have some problems in generating my SMARTFORMS in PDF in Ukranian Language. Some of the characters are overlapping when it is generated in PDF but when you print and preview it in SMARTFORM it is not encountering the said problem.
What i tried is putting a space between those overlapping characters in language translation SE63 and it did resolve the problem in PDF, however in SMARTFORMS that additional spaces between characters are also being displayed. And that is for text elements only. However for thos data that to be retrieved in Ukrainian Language (cyrillic characters), it still overlapping.
I still dont know the reason why when you put additional space in the SE63 langauge translation, it fixes the overlapping issue, but this is not a good solution since some of data that have been retrieved is also in cyrillic and its still overlapping.
May I have your opinion about this. Thanks for the wonderful ideas.

This problem could be caused by the character sets installed for Adobe. Please ensure that you have the correct character sets installed in order for Adobe to recognize the Ukranian characters.

Similar Messages

  • Error while saving a smartform in pdf with action profile in service order

    Hi experts,
    I have a problem in saving a smartform which is converted in pdf.
    WHat i m doing is.
    The action profile is configured with new Z class and Z method. CL_DOC_PROCESSING_CRM_ORDER and CRM_SRVORDER_EXEC_SMART_FORM.
    But when i click the button in the Order, i m able to save the pdf in local drive, but an error is coming in the Order page(at the bottom) "Action could not be executed successfully".
    The action has been setup with "Printonly" and "Smartforms print" in customization.
    I have a dount whether, this action Printonly is only to print the smartform ??? Or can we use just to save the smartform in pdf.
    But when i remove the pdf conversion and save dialog and try to print it directly, Its printing the smartform. No errors are coming.
    But guys, please help me on this. I have tried all the tricks i know.
    I just want to save a smartform in pdf with action profile configured.
    Thanks in advance.
    <REMOVED BY MODERATOR>
    KK
    Edited by: Alvaro Tejada Galindo on Mar 19, 2008 4:26 PM

    Hi;
    Did you checked
    Queries Error With FRM-92101 In Many NLS Forms [ID 443922.1] << seems similar error like yours
    Forms FRM-92050, FRM-92100, FRM-92101, FRM-92102 Reference Guide [ID 444690.1]
    If its not help please enable trace
    How To Perform System Tracing For All Forms Runtime Processes? [ID 400144.1]
    Regard
    Helios

  • Convert Smartform to PDF and send to SAP Workplace user

    Hi to all.
    I need help of somebody expert in SMARTFORM's.
    I need to convert a smartform into PDF format and to send as attachement for SAP workplace
    of the user.
    I developed the next code.
    IT is to function and to send the mail for SAP workplace, but it happens that smartform
    contains images (logos) and tables, when the user tries to open the file pdf in inbox gives
    to error - "An unrecognized token ' q0 ' was found".
    I tried to call a smartform only with text and functioned well.
    Somebody can help me?
    My code:
    Begin ***********************************************
    REPORT zteste_nsa_send_pdf_sap_office.
    DATA: t_print LIKE zeps_fm04 OCCURS 0 WITH HEADER LINE,
    v_size TYPE i.
    DATA: ls_bil_invoice TYPE lbbil_invoice.
    TABLES: nast.
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    i_tline TYPE TABLE OF tline WITH HEADER LINE,
    i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
    i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    wa_objhead TYPE soli_tab,
    w_ctrlop TYPE ssfctrlop,
    w_compop TYPE ssfcompop,
    w_return TYPE ssfcrescl,
    wa_doc_chng TYPE sodocchgi1,
    w_data TYPE sodocchgi1,
    wa_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
    v_form_name TYPE rs38l_fnam,
    v_len_in LIKE sood-objlen,
    v_len_out LIKE sood-objlen,
    v_len_outn TYPE i,
    v_lines_txt TYPE i,
    v_lines_bin TYPE i.
    START-OF-SELECTION.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZFPS_FICHA_VALORIZACAO'
    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.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
    EXPORTING
    control_parameters = w_ctrlop
    output_options = w_compop
    user_settings = 'X'
    is_bil_invoice = ls_bil_invoice
    is_nast = nast
    is_repeat = 'X'
    IMPORTING
    job_output_info = w_return
    TABLES
    t_list = t_print
    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.
    i_otf[] = w_return-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = 132
    bin_filesize = v_len_in
    TABLES
    otf = i_otf
    lines = i_tline
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    OTHERS = 4.
    IF sy-subrc EQ 0.
    ENDIF.
    Convert PDF from 132 to 255.
    LOOP AT i_tline.
    TRANSLATE i_tline USING '~'.
    CONCATENATE wa_buffer i_tline 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.
    SEND MAIL
    REFRESH: i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    CLEAR wa_objhead.
    Object with PDF.
    i_objbin[] = i_record[].
    Object with main text of the mail.
    i_objtxt = 'Fichas de Valorização e Esquemas Tipo'.
    APPEND i_objtxt.
    Document information.
    wa_doc_chng-obj_name = 'SMART'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = 'Ficha de Valorização'.
    wa_doc_chng-sensitivty = 'F'. "Functional object
    wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    Pack to main body as RAW.
    Obj. to be transported not in binary form
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    READ TABLE i_objtxt INDEX v_lines_txt.
    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 = 'RAW'.
    APPEND i_objpack.
    Packing as PDF.
    Obj. to be transported in binary form
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
    READ TABLE i_objbin INDEX v_lines_bin.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'SMART'.
    CONCATENATE 'Ficha_Valorizacao' '.pdf' INTO i_objpack-obj_descr.
    i_objpack-doc_size = ( v_lines_bin - 1 ) * 255 + STRLEN( i_objbin ).
    APPEND i_objpack.
    e-mail receivers.
    CLEAR i_reclist.
    i_reclist-receiver = sy-uname.
    i_reclist-rec_type = 'B'.
    i_reclist-express = 'X'.
    APPEND i_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = wa_doc_chng
    put_in_outbox = 'X'
    commit_work = ' '
    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 EQ 0.
    ENDIF.
    End *************************************************
    Thanks very much to all and Happy New year...
    Nelson

    Hi
    See this report as example:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    I believe before converting the print to pdf, you should print your document, get the spool and convert it.
    Max

  • In R/3 display smartform as pdf in a custom container

    Hello,
    I want to display smartform as pdf in a custom contianer . I was able to find all the right code from sdn.
    but my problem is that when executed my sap gui is closed without any error.
    I am unable to understand what is going wrong.
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).  does not show the pdf.
    Can any one help me to find out if we need to do some setting for MIME type application/pdf. Because I tried to display a bar chart in the custom container of MIME type text/html , and this is working fine.
    Is any setting missing in our R/3 because of which the code is not getting executed.
    below code is the exact copy from a post in sdn:
    report ztest_pdf.
    DATA: LT_PDF TYPE TABLE OF TLINE,
          LS_PDF LIKE LINE OF LT_PDF,
          LV_URL TYPE CHAR255,
          PDF_FSIZE TYPE  I,
          LV_CONTENT  TYPE XSTRING,
          LT_DATA TYPE STANDARD TABLE OF X255.
    DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
    DATA : LS_CONTROL_PARAM  TYPE SSFCTRLOP.
    DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           G_HTML_CONTROL   TYPE REF TO CL_GUI_HTML_VIEWER.
    *      pdf_control type ref to cl_gui_pdfviewer.
    DATA : P_VBELN TYPE  VBELN_VL.
    DATA : i_html TYPE w3htmltabtype.
    ",       g_url  TYPE w3url
    FIELD-SYMBOLS <FS_X> TYPE X.
    INITIALIZATION.
    LS_CONTROL_PARAM-GETOTF = 'X'.
    LS_CONTROL_PARAM-NO_DIALOG = 'X'.
    START-OF-SELECTION.
      CALL FUNCTION '/1BCDWB/SF00000298'
    EXPORTING
    *    ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = LS_CONTROL_PARAM
    *     P_VBELN                    = P_VBELN
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             =
    *   USER_SETTINGS              = 'X'
    IMPORTING
    *      DOCUMENT_OUTPUT_INFO  = L_DOCUMENT_OUTPUT_INFO
           JOB_OUTPUT_INFO       = L_JOB_OUTPUT_INFO
    *      JOB_OUTPUT_OPTIONS    = L_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.
    data pdfxstring type xstring.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
          bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL SCREEN 100.
    module STATUS_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
      CREATE OBJECT G_HTML_CONTAINER
        EXPORTING
          CONTAINER_NAME = 'PDF'.
    CREATE OBJECT G_HTML_CONTROL
        EXPORTING
          PARENT = G_HTML_CONTAINER.
    * Convert xstring to binary table to pass to the LOAD_DATA method
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = pdfxstring"LV_CONTENT
        TABLES
          BINARY_TAB = LT_DATA.
    * PERFORM bar_chart .
    * Load the HTML
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    * Show it
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).
    Thanks,
    Jaya.
    Edited by: kishan P on Jun 9, 2011 1:40 PM

    Hello Sandra,
    Thanks for your reply, but eventhen it fails to load the pdf. Is ADS required to be installed for this?
    Can I just pass the pdf_fsize imported from  CONVERT_OTF which is of type i.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE    
    bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
           size           = PDF_FSIZE
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    Thanks,
    Jaya.

  • Error in SmartForm to PDF while Saving with Preview option.

    Hi,
    I have created a report to convert Smartform to PDF.
    I want the user to Preview data, if user is interested, then they can save the file.
    When user clicks the Back button in SmartForm Print Preview, user can select the path of PDF file to save the data.
    My code works fine, if Preview is disabled.
    In the sub-routine createpdffile, I am getting error while creating PDF file.
    The program works fine, if I disable the preview option i.e. if I uncomment
    cparam-getotf = 'X'.
    How can I have the both options in my report?
    1)     Preview SmartForm.
    2)     Save the SmartForm as PDF.
    Regards,
    Vikas
    DATA:
      cparam TYPE ssfctrlop,
      outop TYPE ssfcompop,
    *  fm_name TYPE rs38l_fnam,
    *  my_tabix TYPE sy-tabix,
      file_size TYPE i,
      bin_filesize TYPE i,
      s_filename TYPE string.
    DATA:
      tab_otf_data TYPE ssfcrescl,
    *  tab_otf_data TYPE itcoo OCCURS 0 WITH HEADER LINE,
      pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
      tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
      it_ekpo TYPE STANDARD TABLE OF ekpo WITH HEADER LINE.
    *  it_docs  TYPE STANDARD TABLE OF docs.
    START-OF-SELECTION.
      PERFORM fetchdata.
    ***************** suppressing the dialog box****************************
      outop-tddest = 'LP01'.
      cparam-no_dialog = 'X'.
      cparam-preview = 'X'.
    *  cparam-getotf = 'X'.
    END-OF-SELECTION.
      PERFORM callsmartform.
      tab_otf_final[] = tab_otf_data-otfdata[].
      PERFORM createpdffile.
      PERFORM getfilename.
      PERFORM savepdffile.
    *&      Form  FetchData
    FORM fetchdata .
      SELECT * FROM ekpo INTO CORRESPONDING FIELDS OF TABLE it_ekpo
      WHERE ebeln >  '4500009071' AND ebeln  < '4500009073' .
    ENDFORM.                    " FetchData
    *&      Form  CallSmartForm
    FORM callsmartform .
      CALL FUNCTION '/1BCDWB/SF00000234'
      EXPORTING
      control_parameters         =  cparam
        output_options             = outop
        user_settings              = space
      IMPORTING
        job_output_info            = tab_otf_data
      TABLES
           t_ekpo                     = it_ekpo
    * EXCEPTIONS
      IF sy-subrc <> 0.
        MESSAGE  'Error in Calling Smart Form ' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " CallSmartForm
    *&      Form  CreatePDFFile
    *       text
    FORM createpdffile .
    ****removing the initial and final markers from the OTF data**********
    *  DELETE tab_otf_data-otfdata WHERE tdprintcom = '//'.
    *  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 tab_otf_data-otfdata INTO tab_otf_final INDEX my_tabix
    ************ converting OTF data into pdf data**************************
      CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
      format = 'PDF'
      max_linewidth = 132
      IMPORTING
      bin_filesize = bin_filesize
    * BIN_FILE =
      TABLES
      otf = tab_otf_final
      lines = pdf_tab
      EXCEPTIONS
      OTHERS = 5
      IF sy-subrc <> 0.
        MESSAGE  'Error in Creating PDF File ' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " CreatePDFFile
    *&      Form  SavePDFFile
    FORM savepdffile .
      CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      bin_filesize = bin_filesize
      filename = s_filename
      filetype = 'BIN'
      IMPORTING
      filelength = file_size
      TABLES
      data_tab = pdf_tab
      EXCEPTIONS
      OTHERS = 22
      IF sy-subrc <> 0.
        MESSAGE  'Error in Saving PDF File ' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " SavePDFFile
    *&      Form  GetFileName
    FORM getfilename .
      DATA:
        v_name                  TYPE string,
        v_path                  TYPE string,
        v_fullpath              TYPE string,
        v_filter                TYPE string,
        v_uact                  TYPE i,
        v_guiobj                TYPE REF TO cl_gui_frontend_services.
    *    v_filename              TYPE string.
      CONCATENATE 'smrt' '.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.
      MOVE v_fullpath TO s_filename.
    ENDFORM.                    " GetFileName

    I think the excerpt and link below is the why, but the page talks about server code and not javascript.  I guessing that this is why blank pages work, but not wiki pages.  Can anyone verify this?
    The following are general rules for using server-side code on a site page.
    If the page is uncustomized, server-side code is supported on the page.
    If the page is customized, server-side code does not run, and the page does not render. This includes the code-behind for the page itself.
    http://msdn.microsoft.com/en-us/library/office/aa979592(v=office.14).aspx

  • Send smartform as pdf attachment through Email on ECC 5.0

    I have been trying hard to do this, but am not able to send attachment. Below are the problems -
    1. If sometimes the mail goes, the attachment is empty.
    2. if i use COMMIT_WORK = 'X' in FM SO_NEW_DOCUMENT_ATT_SEND_API1 , it throws a dump - ' Invalid COMMIT WORK in an update function module.'
    3. If i comment COMMIT_WORK = 'X', it gets executed successfully but, in the program i get a dump 'UC_OBJECTS_NOT_CHAR' exception.
    Can someone suggest, what settings are required in SAP to send smartforms as PDF attachments. Also, please suggest how can i remove the dump. If anyone can give me a working program, it will be very very helpful.
    here is the code,
    REPORT  zrsmfmail.
    TYPE-POOLS: addi.
    Tables defination.
    TABLES : vbpa,vbak,nast, stxl, stxh.
    Data Decleration .
    DATA: lf_fm_name  TYPE rs38l_fnam,
          l_lines TYPE i.
    DATA: output_options TYPE ssfcompop.
    DATA: fcodem TYPE sy-ucomm.
    DATA: i_id LIKE thead-tdid VALUE 'V002',
          i_object LIKE thead-tdobject VALUE 'VBBK' ,
          i_tdname LIKE thead-tdname ,
          i_lang LIKE thead-tdspras VALUE 'E' .
    Internal Table declration.
    DATA: int_vbak LIKE vbak OCCURS 0 WITH HEADER LINE,
          int_vbap LIKE vbap OCCURS 0 WITH HEADER LINE.
    DATA : itline1 LIKE tline OCCURS 0 WITH HEADER LINE .
    DATA: retcode   LIKE sy-subrc.         "Returncode
    DATA: repeat(1) TYPE c.
    DATA: xscreen(1) TYPE c.               "Output on printer or screen
    Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    i_tline TYPE TABLE OF tline WITH HEADER LINE,
    i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
    i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    lt_att_content_hex LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    wa_objhead TYPE soli_tab,
    w_ctrlop TYPE ssfctrlop,
    w_compop TYPE ssfcompop,
    w_return TYPE ssfcrescl,
    wa_doc_chng TYPE sodocchgi1,
    w_data TYPE sodocchgi1,
    wa_buffer TYPE string,
    Variables declarations
    v_form_name TYPE rs38l_fnam,
    v_len_in LIKE sood-objlen,
    v_len_out LIKE sood-objlen,
    v_len_outn TYPE i,
    v_lines_txt TYPE i,
    v_lines_bin TYPE i.
    DATA: BEGIN OF zlines2 OCCURS 0,
    tline TYPE char255,
    END OF zlines2,
    size TYPE i,
    zdata TYPE sodocchgi1.
    *&      Form  entry
    FORM entry USING return_code TYPE i
                     us_screen TYPE c.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing.
      IF retcode NE 0.
        return_code = 1.
      ELSE.
        return_code = 0.
      ENDIF.
    ENDFORM.                    "ENTRY
    *&      Form  PROCESSING
          text
    FORM processing.
      SELECT *
      INTO   CORRESPONDING FIELDS OF TABLE int_vbak
      FROM   vbak
      WHERE  vbeln = nast-objky.
      LOOP AT int_vbak .
        i_tdname = int_vbak-vbeln .
        SELECT SINGLE * FROM stxh WHERE tdobject = i_object
                                    AND tdname = i_tdname
                                    AND tdid = i_id
                                    AND tdspras = i_lang.
        IF sy-subrc = 0 .
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              id       = i_id
              language = i_lang
              name     = i_tdname
              object   = i_object
            TABLES
              lines    = itline1.
          IF sy-subrc NE 0 .
            APPEND itline1 .
          ENDIF .
        ENDIF .
        DESCRIBE TABLE int_vbak LINES l_lines.
        l_lines = l_lines .
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = 'ZORDER_QUOTE'
          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.
        w_ctrlop-getotf = 'X'.
        w_ctrlop-no_dialog = 'X'.
        w_compop-tdnoprev = 'X'.
        CALL FUNCTION v_form_name
          EXPORTING
            l_lines            = l_lines
            control_parameters = w_ctrlop
            output_options     = w_compop
            user_settings      = 'X'
          IMPORTING
            job_output_info    = w_return
          TABLES
            int_vbak           = int_vbak
            int_vbap           = int_vbap
            itline1            = itline1
          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.
        i_otf[] = w_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = size
          TABLES
            otf                   = i_otf
            lines                 = i_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
    Fehlerhandling
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Change the PDF format from 132 to 255.
        CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
          EXPORTING
            transfer_bin = 'X'
          TABLES
            content_in   = i_tline
            content_out  = zlines2
          EXCEPTIONS
            err_line_width_src_too_long = 1
            err_line_width_dst_too_long = 2
            err_conv_failed = 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.
    Attachment
        REFRESH:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
        CLEAR wa_objhead.
        i_objtxt = 'TEST 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-no_change = 'X'.
        wa_doc_chng-obj_langu = sy-langu.
        wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
        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 = 'RAW'.
        APPEND i_objpack.
    (pdf-Attachment)
        i_objbin[] = zlines2[].
        i_objpack-transf_bin = 'X'.
        i_objpack-head_start = 1.
        i_objpack-head_num = 1.
        i_objpack-body_start = 1.
    Länge des Attachment ermitteln
        DESCRIBE TABLE i_objbin LINES v_lines_bin.
        READ TABLE i_objbin INDEX v_lines_bin.
        i_objpack-doc_size = v_lines_bin * 255 .
        i_objpack-body_num = v_lines_bin.
        i_objpack-doc_type = 'PDF'.
        i_objpack-obj_name = 'SMARTFORM'.
        i_objpack-obj_descr = 'TEST'.
        APPEND i_objpack.
        CLEAR i_reclist.
        i_reclist-receiver = 'abc at aa.com'.
        i_reclist-rec_type = 'F'.
        i_reclist-express = 'X'.
        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
          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.
        CASE sy-subrc.
          WHEN 0.
          WHEN 1. RAISE too_many_receivers.
          WHEN 2. RAISE document_not_sent .
          WHEN 3. RAISE document_type_not_exist.
          WHEN 4. RAISE operation_no_authorization.
          WHEN 5. RAISE parameter_error.
          WHEN 7. RAISE enqueue_error .
          WHEN OTHERS. RAISE x_error.
        ENDCASE.
    COMMIT WORK.
      ENDLOOP.
    ENDFORM.                    "entry
    Please suggest ASAP, it has come to a critical stage now, a fruitful help will be a great saviour.
    Thanks !

    Hi Guys,
    You can even try this 'CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
          IMPORTING
            bin_filesize          = bin_filesize
            bin_file              = xstring
          TABLES
            otf                   = it_otf_final
            lines                 = it_pdfdata[]
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            err_bad_otf           = 4
            OTHERS                = 5.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer                = xstring
          APPEND_TO_TABLE       = ' '
        IMPORTING
          OUTPUT_LENGTH         =
          TABLES
            binary_tab            = it_pdf
    Use Cl_BSC Class for easy way to send mail.
    Either u can Distribution list Tcode so23.
    This is the way i have implemted .. !

  • Problem during output of smartform in PDF

    Hi All,
    I am using Function module for output of smartform in PDF Format.But it is giving following informatio -OTF end command // missing in OTF data.
    and then no data in pdf format.
    Could you please help me whar shoul I do for that?
    MY code is like that :
    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.

    Search the error in the first call to smartforms. ([Function documentation Checking and Testing a Smart Form|http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/83fb5bdf8f11d3969700a0c930660b/frameset.htm])
    Regards,
    Raymond

  • Display Smartform in PDF.

    Hi All,
    I have gone through the forum threads to convert a smartform into a pdf document. All of them say to use function module CONVERT_OTF. This function module converts the output of the smartform which is in OTF into the PDF format and we can download the information which opens up with Adobe Reader.
    The question is whether we can display the output of the smartform in Adobe at runtime within the SAP GUI because if it is in the portal then we can set the attribute in SAP Connect, to display the output of SAP Script and Smartforms in PDF.
    I tried this code
    REPORT  ZACOSTA_FETCH_DATA_COPY.
    DATA : IT_ZACOSTA TYPE  ZACOSTA_TAB_DET.
    DATA : V_FORM_NAME TYPE TDSFNAME VALUE 'ZACOSTA_FORMS_COPY1',
           V_FUNC_NAME TYPE RS38L_FNAM.
    DATA:   LS_CONTROL_PARAMETERS TYPE SSFCTRLOP,
            LS_OUTPUT_OPTIONS     TYPE SSFCOMPOP,
            LS_JOB_OUTPUT_INFO    TYPE SSFCRESCL,
            LT_LINES              TYPE TABLE OF TLINE,
            L_DEVTYPE             TYPE RSPOPTYPE,
            L_SAM_HAWKINS         TYPE INT4,
            L_DOC TYPE DOCS OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT VBAKVBELN VBAKVKORG VBAK~VTWEG
             VBAKSPART VBAKKUNNR VBAP~POSNR
             VBAPMATNR VBAPARKTX VBAP~NETWR
             VEDAVBEGDAT VEDAVENDDAT
             INTO CORRESPONDING FIELDS OF TABLE IT_ZACOSTA
             FROM VBAK INNER JOIN VBAP
             ON VBAKVBELN = VBAPVBELN
             INNER JOIN VEDA
             ON VEDAVBELN = VBAPVBELN
             WHERE VBAK~VBELN  = '0040000264'. "Where Clause to be removed
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = V_FORM_NAME
           VARIANT                  = ' '
           DIRECT_CALL              = ' '
          IMPORTING
            FM_NAME                  = V_FUNC_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.
    Set language
      LS_CONTROL_PARAMETERS-LANGU  = SY-LANGU.
    Set control parameters to get the output format (OTF) from Smart Forms
      LS_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      LS_CONTROL_PARAMETERS-GETOTF    = 'X'.
      LS_OUTPUT_OPTIONS-TDNOPREV = 'X'.
      CALL FUNCTION V_FUNC_NAME
        EXPORTING
          OUTPUT_OPTIONS     = LS_OUTPUT_OPTIONS
          CONTROL_PARAMETERS = LS_CONTROL_PARAMETERS
          USER_SETTINGS      = SPACE
          IT_ZACOSTA         = IT_ZACOSTA
        IMPORTING
          JOB_OUTPUT_INFO    = LS_JOB_OUTPUT_INFO.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
             FORMAT                      = 'PDF'
            MAX_LINEWIDTH               = 132
           ARCHIVE_INDEX               = ' '
           COPYNUMBER                  = 0
           IMPORTING
             BIN_FILESIZE                = L_SAM_HAWKINS
            bin_file                    = p_data       " binary file
           TABLES
             OTF                  = LS_JOB_OUTPUT_INFO-OTFDATA
             LINES                       = LT_LINES
           EXCEPTIONS
             ERR_MAX_LINEWIDTH           = 1
             ERR_FORMAT                  = 2
             ERR_CONV_NOT_POSSIBLE       = 3
             ERR_BAD_OTF                 = 4
             OTHERS                      = 5
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\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'
    IMPORTING
      FILELENGTH                      =
      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.
    The reson why I had to download is because this does not show the PDF at runtime. Am I missing some parameter here or is there some kind of configuration required to display the smartform in PDF at runtime within the SAP GUI.
    Any hints on this would be greatly appreciated.
    Best Regards,
    Sudhi

    Hi,
    Here is the sample code.This code will download the smartforms as PDF.Kindly reward points by clicking the star on the left of reply,if it helps.
    REPORT zswar.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    SELECTION-SCREEN: END OF BLOCK b1.
    DATA: ws_ucomm LIKE sy-ucomm.
    INITIALIZATION.
    SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.
    AT SELECTION-SCREEN.
    ws_ucomm = sy-ucomm.
    CASE ws_ucomm.
    WHEN '&PDF'.
    PERFORM f1000_download_form.
    EXIT.
    WHEN '&BACK'.
    SET SCREEN 0.
    EXIT.
    WHEN '&EXIT'.
    SET SCREEN 0.
    EXIT.
    WHEN '&canc'.
    SET SCREEN 0.
    LEAVE TO SCREEN 0.
    ENDCASE.
    *& Form F1000_DOWNLOAD_FORM
    text
    --> p1 text
    <-- p2 text
    FORM f1000_download_form.
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    Tutorial on SMART FORMS
    © 2005 SAP AG 7
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i.
    DATA: w_bin_filesize TYPE i.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZSMARTFORM_SWAR'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = 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.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = wa_ctrlop
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = wa_outopt
    user_settings = 'X'
    mydate = p_date
    reason = p_rea
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otfdata
    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_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    Tutorial on SMART FORMS
    © 2005 SAP AG 8
    max_linewidth = 132
    ARCHIVE_INDEX = ' '
    IMPORTING
    bin_filesize = w_bin_filesize
    TABLES
    otf = t_otf
    lines = t_pdf_tab
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 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.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    CODEPAGE = ' '
    filename = 'd:     est.PDF'
    filetype = 'BIN'
    MODE = ' '
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
    ELSE.
    MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
    'under D drive'.
    ENDIF.
    ENDFORM. " F1000_DOWNLOAD_FORM

  • 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

  • Error in opening smartform generated PDF attachments

    Hi every one,
        my smartforms generate multiple emails based on the widely used code as shown below.
    The emails are successfully being sent to different locations, but the problem is the first PDF file is opening, but the others followed by it are not opening. It's giving an error ' File damaged and cannot be opened!'
    Pls see the below code and help me out.
    Points would be awarded.
    Thanks to all in advance!!
    Arnab
    REPORT  zvenkat_smartform_via_mai.
    *&  Structures and Infotype Internal tables.
    TABLES pernr.
    INFOTYPES:
      0000,
      0001,
      0002,
      0006,
      0022,
      0023.
    INCLUDE dbpnpmac.
    *&  Declaration part
    Types
    TYPES:
       BEGIN OF t_emp_info,
         pernr TYPE pa0001-pernr,
         ename TYPE pa0001-ename,
         bukrs TYPE pa0001-bukrs,
         persk TYPE pa0001-persk,
         stell TYPE pa0001-stell,
         gblnd TYPE pa0002-gblnd,
       END OF t_emp_info,
       BEGIN OF t_mard,
         matnr TYPE mard-matnr,
         werks TYPE mard-werks,
         labst TYPE mard-labst,
         meins TYPE mara-meins,
       END OF t_mard.
    Work areas
    DATA:
      w_emp_info TYPE t_emp_info.
    Internal tables
    DATA:
      i_emp_info TYPE STANDARD TABLE OF t_emp_info,
      i_mard     TYPE STANDARD TABLE OF t_mard.
    "  Mai related declarations
    "Variables
    DATA :
         g_sent_to_all   TYPE sonv-flag,
         g_tab_lines     TYPE i.
    "Types
    TYPES:
         t_document_data  TYPE  sodocchgi1,
         t_packing_list   TYPE  sopcklsti1,
         t_attachment     TYPE  solisti1,
         t_body_msg       TYPE  solisti1,
         t_receivers      TYPE  somlreci1,
         t_pdf            TYPE  tline.
    "Workareas
    DATA :
         w_document_data  TYPE  t_document_data,
         w_packing_list   TYPE  t_packing_list,
         w_attachment     TYPE  t_attachment,
         w_body_msg       TYPE  t_body_msg,
         w_receivers      TYPE  t_receivers,
         w_pdf            TYPE  t_pdf.
    "Internal Tables
    DATA :
         i_document_data  TYPE STANDARD TABLE OF t_document_data,
         i_packing_list   TYPE STANDARD TABLE OF t_packing_list,
         i_attachment     TYPE STANDARD TABLE OF t_attachment,
         i_body_msg       TYPE STANDARD TABLE OF t_body_msg,
         i_receivers      TYPE STANDARD TABLE OF t_receivers,
         i_pdf            TYPE STANDARD TABLE OF t_pdf.
    PARAMETERS:
               p_mai_id(99) TYPE c.
    *& Start-of-selection.
    START-OF-SELECTION.
    GET pernr.
      PERFORM get_data.
      PERFORM show_smartform.
    *& End-of-selection.
    END-OF-SELECTION.
    *&      Form  get_data
    FORM get_data .
      rp-provide-from-last p0000 space pn-begda pn-endda.
      rp-provide-from-last p0001 space pn-begda pn-endda.
      rp-provide-from-last p0002 space pn-begda pn-endda.
      MOVE-CORRESPONDING: p0000 TO w_emp_info,
                          p0001 TO w_emp_info,
                          p0002 TO w_emp_info.
      SELECT matnr werks labst
      FROM mard
      INTO CORRESPONDING FIELDS OF TABLE i_mard.
    ENDFORM.                    " get_data
    *&      Form  show_smartform
    FORM show_smartform .
      DATA :
        l_sform_name TYPE tdsfname,
        l_fm_name    TYPE rs38l_fnam.
      DATA :
            l_sf_control TYPE ssfctrlop,
            l_sf_options TYPE ssfcompop.
      DATA: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
           i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
      DATA: op_option TYPE ssfctrlop,
            job_output TYPE ssfcrescl.
    op_option-getotf = 'X'.
      l_sform_name = 'ZVENKAT_SMARTFORM'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = l_sform_name
        IMPORTING
          fm_name            = l_fm_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.
      ELSE.
        CALL FUNCTION l_fm_name
          EXPORTING
            control_parameters = op_option
            output_options     = l_sf_options
            w_emp_info         = w_emp_info
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = job_output
          TABLES
            p0006              = p0006
            p0022              = p0022
            p0023              = p0023
            i_mard             = i_mard.
        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 'CONVERT_OTF'
          EXPORTING
            format = 'PDF'
          TABLES
            otf    = job_output-otfdata
            lines  = i_pdf.
        IF sy-subrc  0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        PERFORM send_mai.
      ENDIF.
    ENDFORM.                    " show_smartform
    *&      Form  send_mai
    FORM send_mail .
      "Subject of the mai.
      w_document_data-obj_name  = 'MAI_TO_HEAD'.
      w_document_data-obj_descr = 'Regarding Mai Program by SAP ABAP'.
      "Body of the mai
      PERFORM build_body_of_mai
        USING:space,
              'Hi,',
              'I am fine. How are you? How are you doing ? ',
              'This program has been created to send simple mai',
              'with Subject,Body with Address of the sender. ',
              'Regards,',
              'Venkat.O,',
              'SAP HR Technical Consultant.'.
      "Write Packing List for Body
      DESCRIBE TABLE i_body_msg LINES g_tab_lines.
      w_packing_list-head_start = 1.
      w_packing_list-head_num   = 0.
      w_packing_list-body_start = 1.
      w_packing_list-body_num   = g_tab_lines.
      w_packing_list-doc_type   = 'RAW'.
      APPEND w_packing_list TO i_packing_list.
      CLEAR  w_packing_list.
      "Write Packing List for Attachment
      w_packing_list-transf_bin = 'X'.
      w_packing_list-head_start = 1.
      w_packing_list-head_num   = 1.
      w_packing_list-body_start = 1.
      DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
      w_packing_list-doc_type   = 'PDF'.
      w_packing_list-obj_descr  = 'PDF Attachment'.
      w_packing_list-obj_name   = 'PDF_ATTACHMENT'.
      w_packing_list-doc_size   = w_packing_list-body_num * 255.
      APPEND w_packing_list TO i_packing_list.
      CLEAR  w_packing_list.
      "Fill the document data and get size of attachment
      w_document_data-obj_langu  = sy-langu.
      READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
      w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
      "Receivers List.
      w_receivers-rec_type   = 'U'.      "Internet address
      w_receivers-receiver   = p_mai_id. "here mai Id should be given
      w_receivers-com_type   = 'INT'.
      w_receivers-notif_del  = 'X'.
      w_receivers-notif_ndel = 'X'.
      APPEND w_receivers TO i_receivers .
      CLEAR:w_receivers.
      "Function module to send mai to Recipients
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = w_document_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = g_sent_to_all
        TABLES
          packing_list               = i_packing_list
          contents_bin               = i_attachment
          contents_txt               = i_body_msg
          receivers                  = i_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.
      IF sy-subrc = 0 .
        MESSAGE i303(me) WITH 'Mai has been Successfully Sent.'.
      ELSE.
        WAIT UP TO 2 SECONDS.
        "This program starts the SAPconnect send process.
        SUBMIT rsconn01 WITH mode = 'INT'
                        WITH output = 'X'
                        AND RETURN.
      ENDIF.
    ENDFORM.                    " send_mai
    *&      Form  build_body_of_mai
          text
         -->L_MESSAGE  text
    FORM build_body_of_mai  USING l_message.
      w_body_msg = l_message.
      APPEND w_body_msg TO i_body_msg.
      CLEAR  w_body_msg.
    ENDFORM.                    " build_body_of_mai

    Hi,
    Check the code below
    1.converting smartform to PDF
    Summury: Converting the smartfrom to PDF is process of 3 simple steps.
    • Calling the Smart form, then it returns the OTF data in Return.
    • Converting the OTF data into required format using the Function Module CONVERT_OTF_2_PDF.
    • Download the File
    *& Report ZTEST_NREDDY_PDF
    REPORT ZTEST_NREDDY_PDF.
    DATA: it_otf TYPE STANDARD TABLE OF itcoo,
    it_docs TYPE STANDARD TABLE OF docs,
    it_lines TYPE STANDARD TABLE OF tline,
    st_job_output_info TYPE ssfcrescl,
    st_document_output_info TYPE ssfcrespd,
    st_job_output_options TYPE ssfcresop,
    st_output_options TYPE ssfcompop,
    st_control_parameters TYPE ssfctrlop,
    v_len_in TYPE so_obj_len,
    v_language TYPE sflangu VALUE 'E',
    v_e_devtype TYPE rspoptype,
    v_bin_filesize TYPE i,
    v_name TYPE string,
    v_path TYPE string,
    v_fullpath TYPE string,
    v_filter TYPE string,
    v_uact TYPE i,
    v_guiobj TYPE REF TO cl_gui_frontend_services,
    v_filename TYPE string,
    v_fm_name TYPE rs38l_fnam.
    CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
    EXPORTING
    i_language = v_language
    i_application = 'SAPDEFAULT'
    IMPORTING
    e_devtype = v_e_devtype.
    st_output_options-tdprinter = v_e_devtype.
    *st_output_options-tdprinter = 'locl'.
    st_control_parameters-no_dialog = 'X'.
    st_control_parameters-getotf = 'X'.
    .................GET SMARTFORM FUNCTION MODULE NAME.................
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = c_formname
    IMPORTING
    fm_name = v_fm_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.
    ...........................CALL SMARTFORM............................
    CALL FUNCTION v_fm_name
    EXPORTING
    control_parameters = st_control_parameters
    output_options = st_output_options
    IMPORTING
    document_output_info = st_document_output_info
    job_output_info = st_job_output_info
    job_output_options = st_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.
    ELSE.
    .........................CONVERT TO OTF TO PDF.......................
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
    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 'smrt' '.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'
    TABLES
    data_tab = it_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
    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.
    ENDIF.
    Regards,
    Raj.

  • Convert Smartform in PDF format and send to SAP Workplace

    Hi to all.
    I need help of somebody expert in SMARTFORM's.
    I need to convert a smartform into PDF format and to send as attachement for SAP workplace
    of the user.
    I developed the next code.
    IT is to function and to send the mail for SAP workplace, but it happens that smartform
    contains images (logos) and tables, when the user tries to open the file pdf in inbox gives
    to error - "An unrecognized token ' q0 ' was found".
    I tried to call a smartform only with text and functioned well.
    Somebody can help me?
    My code:
    Begin ***********************************************
    REPORT zteste_nsa_send_pdf_sap_office.
    DATA: t_print LIKE zeps_fm04 OCCURS 0 WITH HEADER LINE,
          v_size TYPE i.
    DATA: ls_bil_invoice TYPE lbbil_invoice.
    TABLES: nast.
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    i_tline TYPE TABLE OF tline WITH HEADER LINE,
    i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
    i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    wa_objhead TYPE soli_tab,
    w_ctrlop TYPE ssfctrlop,
    w_compop TYPE ssfcompop,
    w_return TYPE ssfcrescl,
    wa_doc_chng TYPE sodocchgi1,
    w_data TYPE sodocchgi1,
    wa_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
    v_form_name TYPE rs38l_fnam,
    v_len_in LIKE sood-objlen,
    v_len_out LIKE sood-objlen,
    v_len_outn TYPE i,
    v_lines_txt TYPE i,
    v_lines_bin TYPE i.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZFPS_FICHA_VALORIZACAO'
        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.
      w_ctrlop-getotf    = 'X'.
      w_ctrlop-no_dialog = 'X'.
      w_compop-tdnoprev  = 'X'.
      CALL FUNCTION v_form_name
        EXPORTING
          control_parameters = w_ctrlop
          output_options     = w_compop
          user_settings      = 'X'
          is_bil_invoice     = ls_bil_invoice
          is_nast            = nast
          is_repeat          = 'X'
        IMPORTING
          job_output_info    = w_return
        TABLES
          t_list             = t_print
        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.
      i_otf[] = w_return-otfdata[].
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
          bin_filesize          = v_len_in
        TABLES
          otf                   = i_otf
          lines                 = i_tline
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc EQ 0.
      ENDIF.
    Convert PDF from 132 to 255.
      LOOP AT i_tline.
        TRANSLATE i_tline USING '~'.
        CONCATENATE wa_buffer i_tline 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.
    SEND MAIL
      REFRESH:  i_reclist,
                i_objtxt,
                i_objbin,
                i_objpack.
      CLEAR wa_objhead.
    Object with PDF.
      i_objbin[] = i_record[].
    Object with main text of the mail.
      i_objtxt = 'Fichas de Valorização e Esquemas Tipo'.
      APPEND i_objtxt.
    Document information.
      wa_doc_chng-obj_name   = 'SMART'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr  = 'Ficha de Valorização'.
      wa_doc_chng-sensitivty = 'F'. "Functional object
      wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    Pack to main body as RAW.
    Obj. to be transported not in binary form
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      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   = 'RAW'.
      APPEND i_objpack.
    Packing as PDF.
    Obj. to be transported in binary form
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num   = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num   = v_lines_bin.
      i_objpack-doc_type   = 'PDF'.
      i_objpack-obj_name   = 'SMART'.
      CONCATENATE 'Ficha_Valorizacao' '.pdf' INTO i_objpack-obj_descr.
      i_objpack-doc_size = ( v_lines_bin - 1 ) * 255 + STRLEN( i_objbin ).
      APPEND i_objpack.
    e-mail receivers.
      CLEAR i_reclist.
      i_reclist-receiver = sy-uname.
      i_reclist-rec_type = 'B'.
      i_reclist-express  = 'X'.
      APPEND i_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = ' '
        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 EQ 0.
      ENDIF.
    End  *************************************************
    Thanks very much to all and Happy New year...
    Nelson

    Please check this link...
    [http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm]
    -Muktar

  • Help: PDF Generation Problems in Reports 3.0

    Hi Techies,
    We are generating PDFs from Oracle Reports 3.0
    The PDF generation is fine in some datbases.
    But in some database,when the records are more, during PDF
    generation, Dr.Watson error is encountered, saying access
    violation.
    Can any one please clarify whether the error is due to memory
    constraints on the system or if it has something to do with
    Oracle Reports setting, while generating PDFs.
    Do note that the reports are running fine, when the report has
    less number of records.
    Any suggestion/tip is awaited at the earliest.
    Thanks in advance,
    Geoff
    null

    Hi!
    Remove cache from output dir from time time.
    (i.e. from virtual dir where report server puts output)
    let me know ...
    later
    Geoff (guest) wrote:
    : Hi Techies,
    : We are generating PDFs from Oracle Reports 3.0
    : The PDF generation is fine in some datbases.
    : But in some database,when the records are more, during PDF
    : generation, Dr.Watson error is encountered, saying access
    : violation.
    : Can any one please clarify whether the error is due to memory
    : constraints on the system or if it has something to do with
    : Oracle Reports setting, while generating PDFs.
    : Do note that the reports are running fine, when the report has
    : less number of records.
    : Any suggestion/tip is awaited at the earliest.
    : Thanks in advance,
    : Geoff
    null

  • PDF Generation problems in Reports 3.0

    Hi,
    I am generating PDFs from Oracle Reports 3.0
    The PDF generation is fine in some datbases.
    But in some database,when the records are more, during PDF
    generation, Dr.Watson error is encountered, saying access
    violation.
    Can any one please clarify whether the error is due to memory
    constraints on the system or if it has something to do with
    Oracle Reports setting, while generating PDFs.
    Do note that the reports are running fine, when the report has
    less number of records.
    Any help in this matter is appreciated.
    Regards,
    PRAKASH
    null

    Hi!
    Remove cache from output dir from time time.
    (i.e. from virtual dir where report server puts output)
    let me know ...
    later
    Geoff (guest) wrote:
    : Hi Techies,
    : We are generating PDFs from Oracle Reports 3.0
    : The PDF generation is fine in some datbases.
    : But in some database,when the records are more, during PDF
    : generation, Dr.Watson error is encountered, saying access
    : violation.
    : Can any one please clarify whether the error is due to memory
    : constraints on the system or if it has something to do with
    : Oracle Reports setting, while generating PDFs.
    : Do note that the reports are running fine, when the report has
    : less number of records.
    : Any suggestion/tip is awaited at the earliest.
    : Thanks in advance,
    : Geoff
    null

  • How to send output of smartform in pdf format as an attachment to email

    how to send output of smartform in pdf format as an attachment to email
    search before posting further and follow Forum rules
    Edited by: Vijay Babu Dudla on Jan 15, 2009 4:50 AM

    Did u check on sdn?
    i dont think so or else there are many posts on this topic and good wikis too.
    look at one of these code tutorial wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
    So next time do use the search functionality.
    кu03B1ятu03B9к
    Edited by: kartik tarla on Jan 15, 2009 12:33 PM

  • Problem in converting smartform to PDF

    Hi Experts,
    I am facing the issue while converting the smartform to pdf form with the help of FM convert_otf_2_pdf .
    Problem is that
    CH3OH4OD7     3 , 4 and 7 are the subscipts in SMARTFORM like in a chemical formula ,but after conveting to PDF # is replacing the subscripts like CH#OH#OD# .
    Kindly help in this issue.
    Thanks
    Sachin
    Edited by: Rob Burbank on Feb 6, 2012 10:13 AM

    Try this example it will be help full
    REPORT  YSAMPLE5.
    DATA:
    w_form_name TYPE tdsfname VALUE 'YSAMPLE2',
    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
    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
    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'
    tables
    data_tab = T_pdf_tab
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

Maybe you are looking for

  • Photo Gallery module- isn't responsive

    Hi there, I am trying to find out if someone can help me with the photo gallery module. I have used the photo gallery module in a responsice template but it isn't responsive when you look at it on a phone. I have asked for help from the support but t

  • Sync from aperture

    i have some albums that i sync to AppleTV, iPhone, and iPod. recently, i added some shots to one of those albums, but they do not sure up on the devices. the photo sync window in iTunes shows the album, but does not have the correct number of images.

  • Urgent! What is 'mds' and why is it crashing?

    As of 6/15/2009 an application called "mds' keeps crashing about every 5 minutes. Anyone have any ideas and/or solutions? I want to solve this before Id do my routine full backup. My last backup was on 6/5/09

  • Regarding condition table and access sequence

    Dear SAP Gurus I have requirement as detailed below My taxation procedure is    TAXINN I have a new requirement is as detailed below for the Access Sequence JTAX --I wanted new  key combination as detailed below  Plant /Vendor/Tax code How to do this

  • Numlock wont start automatically in slim!

    hi, i cant get numlock to come on at start with slim & openbox! i have set the following in /etc/slim.conf numlock on anyone know why??