How to convert script o/p to pdf o/p

Hi All,
    I have a requirement where i need to convert script output to pdf output. What is the function moodule available ? Please help me in this regard asap.
Regards
Lakshmi

Hi,
Try this sample code and reward points by clicking the star on the left of reply,if it helps you.
REPORT  zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
        pernr TYPE pa0001-pernr,
        bukrs TYPE pa0001-bukrs,
        werks TYPE pa0001-werks,
        END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001,  "For pa0001 Details
       i_otf TYPE STANDARD TABLE OF itcoo,         "For OTF data
       i_content_txt TYPE soli_tab,                "Content
       i_content_bin TYPE solix_tab,               "Content
       i_objhead TYPE soli_tab,
Work Area Declaration
       w_pa0001 TYPE ty_pa0001,                    "For pa0001 Details
       w_res TYPE itcpp,                           "SAPscript output
                                                   "parameters
       w_otf TYPE itcoo,                           "For OTF
       w_pdf TYPE solisti1,                        "For PDF
       w_transfer_bin TYPE sx_boolean,             "Content
       w_options TYPE itcpo,                       "SAPscript output
                                                   "interface
Variable Declaration
       v_len_in TYPE so_obj_len,
       v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X',                         "X
            c_locl(4) TYPE c VALUE 'LOCL',                "Local Printer
            c_otf TYPE sx_format VALUE 'OTF',             "OTF
            c_pdf TYPE sx_format VALUE 'PDF',             "PDF
            c_printer TYPE sx_devtype VALUE 'PRINTER',    "PRINTER
            c_bin TYPE char10 VALUE 'BIN',                "BIN
            c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
                                                          "File Name
            c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'.        "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
  SELECT pernr bukrs werks FROM pa0001
  INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
  w_options-tdcopies   = 1 ."Number of copies
  w_options-tdnoprev   = c_x."No print preview
  w_options-tdgetotf   = c_x."Return of OTF table
  w_options-tddest     = c_locl."Spool: Output device
Opening the form
  CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      form     = c_form
      device   = c_printer
      language = sy-langu
      OPTIONS  = w_options
    IMPORTING
      RESULT   = w_res.
  LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        element = 'MAIN'
        window  = 'MAIN'.
  ENDLOOP.
Closing the form
  CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                   = w_res
    TABLES
      otfdata                  = i_otf
    EXCEPTIONS
      unopened                 = 1
      bad_pageformat_for_print = 2
      send_error               = 3
      spool_error              = 4
      codepage                 = 5
      OTHERS                   = 6.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Converting OTF data to single line
  LOOP AT i_otf INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
                                      INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
  ENDLOOP.
Converting to PDF Format
  CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
      format_src      = c_otf
      format_dst      = c_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.
  v_size = v_len_in.
Downloading the PDF File
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      bin_filesize = v_size
      filename     = c_name
      filetype     = c_bin
    TABLES
      data_tab     = i_content_bin.

