Smartform to PDF conversion

Hi Experts ,
I am sending an e-mail aith a PDF attachment , the attachment contains a greeting card (BIT MAP file),
When i find the mail , PDF is opening with error 'Drawing Error Occured'.
Pls find the sample code ...
          CALL FUNCTION V_FORM_NAME
            EXPORTING
              ARCHIVE_PARAMETERS = W_ARCLOP
              CONTROL_PARAMETERS = W_CTRLOP
              OUTPUT_OPTIONS     = W_COMPOP
              USER_SETTINGS      = 'X'
            IMPORTING
              JOB_OUTPUT_INFO    = W_RETURN
            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          = 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.
          CHECK NOT ( I_TLINE[] IS INITIAL ).
          DATA :LV_COUNTER  TYPE I.
          DATA :LV_FROM     TYPE I.
          LOOP AT I_TLINE.
            TRANSLATE  I_TLINE USING ' ~' .
         CONCATENATE IT_ATTACHMENT_LONG I_TLINE INTO IT_ATTACHMENT_LONG
          ENDLOOP.
          TRANSLATE  IT_ATTACHMENT_LONG USING '~ ' .
          APPEND IT_ATTACHMENT_LONG.
          CLEAR : LV_COUNTER.
          DO.
            LV_COUNTER = STRLEN( IT_ATTACHMENT_LONG ).
            IF LV_COUNTER GE 255.
              IT_ATTACHMENT = IT_ATTACHMENT_LONG(255).
              APPEND IT_ATTACHMENT.
              SHIFT IT_ATTACHMENT_LONG BY 255 PLACES.
            ELSE.
              IT_ATTACHMENT = IT_ATTACHMENT_LONG(LV_COUNTER).
              APPEND IT_ATTACHMENT.
              EXIT.
            ENDIF.
          ENDDO.
*END:ADDED COMMENTS LINE BY SUHAS 27.01.2007
          DESCRIBE TABLE LT_OBJTXT LINES L_TAB_LINES.
          READ TABLE LT_OBJTXT INDEX L_TAB_LINES.
          LE_DOC_CHNG-DOC_SIZE = ( L_TAB_LINES - 1 ) * 255
                                  + STRLEN( LT_OBJTXT ).
  Title of the email as spool name
  CONCATENATE 'Happy Birthday :'  T522T-ATEXT PA0002-VORNA PA0002-NACHN
  INTO TITLE SEPARATED BY SPACE.
          LV_DOCUMENT_DATA-OBJ_DESCR = TITLE.
          LV_DOCUMENT_DATA-SENSITIVTY = 'O'.
          LV_DOCUMENT_DATA-EXPIRY_DAT = SY-DATUM + 15.
          LV_DOCUMENT_DATA-DOC_SIZE = STRLEN( LT_OBJTXT ).
  e-mail body
          CLEAR LT_OBJPACK.
          LT_OBJPACK-HEAD_START = 1.
          LT_OBJPACK-HEAD_NUM = 0.
          LT_OBJPACK-BODY_START = 1.
          LT_OBJPACK-BODY_NUM = L_TAB_LINES.
          LT_OBJPACK-DOC_TYPE = 'RAW'.
          APPEND LT_OBJPACK.
*START:ADDED COMMENTS BY SUHAS 27.01.2007
  For e-mail attachment
          DESCRIBE TABLE IT_ATTACHMENT LINES L_ATT_LINES.
          READ TABLE IT_ATTACHMENT INDEX L_ATT_LINES.
*END:ADDED COMMENTS BY SUHAS 27.01.2007
*START:ADDED COMMENTS BY SUHAS 27.01.2007
          CLEAR LT_OBJPACK.
          LT_OBJPACK-TRANSF_BIN = 'X'.
          LT_OBJPACK-HEAD_START = 1.
          LT_OBJPACK-HEAD_NUM = 1.
          LT_OBJPACK-BODY_START = 1.
          LT_OBJPACK-BODY_NUM = L_ATT_LINES.
          LT_OBJPACK-DOC_TYPE = 'PDF'.
          LT_OBJPACK-OBJ_NAME = 'email'.
          LT_OBJPACK-OBJ_DESCR = LV_SPOOL_DESC.
          LT_OBJPACK-DOC_SIZE = ( 255 * ( L_ATT_LINES - 1 ) ) +
