How to directly print PDF file(which is stored in SAP) in ABAP report?

Hi experts,
I searched SDN for printing PDF file but everything is about OTF to PDF and to use fm: CONVERT_OTF which is not the solution for my problem.
I have to build ABAP report which will take the PDF file attached to SAP document (CV02N) and print it.So, which function module or program can I use to print the PDF file?
Thank you very much.
Kind regards,
Danijela

Dear
   this is the code for down load smartform for PDF format. its working properly
2nd way is
set your Acrobat Printer as your default printer
when you print select printer as LOCAL
then you will file dialog box for Naming PDF
DATA  :  T_OTF          TYPE ITCOO OCCURS 0 WITH HEADER LINE.
  DATA  :  WA_CTRLOP      TYPE SSFCTRLOP.
  DATA  :  WA_OUTOPT      TYPE SSFCOMPOP.
  DATA  :  T_OTFDATA      TYPE SSFCRESCL.
  DATA  :  T_PDF_TAB      LIKE TLINE OCCURS 0 WITH HEADER LINE.
  DATA  :  V_FILESIZE     TYPE I.
  DATA  :  W_BIN_SIZE     TYPE I.
  WA_CTRLOP-GETOTF = 'X'.
  WA_CTRLOP-NO_DIALOG = 'X'.
  WA_OUTOPT-TDNOPREV = 'X'.
  CALL FUNCTION P_LV_FNAME
    EXPORTING
      OUTPUT_OPTIONS     = WA_OUTOPT
      USER_SETTINGS      = 'X'
      CONTROL_PARAMETERS = WA_CTRLOP
    IMPORTING
      JOB_OUTPUT_INFO    = T_OTFDATA
    EXCEPTIONS
      FORMATTING_ERROR   = 1
      INTERNAL_ERROR     = 2
      SEND_ERROR         = 3
      USER_CANCELED      = 4
      OTHERS             = 5.
  T_OTF[] = T_OTFDATA-OTFDATA[].
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      FORMAT                = 'PDF'
      MAX_LINEWIDTH         = 132
    IMPORTING
      BIN_FILESIZE          = W_BIN_SIZE
    TABLES
      OTF                   = T_OTF
      LINES                 = T_PDF_TAB
    EXCEPTIONS
      ERR_MAX_LINEWIDTH     = 1
      ERR_FORMAT            = 2
      ERR_CONV_NOT_POSSIBLE = 3
      OTHERS                = 4.
  DATA  :  LV_DOWN_FILE TYPE RLGRAP-FILENAME.
  DATA  :  LV_TEXT      TYPE STRING.
  CASE SSCRFIELDS-UCOMM.
    WHEN 'REPRUNMOLD'.
      CONCATENATE '(' SO_SCHDT-LOW '-' SO_PLANT-LOW ')' INTO LV_TEXT.
      CONCATENATE '\\lkdb01\FTP-Loadstar\0.PP_Planning\ZPP014\Run_Moulds\' SY-DATUM '-' SY-TIMLO '-' 'Running Mould' '-' LV_TEXT '.pdf' INTO LV_DOWN_FILE SEPARATED BY SPACE.
    WHEN  'REPLINESIT'.
      CONCATENATE '(' SO_SCHDT-LOW '-' SO_PLANT-LOW '-' SO_LINE2-LOW ')' INTO LV_TEXT.
      CONCATENATE '\\lkdb01\FTP-Loadstar\0.PP_Planning\ZPP014\Line_Situation\' SY-DATUM '-' SY-TIMLO '-' 'Line Situation' '-' LV_TEXT '.pdf' INTO LV_DOWN_FILE SEPARATED BY SPACE.
  ENDCASE.
  CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE            = W_BIN_SIZE
      FILENAME                = LV_DOWN_FILE
      FILETYPE                = 'BIN'
    IMPORTING
      FILELENGTH              = V_FILESIZE
    TABLES
      DATA_TAB                = T_PDF_TAB
    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  'File not downloaded succesfully' TYPE 'I'.
    EXIT.
  ELSE.
    MESSAGE 'PDF File downloaded succesfully' TYPE 'I'.
  ENDIF.
ENDFORM.                    " Print_PDF
Rewards if useful.

