FM CONVERT_OTFSPOOLJOB_2_PDF

Hi,
I have used the FM 'CONVERT_OTFSPOOLJOB_2_PDF' to generate a PDF file from a sapscript spool. I am faced with an issue wherein for certain languages although the sapscript spool is perfect the converted PDF output contains junk/illegible characters.
Is there something that i need to take care of before i use this FM.
As of now the problem occurs for the French and Slovenian character sets.

Hi Gerson,
Are you transfering the 132-long strings to 255-long strings after using the FM 'CONVERT_OTFSPOOLJOB_2_PDF' ?
If no, please insert code similar to the code shown below...
  DATA: gd_buffer TYPE string.,
            it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid                    = gd_spool_nr
      no_dialog                      = ' '
    DST_DEVICE                     =
    PDF_DESTINATION                =
    IMPORTING
      pdf_bytecount                  = numbytes
    PDF_SPOOLID                    =
    OTF_PAGECOUNT                  =
    BTC_JOBNAME                    =
    BTC_JOBCOUNT                   =
   TABLES
     pdf                            = tab_pdf
   EXCEPTIONS
     err_no_otf_spooljob            = 1
     err_no_spooljob                = 2
     err_no_permission              = 3
     err_conv_not_possible          = 4
     err_bad_dstdevice              = 5
     user_cancelled                 = 6
     err_spoolerror                 = 7
     err_temseerror                 = 8
     err_btcjob_open_failed         = 9
     err_btcjob_submit_failed       = 10
     err_btcjob_close_failed        = 11
     OTHERS                         = 12  .
Transfer the 132-long strings to 255-long strings
  LOOP AT tab_pdf.
    TRANSLATE tab_pdf USING ' ~'.
    CONCATENATE gd_buffer tab_pdf INTO gd_buffer.
  ENDLOOP.
  TRANSLATE gd_buffer USING '~ '.
  DO.
    it_mess_att = gd_buffer.
    APPEND it_mess_att.
    SHIFT gd_buffer LEFT BY 255 PLACES.
    IF gd_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
Now you can download table 'it_mess_att' at location you wish.
Hope this resolves your query.
Susanth.