STRLEN(
          IT_ATTACHMENT-LINE ).
          LT_OBJPACK-OBJ_NAME   = 'Salary Slip'.
          LT_OBJPACK-OBJ_NAME   = TITLE.
          WRITE SY-DATUM TO LT_OBJPACK-OBJ_DESCR.
          CONCATENATE 'Bday' LT_OBJPACK-OBJ_DESCR INTO
    LT_OBJPACK-OBJ_DESCR
          SEPARATED BY SPACE.
          CONCATENATE LT_OBJPACK-OBJ_DESCR '.PDF' INTO
    LT_OBJPACK-OBJ_DESCR.
          APPEND LT_OBJPACK.
*END:ADDED COMMENTS BY SUHAS 27.01.2007
          LT_RECLIST-RECEIVER = PA0105-USRID_LONG.
          LT_RECLIST-REC_TYPE = 'U'.
          APPEND LT_RECLIST.
          CLEAR LT_RECLIST.
          LT_RECLIST-RECEIVER = V_RESMAIL.
          LT_RECLIST-REC_TYPE = 'U'.
          APPEND LT_RECLIST.
          CLEAR LT_RECLIST.
*START:ADDED LINE BY SUHAS 25.01.08
          SELECT SINGLE BUKRS INTO PA0001-BUKRS
          FROM PA0001
          WHERE PERNR EQ IT_PA0001-PERNR AND
                BEGDA LE SY-DATUM AND
                ENDDA GE SY-DATUM.
          SELECT A~PERNR INTO CORRESPONDING FIELDS OF TABLE IT_PR
          FROM ZHR_BIRTHDAY AS A INNER JOIN PA0001 AS B ON
               APERNR EQ BPERNR
          WHERE A~DFLAG = '' AND
                B~BUKRS EQ PA0001-BUKRS AND
                B~BEGDA LE SY-DATUM AND
                B~ENDDA GE SY-DATUM.
          LOOP AT IT_PR.
            SELECT SINGLE USRID_LONG INTO PA0105-USRID_LONG
            FROM PA0105
            WHERE PERNR = IT_PR-PERNR AND
                  SUBTY = '0010' AND
                  BEGDA LE SY-DATUM AND
                  ENDDA GE SY-DATUM.
            IF SY-SUBRC = 0.
              LT_RECLIST-RECEIVER = PA0105-USRID_LONG.
              LT_RECLIST-REC_TYPE = 'U'.
              APPEND LT_RECLIST.
            ENDIF.
          ENDLOOP.
*END:ADDED LINE BY SUHAS 25.01.08
Provide Employee Email List Cost Centerwise.
          IF IT_PA0001-KOSTL NE ''.
            SELECT PERNR INTO PA0001-PERNR
            FROM PA0001
            WHERE KOSTL = IT_PA0001-KOSTL AND
                  BEGDA LE SY-DATUM AND
                  ENDDA GE SY-DATUM.
              IF SY-SUBRC = 0.
*CHECKING EMPLOYEE ACTIVE STATUS.
                CALL FUNCTION 'RP_GET_FIRE_DATE'
                EXPORTING
                  PERSNR         = PA0001-PERNR
    STATUS2        = '0'
               IMPORTING
                  FIREDATE       = FIRE_DATE1.
                IF FIRE_DATE1 IS NOT INITIAL.
                ELSE.
                  SELECT SINGLE USRID_LONG INTO PA0105-USRID_LONG
                  FROM PA0105
                  WHERE PERNR = PA0001-PERNR AND
                        SUBTY = '0010' AND
                        BEGDA LE SY-DATUM AND
                        ENDDA GE SY-DATUM.
                  IF SY-SUBRC = 0.
                    LT_RECLIST-RECEIVER = PA0105-USRID_LONG.
                    LT_RECLIST-REC_TYPE = 'U'.
                    APPEND LT_RECLIST.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDSELECT.
          ENDIF.