Similar Messages

  • How to Attach a pdf file which is created in EP while sending the mail

    Hi guys,
    My scenario is, " A form is created in the EP and a HR person give the input/mandatory field employee number in that form so he gets the details of the employee and he edit some of the fields in the form and he gives his comments, then he press "submit" button."
    Note: The edited fields are not stored in any table.
    At this point my workflow will trigger using the event "POSITIONCHANGE" using the business object "BUS1065". Now i have to send a notification to 5 persons along with the pdf form as a attachment which is created by the initator in a display mode.
    My Questions are:
    1. How can i get that pdf form which is created by the intiator in EP to my workflow.
    2.Then how can i attach this form in the mail.

    I got the pdf into my workflow in a binary data and i passed this binary data to the function module so_document_attacthment_ap1.
    in that i am specifing that the file type is .pdf and i received mail with the pdf attachment too.

  • How to duplex print pdf file on hp 1320 using upd pcl5 on windows 7 ?

    I am running Windows 7 Professional (64bit), with a HP laserjet 1320 using driver HP UPD PCL5 (v5.5.0.12834), with Adobe Acrobat 9 Pro v9.5.2 and MS Word 2010. When I print a Word 2010 file I can choose duplex printing (print on both sides) and everything works fine. However, when I open a PDF file, click FILE then PRINT then PROPERTIES the PRINT ON BOTH SIDES option shows "none" and no other option is shown. I searched Adobe support and it says duplex printing is controlled by the printer driver, not Adobe software. I have uninstalled & reinstalled the UPD PCL 5 driver two times already but still the same problem of not being able to choose duplex printing for any PDF document - yet it works for MS Word. Any ideas ? Thanks 

    How do I duplex print on an HP 1320 printer that uses windows 7 (64 bit) system?

  • How to upload a PDF-file and send it by SAP Mail

    Hi,
    we need to attach a pdf-file to an email send by SAP. The file is stored in a SAP-directory. When I use Open dataset to get the file it works but when sent by email the file could not be opened. I guess that perhaps I have to use other parameters to get the PDF in a correct file but I don't know which ones. Here is part of the coding I use for testing:
    TYPES: BEGIN OF typ_pdf,
           line(255),
           END OF typ_pdf.
    DATA: it_pdf TYPE STANDARD TABLE OF typ_pdf,
          wa_pdf LIKE LINE OF it_pdf.
    v_file = '/pool//Test.pdf'.
    OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
    WHILE ( sy-subrc EQ 0 ).
      READ DATASET v_file INTO wa_pdf.
      IF NOT wa_pdf IS INITIAL.
        APPEND wa_pdf TO it_pdf.
      ENDIF.
      CLEAR wa_pdf.
    ENDWHILE.
    CLOSE DATASET v_file.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data             = gd_doc_data
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list                  = it_packing_list
        contents_bin               = it_pdf
        receivers                  = it_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.
    Regards
    Nicola

    Hi Nicola,
    read the pdf from dataset as binary into an XSTRING.
    use function to convert xstring to table.
    Do not use SO_DOC.. function but CL_BCS (see blog 'unknown thus unloved'
    Regards,.
    Clemens

  • How to save the pdf file or word doc into sap table

    Hi Expertu2019s
       I have a pfd file in my presentation server .Now I want to save the pdf file into sap table using module pool program. Whenever i need, I want to open that file from the table and show it in the Screen. Please any one tell me how I can save the file. What is the table name, guide me.
    Regards,
    S.Nehru.

    Hi,
    Try the following code
    FORM gui_upload.
      DATA: lv_filetype(10) TYPE c,
            lv_gui_sep TYPE c,
            lv_file_name TYPE string.
      lv_filetype = 'PDF'.
      lv_file_name = <name of ur file>.
    DATA: tb_file_data TYPE TABLE OF text4096.
    * FM call to upload file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lv_file_name
          filetype                = lv_filetype
          has_field_separator     = lv_gui_sep
        TABLES
          data_tab                = tb_file_data
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "gui_upload
    I dont think you can save the data into sap tables in PDF format.
    With the above code you can save data into an internal table.
    Regards,
    Manish

  • How To Batch Print PDF Files

    Hello Friends.
    I am using Apex 4.1 on Windows 7. My database is Oracle EE 10.2.0.5 on Solaris and OAS as the app server (and so, am using mod_plsql).
    I wrote an application in which I use the PLPDF package to generate PDF screens. Initially, the last few commands in my code looked like:
    owa_util.mime_header('application/pdf',false);
    htp.p('Content-Length: ' || dbms_lob.getlength(l_blob));
    owa_util.http_header_close;    
    wpg_docload.download_file(l_blob);The variable l_blob is the PDF blob object generated by PLPDF. The PDF is being formed from a cursor for loop further up in my code (not displayed here) that is SELECTing from a table. The above code displays the generated PDF on to a popup page in my application. At that point, the user can click the "File->Print" menu to send the displayed PDFF to the default printer.
    However, my requirements are that I may have multiple PDFs generated from my for loop and would like to have each of these PDFs sent to the default printer is one go rather than force the user to have to display and print each one separatlely.
    And so I modified the above code so that the PDFs created by the PLPDF package are being inserted into an Oracle table rather than displayed in a popup page.
    Would any one know how to send each of the PDFs stored in the table to the default printer automagically, perhaps my issuing a ctrl+p command or some such thing.
    Thanks in advance for any help/code/advice.
    Elie

    I tried the following code that which comes directly from the Apex Stored procedure PRINT_PDF.
    The APEX_UTIL.GET_PRINT_DOCUMENT function returns NULL.
    declare
        v_filename varchar2(1000);
        v_pdf_blob blob;
    pnum number;
    begin
    v_filename := 'TEST_' || to_char(sysdate,'yyyymmdd');
    pnum := --Hidden from Post;
    dbms_output.put_line('Security ID: ' || pnum);
    wwv_flow_api.set_security_group_id(p_security_group_id=>nvl(wwv_flow_application_install.get_workspace_id,pnum));
    v_pdf_blob := APEX_UTIL.GET_PRINT_DOCUMENT (
                                           p_application_id      =>  121,
                                           p_report_query_name   => 'QS_CERT_QUERY_TEST',
                                           p_report_layout_name  => 'QS_CERT_QUERY',
                                           p_report_layout_type  => 'xsl-fo',
                                           p_document_format     => 'pdf');
    insert into printed_pdfs (filename, stored_pdf, record_created_By_person, record_created_on_date)
                      values  (v_filename||'.pdf', v_pdf_blob, 'Name', sysdate);
    end;
    Any idea on what is wrong or how to make it work.

  • How do I print PDF files in preview with the added annotations?

    Is there a way to print out the document with the added notes that are next to the slides?

    When you add notations to a PDF document, you need to hit "save" for every page before doing anything else. If you forget to save the changes for each page, they will not re-appear. So, if you save the change, it should then print with your notations.

  • How to send the pdf file....

    How to send the pdf file which is an outpu of smart form to sap users.
    How to delete the pdf file as soon as it was sent.

    Have you checked Forums » Community Discussions » Code Snippets 
    I believe there were some examples on converting/sending PDF.
    Or check FM 'SO_DOCUMENT_SEND_API1' and documentation for it.

  • Printing PDF files double-sided

    Using an HP Photosmart Plus B210a - how do I print  PDF files double-sided.  I can print Word documents etc. this way but do not seem to have the option when opening a PDF file.
    This question was solved.
    View Solution.

    Hi,
    You might experiment with a page or two first.
    1.Choose File > Print.
    2.From the Subset pop-up menu in the Print Range area, select Even Pages Only.
    3.Click OK or Print.
    4.If the total number of pages is odd, add a blank sheet so the final odd page has a sheet to print on.
    5.Put the stack of printed paper back into the supply (source) paper tray so that the unprinted sides print. Point the top of the pages toward the printer. Make sure that the edges of the paper stack are square.
    6.Choose File > Print and select Odd Pages Only from the Subset menu.
    7.Select the Reverse Pages option. In this scenario, the Reverse pages option ensures that the page sequence is correct.
    8.Click OK or Print.
    Say Thanks by clicking the Kudos Star in the post that helped you. Please mark the post that solves your problem as Accepted Solution.
    I am employed by HP

  • Print PDF file directly to store printer

    Hi Gurus,
    Having not found a solution, we think we need help from you. We have searched forums and google but have not found adequate solutions.
    We are a retailer having different stores. Our main office is using SAP. Each store has its printer and defined in our SAP system. We want to print PDF files directly to store printer using SAP . How should we do that ? We think there are 2 steps:
    1) Upload PDF files from network directory into SAP (We done it, no problem)
    2) Having now PDF files in internal tables, how should we proceed to print PDF files using store printers?
         Please note that we do not want to use CL_GUI_PDFVIEWER since we do not want to display the PDF and having the obligation to choose the print option from dialog and also we do not want to call Adobe OLE object  to print
    Any answer would be appreciated
    Thank you very much

    Hi,
    It is really late to give response this post. But still who ever refering to this post for the same issue this solution is useful for achieving same in background:
    Even same can be used in smartforms, for getting spool request in PDF format as well which will decrease the size of file when printing in SAP printer.
    ct_tline is PDF output:
    DATA: lv_pdfsource TYPE xstring.
    FIELD-SYMBOLS:<p> TYPE x. " <p> type any.
    LOOP AT ct_tline INTO cs_tline.
      ASSIGN cs_tline TO <p> CASTING TYPE x.
      CONCATENATE lv_pdfsource <p> INTO lv_pdfsource IN BYTE MODE.
    ENDLOOP.
    * ->Create spool request in PDF format
    CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
      EXPORTING
        printer  = 'LOCL'            "Printer name supporting PDF device type
    *   DEST     =
        pages    = 1
        pdf_data = lv_pdfsource        "XSTRING internal table
    *   NAME     =
    *   SUFFIX1  =
    *   SUFFIX2  =
    *   COPIES   =
    *   PRIO     =
        IMMEDIATE_PRINT         = 'X'
    *   AUTO_DELETE             =
    *   TITLELINE               =
    *   RECEIVER =
    *   DIVISION =
    *   AUTHORITY               =
    *   LIFETIME = '0'
    * IMPORTING
    *   SPOOLID  =
    * EXCEPTIONS
    *   NO_DATA  = 1
    *   NOT_PDF  = 2
    *   WRONG_DEVTYPE           = 3
    *   OPERATION_FAILED        = 4
    *   CANNOT_WRITE_FILE       = 5
    *   DEVICE_MISSING          = 6
    *   NO_SUCH_DEVICE          = 7
    *   OTHERS   = 8
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • Orarrp can't print pdf file directly to printer

    oracle remote print utility (orarrp) can't print pdf file directly to printer.
    we expect orarrp utility can handle ".rrpa" file (i.e. pdf file generated on the application server) by directly print the file to the client's printer, i.e. invoke the acrobat reader on the client side, display the the printer selection dialogue, after confirmation print the pdf file, then the acrobat reader close automatically nicely.
    However we are disappointed as the acrobat reader startup and display the pdf file content but does not print and does not close.
    After testing the problem several times, there are some findings:-
    Finding (A):-
    (a) for the success of direct printing of pdf file, a physical path must be provided; we have tried 2 methods:
    1) using drag & drop to copy the pdf file directly to the browser
    2) open pdf file in the browser directly using browser menu-->File-->Open.
    (b) for the failure of direct printing, a virtual path is involved and we have also tried 2 methods:
    1) when web.show_document() is used
    2) enter the url to the URL bar of the browser,
    eg. http://appsvr.com:7777/report/test_printout/APPSVR1094707.rrpa (this is a virtual path/url)
    Finding (B):-
    (a)when the physical path is used, a temporary pdf file is generated in the same directory where the rrpa file exists in the application server,
    e.g. in application server: d:/printout/yyy.pdf is generated for d:/printout/xxx.rrpa when direct print occurs
    (b) however when the virtual path is used, there is no such temp "pdf" file generated and direct print failed.
    May be when virtual path is used, orarrp utility don't know where to generate the temp "pdf" so direct print doesn't occur.
    So, anyone has similar experience or further queries or has solutions, please join.
    Thanks for your attention.

    Hi,
    It is really late to give response this post. But still who ever refering to this post for the same issue this solution is useful for achieving same in background:
    Even same can be used in smartforms, for getting spool request in PDF format as well which will decrease the size of file when printing in SAP printer.
    ct_tline is PDF output:
    DATA: lv_pdfsource TYPE xstring.
    FIELD-SYMBOLS:<p> TYPE x. " <p> type any.
    LOOP AT ct_tline INTO cs_tline.
      ASSIGN cs_tline TO <p> CASTING TYPE x.
      CONCATENATE lv_pdfsource <p> INTO lv_pdfsource IN BYTE MODE.
    ENDLOOP.
    * ->Create spool request in PDF format
    CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
      EXPORTING
        printer  = 'LOCL'            "Printer name supporting PDF device type
    *   DEST     =
        pages    = 1
        pdf_data = lv_pdfsource        "XSTRING internal table
    *   NAME     =
    *   SUFFIX1  =
    *   SUFFIX2  =
    *   COPIES   =
    *   PRIO     =
        IMMEDIATE_PRINT         = 'X'
    *   AUTO_DELETE             =
    *   TITLELINE               =
    *   RECEIVER =
    *   DIVISION =
    *   AUTHORITY               =
    *   LIFETIME = '0'
    * IMPORTING
    *   SPOOLID  =
    * EXCEPTIONS
    *   NO_DATA  = 1
    *   NOT_PDF  = 2
    *   WRONG_DEVTYPE           = 3
    *   OPERATION_FAILED        = 4
    *   CANNOT_WRITE_FILE       = 5
    *   DEVICE_MISSING          = 6
    *   NO_SUCH_DEVICE          = 7
    *   OTHERS   = 8
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • How to print PDF file with hp-ux 11.31 on itanium

    We finished upgrade from 11.5.7 to 12.1.1.
    With 11.5.7 ( pa-risc hp-ux 11.23 ) we print our pdf file in using acroread to convert them in postscript and print them to printer.
    In our 12.1.1 environment ( itanium hp-ux 11.31 ) ; acroread is not available on itanium.
    Which tool can we use to be able to print PDF file on itanium ( itanium pdf to postscript tool ) free
    Thanks
    Marc

    Pl see MOS Doc 778970.1 (How to Print PDF/UTF8 in R12?)
    HTH
    Srini

  • How do I re-sequence pages in a pdf file, which is in booklet format?

    I have a pdf file which is an A5 booklet in duplex for-printing order, with two A5 pages printed on one A4 area.  I want to re-sequence these pages to simple ascending page number order, for reading online.  How do I do it?
    The first A4 page of my pdf file consists of A5 page 1 on left and A5 page 48 on right, followed by the second A4 page consisting of A5 page 47 on left and A5 page 2 on right, and so on.  [I can print this out OK as a booklet, except that the second A4 page, etc. is upside down.]
    Do I need to take the crude, grunt approach and cut and paste each A5 page, one at a time, into a new document?  I am using Acrobat XI Pro

    You can reorder pages by dragging them to new positions in the Pages pane on the left.

  • How to print pdf files not using acrobat product?

    i just want to print pdf files,but not want to use the adobe acrobat or acrobat reader,just want to write a tools print pdf files directly.

    > no i just want to print it,not need to read it.can you help me?
    Well, the problem is to print it you need to be able to read it. Something needs to convert it into a format the printer can understand (most printers are PostScript or PCL).
    I'm not sure you entirely understand what a PDF file is. It's not a fancy text file. It's a binary format. Saying "I want to print a PDF without a PDF interpreter" is like saying "I want to run an EXE without Windows". You need software to interpret the format.
    You certainly can write your own software to interpret the PDF format, convert it to a print language and output that to a printer, but as Aandi said you will need to start by reading the PDF Reference so you know how the inside of a PDF file works, and it will most likely take several years of development even for a seasoned, expert programmer. It's just not as simple as "Printer, meet PDF. PDF, meet printer."

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