Similar Messages

  • How to convert internal table data to PDF format

    HI,
         I have an internal table data having one field with 255 chars. length.I want to send that intenal table data as attachemnt with external mail. i am thinking of converting that data into PDF format and use the FM to send the mail. How to convert internal table data to PDF format.
    Kishore

    In which format is your data in the internal table currently. Is it returned by a smartform/script or its just data fetched from some database table into an internal table. Since its obvious that the data should appear in the PDF with some Layout, you should be using smartform to format the data properly. See the Link
    Smartform to PDF to EMAIL
    This shows convertion of smartform to pdf and send it through email
    Regards,
    Abhishek

  • How to convert XPS file to a PDF one via Adobe Acrobat XI Pro with command line?

    Hello,
    How to convert XPS file to a PDF one via Adobe Acrobat XI Pro with command line?

    It is not good. If I need to export some hundred of separate *.XPS files to hundred separate *.PDF files, I need to do this manually with each file. It is stone age.

  • How to convert a .alsx file into pdf

    How to convert a .alsx file into pdf
    Iam facing this problem since many days please resolve it
    http://www.roothow.com
    Thankls in adavance

    >But, from the windows explorer, if i do a right clic on the word document, with the context menu, i can directly convert to PDF
    This is equivalent to using the PDFMaker facility in Word - that is,
    the Acrobat button. Which is also the same thing that is done when you
    use File > Create PDF > From File in Acrobat.
    What it does is print to a PS file *and* do a lot of additional
    processing to write stuff about links, tags etc. into the PS file.
    >(no tmp PS file is used, cause the links are still working).
    This isn't true, but it's certainly the case that you won't get links.
    There seems to be no API, via any mechanism, still less the "obsolete"
    (Microsoft's view) command line, to use PDFMaker from your program.
    Aandi Inston

  • How to convert Scripts to Smartforms

    Hi..
            "How to convert Scripts to Smartforms "
               I know one method goto  Tcode Smartforms  and click on Utility ->Migratioin->Import Sap Script form
                But my Team lead told me another method is there then  you use that method.
              I don't know that..
               Could any one tell the another method
    Regards,
    Gowri

    Hi!
    use the function module  FB_MIGRATE_FORM to convert SAP script in to Smart froms.. but here one thing to remember it copeies only the layout set..
    I hope this answer will help you
    Regards,
    Kiran

  • Converting Script from OTF to PDF format

    Hi Experts,
    Using FM CONVERT_OTF in SAP Script print program I am converting data of Script from OTF to PDF format but the data in PDF document srinks and looks like slightly overlapping one leter on the other, can any ony please tell me that how can I avaoid this.
    Thanks in Advance
    Best Regards
    Venkat

    Dear Venkatesh,
    I have the same scenario. I have to convert Script to PDF and then write it to FTP Server.
    Could you please provide me the code which you have used?
    Regards,
    Chaitanya A

  • How to convert a word document to PDF from a criteria workflow

    Hi,
    How to create a new revision in PDF format from a word document inside a criteria workflow? The inbound refinery converts documents to PDF automatically upon check-in, but I want to make the conversion in a specific step of a workflow.
    Thanks,
    Miguel

    You could write a custom service and execute it within the workflow script using the executeService Idoc function.

  • How to convert script output to excel and send through mail in the report

    I need a solution for Converting script into EXCEL  and sending Excel as a attachment to the mail. In my current Program I am getting OTF data from script and converting into PDF using Function module ' CONVERT_OTF'
    And sending PDF as a mail attachment using Function module 'SO_NEW_DOCUMENT_SEND_API1' it is working fine but
    My current requirement is I need to send Excel as a mail attachment instead of PDF.
    Hope it is clear for you, please give me possible solutions with sample code..

    hi
    good
    CONSTANTS: CON_CRET TYPE X VALUE '0D',  "OK for non Unicode
                 CON_TAB TYPE X VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO IT_ATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.
      APPEND  IT_ATTACH.
      LOOP AT IT_EKPO INTO WA_CHAREKPO.
        CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
                    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
               INTO IT_ATTACH SEPARATED BY CON_TAB.  " Check here
        CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.  " Check here
        APPEND  IT_ATTACH.
      ENDLOOP.
    thanks
    mrutyun^

  • How to convert message in XI into PDF format

    Hi,
    I am trying out a scenario where i am getting an idoc from SAP into XI and now in XI i need to convert the data into pdf format and send that pdf in a mail using mail adapter.
    Can any body help me out how to convert a message in XI to pdf format.
    Thanks in Advance!!
    Regards,
    Sudheer

    Hi Sudheer
    follow these links
    http://www.erpgenie.com/sap/sapedi/Conversion%20of%20IDOCs%20to%20XML%20format.pdf
    Here is the complete code for you;
    It Converts spool request into PDF document and emails it.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Smartform as attachment in mail. - 46k
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/convert-smartforms-form-in-pdf-998715 - 87k
    SMART form to PDF
    https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertSmartformtoPDFformat
    smartform to MAIL
    https://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment
    Regards
    Sandeep Sharma
    PS: if helpful kindly reward points

  • How to convert my whole website into PDF

    I have my own blog. How can I convert my whole blog into pdf for backup ?

    I am also looking for exact answer to backup my content of blog into PDF. So, How should I do for my blog ? Is there any software or tools for it?

  • How to convert Microsoft Publisher publication to PDF?

    How to convert Microsoft Publisher 2003 publication to a PDF?

    Moved to Creating, Editing & Exporting PDFs.
    That depends upon the version of Acrobat you have. With any version you can always print to PDF. Some versions of Acrobat will support special conversion options for Publisher.

  • How to convert an HTML form to PDF

    Is there any way to convert HTML page (with text boxes,radio/submit buttons) into a PDF file so form can be entered in a PDF format??

    DanCrintea wrote:
    HTML to PDF with Java, using OpenOffice.org - example here: [http://www.dancrintea.ro/html-to-pdf/|http://www.dancrintea.ro/html-to-pdf/]
    You can use OpenOffice.org, running as a server and command it remotely for document convertion.
    Besides HTML to PDF, there are also possible other convertions:
    doc --> pdf, html, txt, rtf
    xls --> pdf, html, csv
    ppt --> pdf, swf
    Code example:
    import officetools.OfficeFile; // this is my tools package
    FileInputStream fis = new FileInputStream(new File("c:/test.html"));
    FileOutputStream fos = new FileOutputStream(new File("c:/test.pdf"));
    // suppose OpenOffice.org runs on localhost, port 8100
    OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
    f.convert(fos,"pdf");
    -----------------------------------------------------------------------------------------------------------------------------------------You really think this is a good way to market your crappy product?

  • How to convert Apple Mail email to pdf

    I'm a relative Acrobat Pro beginner.
    Like to convert emails to text recognized pdf files. Is it possible?
    I've tried using Print and then Save as a PDF in Apple Mail.  However, I can't text recognize the resulting pdf or convert to one. Keeps giving error message that can't convert the images.
    Probably pdf 101 that I'm missing. :-(
    Thanks for any tips.

    The only way that I am aware of is to purchase and download either Microsofts version of Office or Outlook Stand alone for Mac. Or if you prefer you can download Open Office that is FREE and is Oen Source and has all the features of Microsoft's
    http://www.openoffice.us.com/openoffice/free-open-office-download-yahoo.php?pk=8 45397
    To just pay for Outlook is a little steep for most users. I think you will find using a WEB Based e-Mail will work much better for you like GMail or YahooMail rather than having it on your machine use there servers and they have many more features.
    Cheers
    Don

  • Dynamicaly how to convert script to pdf

    Hi All,
      I have a requirement ,at single time execution of a print program it will display script to pdf file. In this print program many layouts are there. In this case how to do .Please help me.
    Thanks
    Raghava

    hi
    check these links
    [https://www.sdn.sap.com/irj/scn/forums]
    [OTF  -> PDF;
    regards
    rajye
    pls close the thread if its resolved.

  • How to convert an excel sheet as pdf  and sent mail?

    Hi,
    I have to open an excel file from report and display a value in a cell, based on that value in excel, macros will automatically trigger and the remaining data will fill in excel sheet.
    This sheet i need to convert as pdf and sent as attachment to mail.
    Regards,
    Shree

    Hi,
    I know how to do with word documents using OLE.  But i dont know how to work with Excel sheets.
    I have worked on word documents like displaying data in word document from SAP and saving it into local system.
    But here my requirement is i need to pass pernr to a cell in an Excel sheet, based on pernr in excel some macros will trigger and fill the details. After that, the filled sheet i need to convert as pdf and sent as mail.
    Regards,
    Shree.

Maybe you are looking for