for it department employee
         SELECT SINGLE PERNR INTO PA0001-PERNR
         FROM PA0001
         WHERE PERNR EQ IT_PA0001-PERNR AND
               KOSTL IN S_KOSTL.
         IF SY-SUBRC = 0.
           SELECT PERNR INTO PA0001-PERNR
           FROM PA0001
           WHERE PERNR IN S_RESPER AND
                 KOSTL IN S_KOSTL.
             SELECT SINGLE USRID_LONG INTO PA0105-USRID_LONG
              FROM PA0105
              WHERE PERNR = PA0001-PERNR AND
                    SUBTY = '0010' AND
                    BEGDA LE SY-DATUM AND
                    ENDDA GE SY-DATUM.
             IF SY-SUBRC = 0.
               LT_RECLIST-RECEIVER = PA0105-USRID_LONG.
               LT_RECLIST-REC_TYPE = 'U'.
               APPEND LT_RECLIST.
             ENDIF.
           ENDSELECT.
         ENDIF.
  send mail with attachment
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA              = LV_DOCUMENT_DATA
              PUT_IN_OUTBOX              = 'X'
              COMMIT_WORK                = 'X'
            TABLES
              PACKING_LIST               = LT_OBJPACK
              OBJECT_HEADER              = LT_OBJHEAD
              CONTENTS_BIN               = IT_ATTACHMENT
              CONTENTS_TXT               = LT_OBJTXT
              RECEIVERS                  = LT_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.
              WRITE: / 'Many many happy returns of the day '.
              LOOP AT LT_RECLIST.
                IF LT_RECLIST-RETRN_CODE = 0.
                  WRITE '...sent successfully!!!'.
                ELSE.
                  WRITE 'not sent'.
                ENDIF.
              ENDLOOP.
            WHEN 1.
            WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
            WHEN 4.
              WRITE: / 'no authorization to send !'.
            WHEN OTHERS.
              WRITE: / 'error occurred during sending !'.
          ENDCASE.
          REFRESH:LT_RECLIST.
          CLEAR:MI_RQIDENT,LV_SPOOL_DESC,MC_VALID,
IT_ATTACHMENT_LONG,IT_ATTACHMENT,LV_DOCUMENT_DATA,MSTR_PRINT_PARMS,
          LE_DOC_CHNG,LV_DOCUMENT_DATA,V_EMAIL,V_CELL,V_EXT.
          REFRESH:LT_PDF,IT_ATTACHMENT_LONG,IT_ATTACHMENT,
MAIL_BODY,LT_OBJTXT,LT_OBJPACK,IT_ATTACHMENT,LT_OBJPACK,LT_RECLIST,
          LT_OBJHEAD,IT_ATTACHMENT,LT_OBJTXT.
        ENDIF.
      ENDIF.
    ENDIF.
   ENDIF.
  ENDLOOP.
Pls check ...

Hi,
check whther that Image avilable in the system or not.
and same time check the Size of the image.