Maybe you are looking for

  • Problem while filling the Setup Table for the DS 2LIS_02_SCL.

    Hi All, When I am trying to fill the Setup table for the DataSource 2LIS_02_SCL and only for one specific Purchase Order, it is showing me a message like u201CDataSource 2LIS_02_ITM contains data still to be transferredu201D I have deleted the Setup

  • Set Timeout in TopLink JPA

    Hi I am using a standalone JPA application with Toplink I need to implement a timeout feature But I do not find any options for setting the timeout in any of javax.persistence.EntityManager; javax.persistence.Query etc nor do i find any property that

  • Query stats substitution strings on IR region

    Hello, Are the query stats substitution strings, like #ROWS_FETCHED#, #TOTAL_ROWS#, #FIRST_ROW_FETCHED# and #LAST_ROW_FETCHED#, should be active in an IR region? Currently, it seems they are not active, and I'm asking if it's intentional or a bug. Th

  • Deleting a record in an internal table

    hi,   loop at itab,    ..... if a particular record alone matches a condition then that particular record alone has to be deleted. endloop. only the particular record which matches the  condition inside the loop should be deleted. remaining records s

  • Layers over images

    Hello. I have a problem positioning layers in DW8 over-top of my pages that I layed-out in photoshop. Say I want to draw or position a layer over top of "unclickme_34.gif" I can do that fine in dreamweaver as it aligns correctly to the image; however