Similar Messages

  • CONVERT_OTFSPOOLJOB_2_PDF is not working with more than 200 pages

    HI all,
    i am trying to print out Inspection Results (OTFs generated by QGA3 Transaction) via the CONVERT_OTFSPOOLJOB_2_PDF funtion module.
    But if the Inspection Results have more than 200 pages the FM only creates a PDF without content.
    The PDF is there but it has 0 bytes.
    This is how i fill the FM:
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid              = i_spool
                  no_dialog                = 'X'
             IMPORTING
                  pdf_bytecount            = wl_numbytes
                  pdf_spoolid              = wl_pdfspoolid
                  btc_jobname              = wl_jobname
                  btc_jobcount             = wl_jobcount
             TABLES
                  pdf                      = tl_pdf
             EXCEPTIONS
                  err_no_otf_spooljob      = 1
                  err_no_spooljob          = 2
                  err_no_permission        = 3
                  err_conv_not_possible    = 4
                  err_bad_dstdevice        = 5
                  user_cancelled           = 6
                  err_spoolerror           = 7
                  err_temseerror           = 8
                  err_btcjob_open_failed   = 9
                  err_btcjob_submit_failed = 10
                  err_btcjob_close_failed  = 11.
    Does anyone have an idea ?
    Thanks and Regards
    Volker

    That's because the function reverts to background processing when the page size is over 99 pages (see the code).  I posted how to handle this a while back but basically you can either use RSPO_RETURN_SPOOLJOB directly or you can continue to use your current function but you have to poll for the completion of the job (BP_JOB_STATUS_GET) and then get the resulting spool in RAW format with RSPO_RETURN_SPOOLJOB then convert it:
    FIELD-SYMBOLS: <fs_line> TYPE x.
    DATA: gv_pdf TYPE xstring.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = p_spono
        desired_type         = 'RAW'
      TABLES
        buffer               = gt_buffer
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.
    LOOP AT gt_buffer INTO gs_buffer.
      ASSIGN gs_buffer TO <fs_line> CASTING TYPE x.
      CONCATENATE gv_pdf <fs_line> INTO gv_pdf IN BYTE MODE.
    ENDLOOP.

  • Regarding 'CONVERT_OTFSPOOLJOB_2_PDF'

    Hi Folks
       I am using the following code for my requirement:
    data: SPOOLNO LIKE TSP01-RQIDENT value '24841'.
      DATA: NUMBYTES TYPE I.
      data :pdfspoolid like tsp01-rqident,
            jobname like tbtcjob-jobname,
            jobcount like tbtcjob-jobcount.
      DATA: PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
      tables: tsp01.
      select single * from tsp01 where rqident = spoolno.
      if sy-subrc <> 0.
        WRITE: / 'Spoolauftrag existiert nicht'(003)
                COLOR COL_negative.
        exit.
      endif.
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spoolno
              NO_DIALOG                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              PDF_BYTECOUNT                  = numbytes
              PDF_SPOOLID                    = pdfspoolid
          OTF_PAGECOUNT                  =
              BTC_JOBNAME                    = jobname
              BTC_JOBCOUNT                   = jobcount
            TABLES
              PDF                            = pdf
            EXCEPTIONS
              ERR_NO_OTF_SPOOLJOB            = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DSTDEVICE              = 5
              USER_CANCELLED                 = 6
              ERR_SPOOLERROR                 = 7
              ERR_TEMSEERROR                 = 8
              ERR_BTCJOB_OPEN_FAILED         = 9
              ERR_BTCJOB_SUBMIT_FAILED       = 10
              ERR_BTCJOB_CLOSE_FAILED        = 11.
      tables : soli.
      tables : ZPSDSALREP.
      DATA: g_tline(1000) TYPE c.
      DATA: g_email     type string.
      DATA: g_sender    TYPE string.
      types: begin of type_mail,
              mail type soli-line,
             end of type_mail.
      data: i_mail type standard table of type_mail,
            wa_mail type type_mail.
      data: v_email type soli-line.
      data: v_email1 type soli-line.
      DATA: l_adrnr LIKE kna1-adrnr.
      DATA: L_OBJKY TYPE NAST-OBJKY.
      data: l_ZZTERRMG type ZPSDSALREP-ZZTERRMG.
      data: l_ZSUPERVISOR type ZPSDSALREP-ZSUPERVISOR.
      data: l_kunnr type kna1-kunnr.
      data: l_kunnr1 type vbak-kunnr.
      select single kunnr from vbak into l_kunnr1
             where vbeln = nast-objky.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr1.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email
             WHERE addrnumber = l_adrnr.
      select single ZZTERRMG from ZPSDSALREP into l_ZZTERRMG
             where ZZSALESREP = l_kunnr1.
      select single ZSUPERVISOR from ZPSDSALREP into l_ZSUPERVISOR
          where  ZZTERRMG = l_ZZTERRMG.
      select single kunnr from kna1 into l_kunnr
            where sortl = l_zsupervisor.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email1
             WHERE addrnumber = l_adrnr.
      wa_mail-mail = v_email.
      append wa_mail to i_mail.
      wa_mail-mail = v_email1.
      append wa_mail to i_mail.
      DATA: l_id TYPE string.
      LOOP AT i_mail into wa_mail.
        g_email = wa_mail-mail..
        l_id = syst-sysid.
        CONCATENATE 'SAP' l_id '@ucb-group.com' INTO g_sender.
        CALL FUNCTION 'EFG_GEN_SEND_EMAIL'
          EXPORTING
            i_title                = 'Order Confirmation - Email'
            i_sender               = g_sender
            i_recipient            = g_email
            i_flg_commit           = 'X'
            i_flg_send_immediately = 'X'
          TABLES
            i_tab_lines            = pdf.
        IF sy-subrc <> 0.
        ENDIF.
      ENDLOOP.
    Here I am getting 2 major errors:
    1: I am not getting the proper result as PDF . I am getting the PDF with junk data.
    2. With the FM : 'EFG_GEN_SEND_EMAIL' I am getting the Dump stating that
    Short text of error message:
    Internal error: Parameter I_RECIPIENT was not supplied in FM EFG_GEN_SEN
    D_EMAIL
    Technical information about the message:
    Diagnosis
         A parameter of a function module was not supplied.
    System Response
         The system cannot continue processing.
    Procedure
         Create an OSS message with the following details:
         o   Name of the function module
         o   Transaction
         o   Entries that led to the error
    Message classe...... "EZ"
    Number.............. 800
    Variable 1.......... "I_RECIPIENT"
    Variable 2.......... "EFG_GEN_SEND_EMAIL"
    Variable 3.......... " "
    Variable 4.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    error decription.
    Gurus Please suggest me where I am getting wrong.
    <b>Points are assured for correct and helpful answers.</b>
    Regards,
    Sreeram

    Hi
      It's Answered.

  • Insufficient Data for an Image error with Adobe CONVERT_OTFSPOOLJOB_2_PDF

    We are using the standard function module CONVERT_OTFSPOOLJOB_2_PDF to
    print a standard invoice to the spool and convert it to a PDF. This
    PDF is displayed on the web by directing the output of this function module to Adobe Reader.
    We are having a production problem where suddenly these PDFs will not
    print, and are displaying the error message "Insufficent data for an
    image" with Adobe Reader. While a partial PDF is displayed, some of
    the data is missing.  It appears that the image that is being complained about is a company logo, and the pdf also does not display some additional characters.
    We saw this data 2 years ago in production, but it suddenly went away
    after a few days. Suddenly it is back.
    The issue can be easily replicated in our Dev system and Prd system,
    but Tst is acting fine.
    Has anyone ever seen this error?  Any advice on what may be occurring would be a huge help with this production problem.
    Todd Murphy
    The Hershey Company

    Haven't seen that error before.  How are you converting the data after the function call if at all, i.e., are you moving to an XSTRING before handing it off to the web app?
    The things I would suggest which may be stating the obvious are:
    - Download the PDF locally after conversion with GUI_DOWNLOAD and check for the error
    - Does the same issue occur with program RSTXPDFT4 or fm RSPO_RETURN_SPOOLJOB or a SAPOffice (direct) conversion?
    - Remove the logo and try and/or take the original logo, reconvert it to BMP and upload it again in SE78
    - What happens if you change the destination device in the call, if anything?
    - Does OSS note 1320163 apply?

  • CONVERT_OTFSPOOLJOB_2_PDF / CONVERT_ABAPSPOOLJOB_2_PDF

    Hi,
    I have written a function module which calls CONVERT_OTFSPOOLJOB_2_PDF & CONVERT_ABAPSPOOLJOB_2_PDF depending on whether the input is OTF (SAPScript) or ABAP (text).
    Now my question :
    The PDF works fine with lower versions of Adobe, but it seems to be incompatible with higher versions of Adobe.
    Is there a way to make CONVERT_OTFSPOOLJOB_2_PDF & CONVERT_ABAPSPOOLJOB_2_PDF compatible with higher versions of Adobe, or is there any other standard function module which can support higher versions of PDF.
    SAP version which I am using is 4.0,
    Thanks in advance.

    if we craete spools from scripts or smart forms, OTF spool will be created
    TO CONVERT otf SPOOL TO PDF WE USE
    CONVERT_OTFSPOOLJOB_2_PDF and
    if we craete spools from REPORTS, ABAP spool will be created
    TO CONVERT ABAP SPOOL TO PDF WE USE
    CONVERT_ABAPSPOOLJOB_2_PDF
    Reward if useful

  • What parametrs i have to pass in CONVERT_OTFSPOOLJOB_2_PDF (fm) to convert

    Hii All
    Can any body help me What parametrs i have to pass in CONVERT_OTFSPOOLJOB_2_PDF function  to convert all the copies of a spool request into pdf. Suppose a spool request have three copies.
    Thanks
    Viki

    Hi Vikas,
    There is standard report available in SAP to convert spool jobs to PDF. The report is RSTXPDFT4. This report also uses the FM CONVERT_OTFSPOOLJOB_2_PDF, you can check for the parameters there itself.
    Reward points if useful.
    Thanx & Rgds.

  • CONVERT_OTFSPOOLJOB_2_PDF ?

    Hi all,
    When I developed smartform I kept particular printer in mind. Now since the client wants to print it on diffrenet printers, the allignment is going to change.
    I came to know about a function called, CONVERT_OTFSPOOLJOB_2_PDF which will convert the spool jobs in pdf file. Now my question is how do I implement this function in smartforms so that whenever it goes for print through spool it will get conveterted in pdf format so that allignmnet willot change whatever may be the printer ?

    Hi,
    in the smartforom interface
        I_SSFCTRLOP-getotf = 'X'.
    FORM SAVE_TO_PDF TABLES ZOFTDATA STRUCTURE ITCOO.
      data:
            ZPDF LIKE TLINE OCCURS 100 WITH HEADER LINE,
            NUMBYTES TYPE I.
      call function 'CONVERT_OTF'
           EXPORTING
                FORMAT                = 'PDF'
                MAX_LINEWIDTH         = 132
           IMPORTING
                BIN_FILESIZE          = NUMBYTES
           TABLES
                OTF                   = ZOFTDATA
                LINES                 = ZPDF
           EXCEPTIONS
                ERR_MAX_LINEWIDTH     = 1
                ERR_FORMAT            = 2
                ERR_CONV_NOT_POSSIBLE = 3.
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                BIN_FILESIZE            = NUMBYTES
                FILENAME                = FILEPDF
                FILETYPE                = 'BIN'
           IMPORTING
               ACT_FILENAME            = FILEPDF
                FILESIZE                = NUMBYTES
           TABLES
                DATA_TAB                = ZPDF
           EXCEPTIONS
                OTHERS = 9.
    endform.

  • CONVERT_OTFSPOOLJOB_2_PDF doesn't work correct

    Dear all,
    We faced the following problem after upgrade SAP_APPL to 17 level and SAP_BASIS to 21:
    FM CONVERT_OTFSPOOLJOB_2_PDF stopped working as it should. The data seems to be converted in wrong coding and generated PDF-file can not be opened. Does anybody knows the possible reason? May me some further upgrades are needed?
    Thank you very much for your help,
    Tatiana

    Dear all,
    Thank you very much for your answers. They helped me to realize, that the problem is not in FM CONVERT_OTFSPOOLJOB_2_PDF. This FM works correctly, because it is used in the program RSTXPDFT4 and I was able to download PDF-file to my PC with the help of this program and it looks fine. The real problem is, that PDF-file should be sent as attachments per FM 'SO_NEW_DOCUMENT_ATT_SEND_API1', but the file could not be opened by the user. The error message is "There was an error opening the document. The file is damaged and could not be repaired".
    Do you have any ideas? Thank you in advance.

  • Difference between CONVERT_OTFSPOOLJOB_2_PDF and CONVERT_ABAPSPOOLJOB_2_PDF

    Hi All,
    Can some body let me know what is the exact difference between these 2 function module as I know both are used to convert spool request number to PDF but I want to know what is the exact difference between these 2 fun module?what is meant by OTF format?
    Thanks in advance
    Ramesh

    if we craete spools from scripts or smart forms, OTF spool will be created
    TO CONVERT otf SPOOL TO PDF WE USE
    CONVERT_OTFSPOOLJOB_2_PDF and
    if we craete spools from REPORTS, ABAP spool will be created
    TO CONVERT ABAP SPOOL TO PDF WE USE
    CONVERT_ABAPSPOOLJOB_2_PDF
    Reward if useful

  • Spool to PDF conversion CONVERT_OTFSPOOLJOB_2_PDF

    Hi All,
    I am using the function module CONVERT_OTFSPOOLJOB_2_PDF to convert spool into the PDF file  in BSP.
    I am getting correct output for the other language but only for greek I am not getting correct output even spool is correct.
    Regards
    Sagar

    Issue Resolved.

  • Function Module : CONVERT_OTFSPOOLJOB_2_PDF / CONVERT_ABAPSPOOLJOB_2_PDF

    My question :
    What is the version of the PDF that is generated using this function module.
    Can this function module be used to generate a higher version of PDF (Adobe document)
    Thanks.

    Hi Sathish,
    Seems like a problem of the Adobe lifecycle version you are using. However, you can try the following function module once:
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 256
    *   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
    It works 100% in normal situations but if it doesn't in your case then this has to be related to the configuration part. Hope it helps.
    Best Regards,
    Atanu Mukherjee

  • Error while opening a pdf file sent as an attachment in mail

    Dear All,
            We have converted a alv grid into pdf and sent a mail with the attached pdf file. When the attachment is opened in the received mail we get an error " File does not begin with %pdf-". I am pasting the code.
    Select single
      from
        TSP01
      where
        RQIDENT = wa_listident.
      if sy-subrc <> 0.
         exit.
      endif.
      client = tsp01-rqclient.
      name   = tsp01-rqo1name.
    *BREAK-POINT.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  AUTHORITY     = 'SP01'
                  CLIENT        = client
                  NAME          = name
                  PART          = 1
             IMPORTING
              CHARCO        =
              CREATER       =
              CREDATE       =
              DELDATE       =
              MAX_CREDATE   =
              MAX_DELDATE   =
              NON_UNIQ      =
              NOOF_PARTS    =
              RECTYP        =
              SIZE          =
              STOTYP        =
                  TYPE          = type
                  OBJTYPE       = objtype
             EXCEPTIONS
                  FB_ERROR      = 1
                  FB_RSTS_OTHER = 2
                  NO_OBJECT     = 3
                  NO_PERMISSION = 4.
      if objtype(3) = 'OTF'.
        is_otf = 'X'.
      else.
        is_otf = space.
      endif.
    *BREAK-POINT.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
             EXPORTING
                  rqident              = wa_listident
                  desired_type         = desired_type
             IMPORTING
                  real_type            = real_type
             TABLES
                  buffer               = l_objcont
             EXCEPTIONS
                  no_such_job          = 14
                  type_no_match        = 94
                  job_contains_no_data = 54
                  no_permission        = 21
                  can_not_access       = 21
                  read_error           = 54.
        IF sy-subrc EQ 0.
          attach_type = real_type.
        ENDIF.
    if is_otf = 'X'.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = wa_listident
              NO_DIALOG                      = c_no
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              PDF_BYTECOUNT                  =  gd_bytecount
              PDF_SPOOLID                    = pdfspoolid
          OTF_PAGECOUNT                  =
              BTC_JOBNAME                    = jobname
              BTC_JOBCOUNT                   = jobcount
            TABLES
              PDF                            = it_pdf_output
            EXCEPTIONS
              ERR_NO_OTF_SPOOLJOB            = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DSTDEVICE              = 5
              USER_CANCELLED                 = 6
              ERR_SPOOLERROR                 = 7
              ERR_TEMSEERROR                 = 8
              ERR_BTCJOB_OPEN_FAILED         = 9
              ERR_BTCJOB_SUBMIT_FAILED       = 10
              ERR_BTCJOB_CLOSE_FAILED        = 11
      CHECK sy-subrc = 0.
      ENDIF.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Please guide me to resolve this issue.
    Thanks & Regards,
    Anand

    Hi,
    is the next part of the code correct.
    What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
    You can also try below link..
    Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    Hope this helps.
    Regards,
    -Sandeep

  • No Data in PDF file in FTP server

    Hi All,
    I am trying to place a PDF file in FTP server.
    Used
    CONVERT_OTFSPOOLJOB_2_PDF to convert spool to PDF
    SCMS_TEXT_TO_XSTRING
    FTP_R3_TO_SERVER to transfer data to FTP.
    I am able to see PDF file in FTP and no of pages matches with that of R/3 but there is no data in PDF file.

    To get pdf file , you need to set the itcpo-tdgetotf = 'X' and need to pass in the exporting parameter (options in open_form  function module ).Then in close_form function module take all the data of otfdata table into an internal table . Then use SX_OBJECT_CONVERT_OTF_PDF function module to convert it to pdf.
    I will show with an  example.
    tables itcpo.
    DATA: ch_otf  TYPE  STANDARD  TABLE OF  itcoo.
    DATA: w_otf TYPE itcoo.
    DATA: w_pdf TYPE solisti1. "For PDF
    DATA: i_content_txt TYPE soli_tab.   
    DATA: temp1 TYPE sx_format VALUE 'OTF',
            temp2 TYPE sx_format VALUE 'PDF'.
      DATA: c_printer TYPE sx_devtype VALUE 'PRINTER'.
      DATA: w_transfer_bin TYPE sx_boolean. "Content
      DATA: i_content_bin TYPE solix_tab, "Content
            wa_content_bin TYPE solix,
            i_objhead TYPE soli_tab.
    itcpo-tdnoprint  = 'X'.
      itcpo-tdpreview = 'X'.
      itcpo-tdgetotf = 'X'.
    These three parameters need to be passed along with other required parameters
      CALL FUNCTION 'OPEN_FORM'
           EXPORTING form = xformular
                     language = ekko-spras
                     OPTIONS = itcpo
                     archive_index  = toa_dara
                     archive_params = arc_params
                     device = xdevice
                     dialog = xdialog
                     mail_sender        = sender
                     mail_recipient     = recipient
           EXCEPTIONS canceled = 01.
      CALL FUNCTION 'CLOSE_FORM'
        IMPORTING
          RESULT  = RESULT
        tables
          otfdata = ch_otf.
    LOOP AT ch_otf INTO w_otf.
        CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
        INTO w_pdf.
        APPEND w_pdf TO i_content_txt.
      ENDLOOP.
    converting otf file to pdf file
      CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
        EXPORTING
          format_src      = temp1        "'OTF'
          format_dst      = temp2        "'PDF'
          devtype         = c_printer
        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.
    Then open dataset and transfer to ftp of the content of table content_bin(i_content_bin) as shown in above example.
    I think this will be helpful for you

  • Error while downloading PDF file from FTP Server

    Hi Friends,
    I have sent a PDF file with data to FTP , Then i want to check that uploaded pdf file , whether that is correct or not?
    for that , i have downloaded that file from FTP and i am trying to open the file . but it is giving this problem .
    "There was an error opening the document . The file is damaged and could not be repaired."
    will you suggest me regarding this.
    thanks in advance.
    balaji.T.

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
           SRC_SPOOLID                    = spoolno
                src_spoolid                    = wa_file-rqident
                no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
              IMPORTING
                pdf_bytecount                  = numbytes
                pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
                btc_jobname                    = jobname
                btc_jobcount                   = jobcount
              TABLES
                pdf                            = pdf
              EXCEPTIONS
                err_no_otf_spooljob            = 1
                err_no_spooljob                = 2
                err_no_permission              = 3
                err_conv_not_possible          = 4
                err_bad_dstdevice              = 5
                user_cancelled                 = 6
                err_spoolerror                 = 7
                err_temseerror                 = 8
                err_btcjob_open_failed         = 9
                err_btcjob_submit_failed       = 10
                err_btcjob_close_failed        = 11.
    because of this one PDF internal table is obtained.
           OPEN DATASET L_FILENAME  FOR OUTPUT in text mode  MESSAGE MSG.
      LOOP AT pdf.
        CONCATENATE pdf-tdformat       "Material group
                     pdf-TDLINE       "Basic Material
               INTO ITEXT-TLINE ..
        APPEND ITEXT.
        TRANSFER ITEXT TO L_FILENAME.
      ENDLOOP.

  • Facing problem with logo in the PDF attachment when sending mail...

    hi friends,
    i'm facing problem with logo in the PDF attachment to the mail.
    my requirement:
    1. enter spool number and mail id in the selection screen.
    process:
    1. now the program will fetch the spool data and converts it to PDF.
    2. but when i'm trying to send mail with this PDF as attachment.
    when i open the PDF file from the mail, logo is not coming properly (looks disturbed).
    can anyone help me how to resolve this issue...
    thanks in advance, murashali.

    hi dinakar, thanks for your mail...
    logo looks good in spool/script/smartform.
    even it look good when i download this spool to pdf and to the presentation server as pdf file.
    i'm using CONVERT_OTFSPOOLJOB_2_PDF.
    when i used CONVERT_ABAPSPOOLJOB_2_PDF, is gives a msg - 'spool number not found'.
    here i'm using folloing code to pass pdf to the function module: SO_NEW_DOCUMENT_ATT_SEND_API1.
    code:
    Transfer the 132-long strings to 255-long strings
      lt_mtab_pdf[] = pdf[].
      LOOP AT lt_mtab_pdf INTO lwa_mtab_pdf.
        TRANSLATE lwa_mtab_pdf USING ' ~'.
        CONCATENATE lv_gd_buffer lwa_mtab_pdf INTO lv_gd_buffer.
        CLEAR lwa_mtab_pdf.
      ENDLOOP.
      TRANSLATE lv_gd_buffer USING '~ '.
      DO.
        lwa_mess_att = lv_gd_buffer.
        APPEND lwa_mess_att TO lt_mess_att.
        CLEAR lwa_mess_att.
        SHIFT lv_gd_buffer LEFT BY 255 PLACES.
        IF lv_gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    NOTE: problem i believe is with ''.  i'm getting this tilt symbol () in my pdf internal table.  here in the above code the line   TRANSLATE lv_gd_buffer USING '~ ' is changing the existing tilt to space.  so my logo is getting disturbed.
    even i tried with REPLACE this tilt with other char, but it doent work.
    can you give any idea...

Maybe you are looking for