Similar Messages

  • Smartform to PDF conversion having issue with Russian address

    We are having a business situation we are the invoice in English language and the the address of ship-to party and sold-to party in Russian.
    The issue we face is.
    When the  smartform is converted to PDF the Russian specific characters are missing in the PDF output. The same are perfect in the smart form print preview.
    we are using   CONVERT_OTF function module and we are getting the Russian characters correctly in the table parameter OTF.
    We are using "SX_TABLE_LINE_WIDTH_CHANGE" and " SO_DOCUMENT_SEND_API1"
    function module to attach and mail the pdf.
    In the PDF we are missing the Russian specific characters .
    For Example in "Sedláčkova čč" the output is "Sedláčkova    " means "čč" is mising
    Thanks in advance
    Regards
    Joby

    Hi,
    As described in note 999712 - PDF conversion for Unicode, there is a new unicode PDF converter PDFUC.
    It depends on the SAP Version if you have to install the device type or not. You can check also via SPAD -> Full Administration -> Device Types -> Display.
    You can pass the device type in the output options. I used:
    SSFCTRLOP-no_dialog   = 'X'.
    SSFCTRLOP-getotf      = 'X'.
    SSFCTRLOP-langu       = 'EN'.
    SSFCOMPOP-tdprinter = 'PDFUC'.
    If you specify a device other than printer in the control options like SSFCTRLOP-device      = 'TELEFAX'., above will not work as
    SSFCOMPOP-tdprinter is only evaluated for printer.
    You have to check in SCOT -> Settings -> Device Types for Format Conversion.
    You can make a general entry or for a specific language:
    PDF                           SAPscript/Smart Forms    PDFUC
    PDF    EN    English    SAPscript/Smart Forms    PDFUC
    Let me know if you get this working.
    Jeroen.

  • Smartform to pdf conversion and send as attachment

    Hi,
    my requirement is i have to change the smartform to pdf and send as attachment to mail id's.
    For specified smartform it is converting and sending as pdf
    but in my selection screen i have to give smartform name and mail id's.
    if i give any other smartform name it is going to dump.because of parameters.
    every smartform is not having same parameter.
    so how i can differentiate between the smartforms
    it means import and export parameters are changing for every smartform.
    how to solve this problem.
    thanks.
    venki
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Dec 28, 2009 2:20 PM

    Hi Venki,
    Use the below code...
    Give the form name into SSF function module from the selection screen and get the import parameter  FM name (smartform FM which will be unique). Give that to the next FM and get the import parameter and covert the same to pdf using the CONVERT OTF.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = P_FORMNAME
    IMPORTING
       FM_NAME                  = 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 FUNCTION FM_NAME
       EXPORTING
         CONTROL_PARAMETERS         = WA_CTRLOP
         OUTPUT_OPTIONS             = WA_OUTOPT
         USER_SETTINGS              = 'X'
       IMPORTING
         JOB_OUTPUT_INFO            = T_OTFDATA
        TABLES
          T_ITAB                     = T_ITAB3
       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'
        MAX_LINEWIDTH = 132
      IMPORTING
        BIN_FILESIZE = W_FILESIZE
      TABLES
        OTF = T_OTF[]
        LINES = T_PDF_TAB[]
      EXCEPTIONS
        ERR_MAX_LINEWIDTH = 1
        ERR_FORMAT = 2
        ERR_CONV_NOT_POSSIBLE = 3
        OTHERS = 4.
    Cheers,
    Sanil
    T
    Code Formatted by: Alvaro Tejada Galindo on Dec 28, 2009 2:19 PM

  • Smartform to pdf conversion Doubt

    Dear Expert
    i'm refering the below code to convert smartform to pdf in module pool program i have created two pushbuttons one for preview and one for edit, if users edit the values it will store in ztable and then they want to preview that changes in form but its not happening its showing old values only i tried to free the container and cleared the data and url values but still same this how to rectify this can some one hlep me out,
    FIELD-SYMBOLS <FS_X> TYPE X.
    INITIALIZATION.
    LS_CONTROL_PARAM-GETOTF = 'X'.
    LS_CONTROL_PARAM-NO_DIALOG = 'X'.
    START-OF-SELECTION.
      CALL FUNCTION '/1BCDWB/SF00000034'
    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.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
        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.
    * convert pdf to xstring string
      LOOP AT LT_PDF INTO LS_PDF.
        ASSIGN LS_PDF TO <FS_X> CASTING.
        CONCATENATE LV_CONTENT <FS_X> INTO LV_CONTENT IN BYTE MODE.
      ENDLOOP.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    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     = LV_CONTENT
        TABLES
          BINARY_TAB = LT_DATA.
    * Load the HTML
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application'
           SUBTYPE      = 'pdf'
         IMPORTING
           ASSIGNED_URL         = LV_URL
         CHANGING
           DATA_TABLE           = 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' ).
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards,
    Thirukumaran. R
    Edited by: thirukumaran rajendran on Jun 9, 2010 3:19 PM

    hey,,
      U can use 'RSTXPDFT4'

  • Smartform to PDF Conversion with number of copies to be printed

    Hi,
       I have requirement to display pdf in an iview for which i created a smartform and converted it into PDF using the Function Module 'CONVERT_OTF'.
    Now my requirement is, when the user press the 'Print' option in the Adobe Reader, automatically 3 copies needs to be printed..
    Is there any way to do this? If so, please let me know.
    Thanks,
    Sri

    That is a question for the Adobe applications support. Regards.

  • Smartforms to PDF conversion problem

    Hi experts,
    I have a fix that requires to send an email with a smartform as a pdf attachment. i was able to send the email with attachment but as i open the pdf file an error <b>''There was an error while opening a document. The file is damaged and file could not be repaired.'</b> or <b>'Adobe could not open *.pdf because it is either not supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).</b>
    I already debug my program and what i saw from my OTFDATA that is being returned by the smartform are <b>chinese characters and boxes</b> instead of hashes,alpa characters and etc (please note that my SF does not use any chinese script). I think that the error is due this.
    Has anyone encountered this type of problem? Please help.
    Also please note that this fix is migrated from a non-unicode dev box to a unicode system dev box
    Thanks in advance.

    hi tanmoy,
    i have installed the foxit reader and yet the error is still there. I believe that the error is coming from the otfdata that my smartform is generating.
    As an added information. My program is a Copy from another development box (BOX NA). When i run the program in BOX NA the code works fine and an email is sent to me, but on the dev box i am working right now it does not work fine.
    The program in the dev box is a the migrated version of the program in BOX NA.

  • Problem in PDF conversion of a Smartform

    Hi Experts,
    I have Chinese text and english text in the  Smartform
    When see print preview of Smartfrom the output is perfect
    But when i convert the OTF to PDF using  CONVERT_OTF FM and send as mail attachment,
    The chinese characters are JUNK and conversion don't occur properly.
    For english TEXT i use Times new roman font
    For Chinese Text i use CNSONG
    I have used other FM as well CONVERT_OTF_2_PDF, the results were negative.
    Please advise
    Regards
    Balaji R

    Hello Davide,
    We got this solution from SAP active global support.
    I suppose it works in some cases only.
    Our scenario is when we try to create PDF of the smartform using FM convert_otf and send as mail attachment.
    We can able to see chinese chracters when giving the print preview of the form, but during PDF conversion we get Junk chinese characters.
    Even if you have multiple languages in your form, SAP proposes to use 'ZPDFUC' as device type.
    My question has the solution proposed by you works in all cases?
    Please advise.Thanks.
    Best regards
    Balaji R

  • 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

  • Adding bar codes to printer device for smartforms pdf conversion?

    Hello friends,
    I would like to send a smartform as a pdf to an email recipient. The smartform shows some bar codes. The send process workes fine. But the bar codes doesn't appear on the pdf correctly. Therefore I would like to add bar codes to the printer device type in transaction SE73.
    Does somebody know the device type for smartforms pdf conversion? Or how can I add bar codes to smartforms pdf conversion process?
    greetings
    daniel

    Hello Denial,
    Try these links, this might solve ur problem
    http://www.tec-it.com//documentation/TBarCodeSAPLPD_EN.htm
    http://www.mecsw.com/info/appnote/app_024.html
    if you need any more information send me at [email protected]
    Thanks & Best Regards
    Ankur Jain

  • Conversion of sapscripts/smartforms to PDf format

    i want to use the standard program RSTXPDFT4 for converting into pdf format. but i want a way in which the spool number is automatically generated for the current script or smartform opened instead of the manual entry of the spool number by the user.

    hi bhaskar,
    this sample code may help u to convert smartforms to pdf.
    report ztest_smartforms_to_pdf
    DATA : FM_NAME TYPE  RS38L_FNAM,
           IT_VENDOR LIKE TABLE OF ZVENDOR,
           IT_MATERIAL LIKE TABLE OF ZMATERIAL,
           IT_PO LIKE TABLE OF ZPURCHASEORDER.
    DATA: CTRLPARAMS TYPE SSFCTRLOP,
          JOBOUTPUT TYPE SSFCRESCL,
          TLINES LIKE TABLE OF TLINE,
          IT_FILETABLE LIKE TABLE OF FILE_TABLE WITH HEADER LINE,
          FNAME TYPE STRING,
          RC TYPE I,
          BIN_SIZE TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSSF_PURCHASEORDER'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = FM_NAME.
    CTRLPARAMS-GETOTF = 'X'.
    CALL FUNCTION FM_NAME
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = CTRLPARAMS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = JOBOUTPUT
      JOB_OUTPUT_OPTIONS         =
      TABLES
        IT_VENDOR                  = IT_VENDOR
        IT_PO                      = IT_PO
        IT_MATERIAL                = IT_MATERIAL.
    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.
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        FORMAT                      = 'PDF'
      MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      IMPORTING
        BIN_FILESIZE                = BIN_SIZE
      TABLES
        OTF                         = JOBOUTPUT-OTFDATA
        LINES                       = TLINES
    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 METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'ENTER A FILENAME'
        DEFAULT_FILENAME        = 'REPORT.PDF'
        FILE_FILTER             = '*.PDF'
        INITIAL_DIRECTORY       = 'C:\'
      CHANGING
        FILE_TABLE              = IT_FILETABLE[]
        RC                      = RC.
      LOOP AT IT_FILETABLE.
        FNAME = IT_FILETABLE-FILENAME.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          BIN_FILESIZE                  = BIN_SIZE
          FILENAME                      = FNAME
          FILETYPE                      = 'BIN'
        TABLES
          DATA_TAB                      = tlines.

  • 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

  • Smartform to HTML conversion

    Hi,
    I need to convert Smartform data stream into HTML format and
    pass the same to Webdynpro application where it will be displayed on the browser.
    I have specified Smartform output format as 'XSF output+HTML'.
    Use of BSP application is ruled out due to certain limitations.
    The FM ‘CONVERT_OTF’ returns data in ASCII or PDF format only.
    Can any one tell some Function Module name to convert
    Smartform data to HTML format or any other way out?
    thanks.

    check out this link
    Smartform to HTML conversion
    thnks
    jaideep
    *reward points if useful

  • Smartform as PDF On Button Click

    Hello Everyone,
    I need to display a smartform as PDF on click of a button.
    I have done the conversion using CONVERT_OTF. And then,
    CREATE OBJECT cached_response
    EXPORTING add_c_msg = 1.
    *Start display PDF
          cached_response->set_header_field( name  = 'content-type'
                                      value = 'application/pdf' ).
    some Browsers have caching problems when loading PDF format
          cached_response->set_header_field(
                             name  = 'cache-control'
                             value = 'max-age=0' ).
    start PDF viewer either in the Browser or as a separate window
           cached_response->set_header_field(
                               name  = 'content-disposition'
                               value = 'attachment; filename=form.pdf' ).
    finally display PDF format in Browser
          l_pdf_len = xstrlen( l_pdf_xstring ).
         cached_response->set_data( data   = l_pdf_xstring
                              length = l_pdf_len ).
    DATA: OBJ1 TYPE REF TO CL_BSP_NAVIGATION,
                lr_runtime type ref to cl_bsp_runtime.
    CREATE OBJECT OBJ1
      EXPORTING
        RUNTIME = lr_runtime.
    call method OBJ1->RESPONSE_COMPLETE .
    Is this correct, did I miss anything?
    I get a blank screen when I click on the button.
    I know this was asked many times , checked those posts but no help.
    Looking forward to your input.
    Regards,
    Mohit Joshi

    Mohit,
    did you check the smartform itself?
    is it complete executed?
    can you test it via the FM?
    most of the times when the url shows an empty page is that or the SMARTFORM is not executed correctly or the pdf is not opened automatically.
    KR,
    Micha
    have a look at my coding:
         CALL FUNCTION 'SCMS_FTEXT_TO_BINARY'
           EXPORTING
             input_length    = ls_len
             append_to_table = 'X'
           IMPORTING
             output_length   = ls_len
           TABLES
             ftext_tab       = lt_objcont
             binary_tab      = lt_contents
           EXCEPTIONS
             failed          = 1
             OTHERS          = 2.
         lv_file_size = ls_len.
         lv_contenttype = 'text/plain'.                         "#EC NOTEXT
       ELSE.
         lv_file_size = xwa_len.
         lv_contenttype = 'application/pdf'.                    "#EC NOTEXT
         CONCATENATE ls_guid_str '.pdf' INTO lv_filename.
         lv_file_name = lv_filename.
         server->response->append_data(
                             data   = xwa
                             length = xwa_len ).
         CLEAR lt_contents. REFRESH lt_contents.
       ENDIF.
       CONCATENATE 'inline; filename=' lv_filename
         INTO lv_contentdisposition.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-disposition'
           value = lv_contentdisposition.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-type'
           value = lv_contenttype.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-filename'
           value = lv_filename.
      Content Tabelle (Byte Arrays) rausschreiben
       lv_chunksize = 1022.
       LOOP AT lt_contents INTO ls_contents.
         MOVE ls_contents-line TO xwa.
         xwa_len = lv_file_size - ( lv_chunksize * ( sy-tabix - 1 ) ).
         IF xwa_len >= lv_chunksize.
           xwa_len = lv_chunksize.
         ENDIF.
         server->response->append_data( data   = xwa
                             length = xwa_len ).
       ENDLOOP.
      Response beenden
       server->response->delete_header_field(
                 name = 'Cache-Control' ).                      "#EC NOTEXT
       server->response->delete_header_field(
                 name = 'Expires' ).                            "#EC NOTEXT
    Edited by: Micha Van Nijen on May 3, 2011 12:39 PM

  • Converting Smartform to PDF and send as email attachment

    Hi
    I want to send the Smartform to mail as PDF attachment.
    I found the program in code gallery., it name was 'ZTEST_NREDDY_PDF_MAIL' .
    I used this program and it send the Smartform to mail as PDF attachment but when open the pdf file it gave me error.
    error : 'An unrecognized token Qq was found'.
    Please help me out.
    Thanks
    Anina

    Hi,
    Following is the code logic:
        Tables for OTF to PDF Conversion
    DATA: g_t_docs      TYPE STANDARD TABLE OF docs,                      " Table for Stored Document
          g_t_lines     TYPE STANDARD TABLE OF tline.                     " Table for Text lines
        Objects to send mail.
    DATA: g_t_objpack   LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,        " SAPoffice: Description of Imported Object Components
          g_t_objtxt    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          g_t_objbin    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          g_t_contout   LIKE solisti1   OCCURS 0 WITH HEADER LINE,
          g_t_reclist   LIKE somlreci1  OCCURS 0 WITH HEADER LINE.        " SAPoffice: Structure of the API Recipient List
        Addresses (Business Address Services)
    DATA: g_t_adrc      LIKE adrc  OCCURS 0,
          g_t_adrc2     LIKE adrc  OCCURS 0,
          g_t_adrc3     LIKE adrc  OCCURS 0,
          g_t_adrc_wa   TYPE adrc,
          g_t_adrc2_wa  TYPE adrc,
          g_t_adrc3_wa  TYPE adrc.
        Sales Document: Partner
    DATA: g_t_vbpa_wa   TYPE vbpa.
        E-Mail Addresses (Business Address Services)
    DATA: g_t_adr6      LIKE adr6  OCCURS 0,
          g_t_adr6_2    LIKE adr6  OCCURS 0,
          g_t_adr6_wa   TYPE adr6,
          g_t_adr6_2_wa TYPE adr6.
    DATA:
        Work Area declarations
          g_wa_objhead   TYPE soli_tab,                                    " Work Area for Objcont and Objhead as Table Type
          g_wa_doc_chng  TYPE sodocchgi1,                                  " Work Area - Data of an object which can be changed
        Variables declarations
          g_lines_txt    TYPE i,
          g_lines_bin    TYPE i,
          g_email_id(40) VALUE '',                         " E-mail Address
        PDF related data declarations
          g_wa_job_output_info      TYPE   ssfcrescl,                      " Smart Forms: Return value at end of form printing
          g_wa_control_parameters   TYPE   ssfctrlop,"#EC NEEDED           " Smart Forms: Control structure
          g_name                    TYPE   string,
          g_path                    TYPE   string,
          g_fullpath                TYPE   string,
          g_filename                TYPE   string,
          g_filter                  TYPE   string,
          g_bin_filesize            TYPE   i,
          g_uact                    TYPE   i,
          g_guiobj                  TYPE   REF TO cl_gui_frontend_services.
      PERFORM f0100_download_pdf.    
      PERFORM f200_convert_to_pdf.
      PERFORM f300_attach_and_mail_pdf.   
    *&      Form  f0100_download_pdf
          To Download the PDF Format of SmartForm on
          Presentation Server
    FORM f0100_download_pdf.                                    "#EC CALLED
    Downloading PDF File
      CREATE OBJECT g_guiobj.
      CALL METHOD g_guiobj->file_save_dialog
        EXPORTING
          default_extension = 'pdf'
          default_file_name = g_name
          file_filter       = g_filter
        CHANGING
          filename          = g_name
          path              = g_path
          fullpath          = g_fullpath
          user_action       = g_uact.
      IF g_uact = g_guiobj->action_cancel.
        EXIT.
      ENDIF.
      MOVE g_fullpath TO g_filename.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize = g_bin_filesize
          filename     = g_filename
          filetype     = 'BIN'
        TABLES
          data_tab     = g_t_lines.
    ENDFORM.                    "f0100_download_pdf
    *&      Form  f0200_convert_to_pdf
          To convert the SmartForm to PDF format
    FORM f0200_convert_to_pdf .                                 "#EC CALLED
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize   = g_bin_filesize
        TABLES
          otf            = g_wa_job_output_info-otfdata
          doctab_archive = g_t_docs
          lines          = g_t_lines.
      CONCATENATE text-001 g_sales_order_no '.pdf' INTO g_name.
    ENDFORM.                    " f0200_convert_to_pdf
    *&      Form  f0300_attach_and_mail_pdf
          To E-Mail the PDF form as an Attachment
    FORM f0300_attach_and_mail_pdf .                            "#EC CALLED
    Attachment
      REFRESH: g_t_reclist,
               g_t_objtxt,
               g_t_objbin,
               g_t_objpack.
      CLEAR g_wa_objhead.
    Create Message Body Title and Description
      g_t_objtxt = g_name.
      APPEND g_t_objtxt.
      DESCRIBE TABLE g_t_objtxt LINES g_lines_txt.
      READ TABLE g_t_objtxt INDEX g_lines_txt.
      g_wa_doc_chng-obj_name = g_name.
      g_wa_doc_chng-expiry_dat = sy-datum + 10.
      g_wa_doc_chng-obj_descr = g_name.
      g_wa_doc_chng-sensitivty = 'F'.
      g_wa_doc_chng-doc_size = g_lines_txt * 255.
    Main Text
      CLEAR g_t_objpack-transf_bin.
      g_t_objpack-head_start = 1.
      g_t_objpack-head_num = 0.
      g_t_objpack-body_start = 1.
      g_t_objpack-body_num = g_lines_txt.
      g_t_objpack-doc_type = 'RAW'.
      APPEND g_t_objpack.
    Attachment (PDF-Attachment)
      g_t_objpack-transf_bin = 'X'.
      g_t_objpack-head_start = 1.
      g_t_objpack-head_num = 0.
      g_t_objpack-body_start = 1.
    Convert TLINE to SOLISTI1
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
        EXPORTING
          line_width_src              = 134
          line_width_dst              = 255
        TABLES
          content_in                  = g_t_lines
          content_out                 = g_t_contout
        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 s000(0k) WITH text-002.
        EXIT.
      ENDIF.
    Create Message Attachment
      APPEND LINES OF g_t_contout[] TO g_t_objbin[].
      DESCRIBE TABLE g_t_objbin LINES g_lines_bin.
      READ TABLE g_t_objbin INDEX g_lines_bin.
      g_t_objpack-doc_size = g_lines_bin * 255 .
      g_t_objpack-body_num = g_lines_bin.
      g_t_objpack-doc_type = 'PDF'.
      g_t_objpack-obj_name = text-003.
      g_t_objpack-obj_descr = text-004.
      APPEND g_t_objpack.
      CLEAR g_t_reclist.
      g_t_reclist-receiver = g_email_id.
      g_t_reclist-rec_type = 'U'.
      APPEND g_t_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data = g_wa_doc_chng
          put_in_outbox = 'X'
          commit_work   = 'X'
        TABLES
          packing_list  = g_t_objpack
          object_header = g_wa_objhead
          contents_bin  = g_t_objbin
          contents_txt  = g_t_objtxt
          receivers     = g_t_reclist.
    ENDFORM.                    " f0300_attach_and_mail_pdf

  • 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

Maybe you are looking for

  • All day events in iCal on 3Gs w/ iOS 4.0.2 show up day early in List view

    For some reasons, all day events on my Calendar (iCal synced via MobileMe) are showing up a day earlier on my iPhone, but only when I use List view. They appear fine when I use iCal on my MBP or iMac. This happens with all day events on my calendars

  • Error while running adconfig

    We are doing EBS R12.1.1 with 11gR2 database OS platform migration from Solaris Sparc 10(64 bit) to RHEL 5.6 (64 bit), we are following Oracle documents :- Export/import process for R12 using 11gR1 or 11gR2 [ID 741818.1] Application Tier Platform Mig

  • CC apps no longer work

    I installed Contribute CS5 because I needed to setup a client to use Contribute on their website. NOW ALL of my CC apps won't launch Did a restore point (Windows Vista) back to a point before I installed Contribute CS5 to see if that would fix the pr

  • ITunes doesn't launch - no errors or anything.

    iTunes refuses to launch after I closed it through the Task Manager because it wasn't responding. Does anyone have a solution for this? Please, help. iTunes 7   Windows XP  

  • InDesign Plugins to Package Files

    InDesign CC won't allow me to package my jobs until I install or activate the following plug ins: SUITCASEIDCS3PLUGIN.PLN FUSIONPROUICS3.PLN Where can I find these plug ins and what is the best way to install? thanks