Open Jpg, Excel, word, pdf files from SAP screen.

Hi SAP Fans,
We have built a customer screen with some fields at top and ALV grid at bottom (using Container and ABAP 00). In this ALV grid display, we show list of files uploaded into SAP using WS_UPLOAD and stored in cluster table. When user double clicks on any file, we should be able to open file in a pop-up and show its contents. If User double clicks on Excel, it should show Excel file, if user double clicks on Pdf, it should show in Acrobat reader. How is this done ? Do I have to code for each document type ?
Any help is appreciated.
Niranjan

hi,
use WS_EXECUTE FM..
REPORT ZWSEXECUTE.
DATA: BEGIN OF ITAB OCCURS 3,
      LINE(50),
      END OF ITAB.
PARAMETERS: PROG(70) DEFAULT
            'C:Program FilesMicrosoft OfficeOfficeWINWORD.EXE'.
PARAMETERS: FILE1(70) DEFAULT 'C:TEMPTEST.TXT'.
* Tick to print the Text file after saving from MS
WORDS
PARAMETERS: S_UP  AS CHECKBOX.
* Tick to create new or overwrite Text file
PARAMETERS: S_NEW AS CHECKBOX.
IF S_UP = 'X'.
   CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
             FILENAME        = 'FILE1'
        TABLES
             DATA_TAB        = ITAB
        EXCEPTIONS
             FILE_OPEN_ERROR = 1.
   IF SY-SUBRC = 0.
     LOOP AT ITAB.
       WRITE: / ITAB.
     ENDLOOP.
   ELSE.
     WRITE: / 'File open error.'.
   ENDIF.
ELSE.
IF S_NEW = 'X'.
   CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
             FILENAME = 'FILE1'
        TABLES
             DATA_TAB = ITAB
        EXCEPTIONS
             FILE_WRITE_ERROR              = 1
             NO_BATCH                      = 2
             GUI_REFUSE_FILETRANSFER       = 3
             INVALID_TYPE                  = 4
             OTHERS                        = 5.
ENDIF.
CASE SY-SUBRC.
     WHEN 1.
          WRITE: / 'GUI DOWNLOAD FILE WRITE ERROR'.
     WHEN 2.
          WRITE: / 'GUI DOWNLOAD NO BATCH'.
     WHEN 3.
          WRITE: / 'GUI DOWNLOAD GUI REFUSE
FILETRANSFER'.
     WHEN 4.
          WRITE: / 'GUI DOWNLOAD INVALID TYPE'.
     WHEN 5.
          WRITE: / 'GUI DOWNLOAD OTHERS'.
ENDCASE.
CALL FUNCTION <b>'WS_EXECUTE'</b>
  EXPORTING
     PROGRAM       = PROG
     COMMANDLINE   = 'FILE1'
     INFORM        = ' '
  EXCEPTIONS
     FRONTEND_ERROR           = 1
     NO_BATCH                 = 2
     PROG_NOT_FOUND           = 3
     ILLEGAL_OPTION           = 4
     GUI_REFUSE_EXECUTE       = 5
     OTHERS                   = 6.
CASE SY-SUBRC.
   WHEN 1.
     WRITE: / 'FRONTEND ERROR'.
   WHEN 2.
     WRITE: / 'NO BATCH'.
   WHEN 3.
     WRITE: / 'PROGRAM NOT FOUND'.
   WHEN 4.
     WRITE: / 'ILLEGA OPTION'.
   WHEN 5.
     WRITE: / 'GUI REFUSE EXECUTE'.
   WHEN 6.
     WRITE: / 'OTHERS'.
ENDCASE.
ENDIF.

Similar Messages

  • Error when opening PDF files from SAP.

    Hi Gurus
    I have posted this question in ABAP Development section also. Please read the below text.
    We are having a strange intermittent problem with Adobe Reader. When we try to open PDF files from SAP Frontend we get an error pop-up. The pop-up does not have any text. The title of the pop-up has "Adobe Reader". There is a blue question mark and an OK button.
    This issue occurs few times a day in Windows Vista.
    This issue does not occur in Windows XP.
    Since past few weeks, we have been trying to find some error/warning/atleast some text in log files of SAP, OS, Adobe Reader, Registry entries, Event Viewer. So far, we have not found anything.
    SAP is not able to help as this issue occurs intermittently and said when they tried, the issue did not occur. They made two attempts and in each attempt they tried 10 times to reproduce the issue. This issue occurs intermittently.
    Environment
    SAP R/3 4.7 EE SAP_Basis 620 Support Package 61
    Windows Vista Enterprise
    Adobe Reader 9.0 and Adobe Reader 9.1 (tried with both versions)
    SAPGUI 710 Patch 12 (latest patch). It also occured in Patch 11.
    Please suggest
    Thank you
    Pavan

    Now I got to capture the screenshot, however not able to attach/upload here but it says:
    'Reading Untagged Documents'
    lets say i tried to open 6 page document then it said:
    'This 6-page document is untagged and must be prepared for reading. While the document is being
    analyzed, your assistive technology will not be able to interact with this application. '
    then it asked for Reading options
    then a checkbox for to confirm 'Always use the settings from the Reading Preferences (Do not show this dialog again)
    then 'OK/START' and 'cancel' buttons
    It seems, this is the problem with Adobe w.r.t Vista.
    thanks
    Bhudev

  • I want read PDF file from SAP directory and create a spool request or print

    Hi all,
    I want read PDF file from SAP directory and create a spool request or print the pdf through SAP. Can any body  help me in this.
    Also please write to me if its possible to open PDF from SAP directory to adobe pdf reader.
    Thanks in advance,
    Sunny

    Hi Sunny,
    Check these links.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    http://www.erpgenie.com/sap/abap/pdf_creation.htm
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Print a pdf file from sap

    Hello,
    I'm looking for a way to print a .pdf file from sap . The file  was created manualy and is in a newtwork folder.
    I have to send the print to a network printer . Is it possible to use the AcroRd32.exe as a command line?
    Thank you.

    hii,
    try this
    CONVERT_OTFSPOOLJOB_2_PDF
    http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm
    PDF - Printing a PDF file from ABAP or SAP Script
    regards,
    Sri.

  • Firefox freezes when opening an adobe acrobat (PDF) file from any website

    Firefox freezes when opening an adobe acrobat (PDF) file from any website. This only started happening after the latest update of Firefox was installed. Do you have a fix?

    Hi Susan,
    The Adobe plugin in Internet Explorer is a bit different from the one in Firefox, however they're all made by Adobe and they usually come with Adobe Reader.
    When you open a PDF file in Firefox, it "calls" Adobe Reader to help it read the file. In this case, the Adobe Reader takes over, and it is responsible for freezing your browser.
    I suggest you try the last 4 solutions presented on the [[Opening PDF files within Firefox]] (start with "Re-install the plugin" through "Re-install Adobe Reader").
    Good Luck :D

  • Open PDF file from SAP ?

    Hi gurus,
    Is there any FM or command that We can open a pdf file from our computer , This means that Open pdf with Acrobat reader but will be triggered in ABAP .
    Thanks

    Hi,
    First you need to download the pdf file onto the frontend computer then the MF WS_EXECUTE will do the job:
    CALL FUNCTION 'WS_EXECUTE'
          EXPORTING
            document           = 'X'
            program            = path_document
          EXCEPTIONS
            frontend_error     = 1
            no_batch           = 2
            prog_not_found     = 3
            illegal_option     = 4
            gui_refuse_execute = 5
            OTHERS             = 6.
    A good directory to download you file would be the SapWorkDir, I have seen in the standard that sap get this directory using WS_QUERY:
    CALL FUNCTION 'WS_QUERY'
          EXPORTING
            query          = 'CD'
          IMPORTING
            return         = path_for_copy
          EXCEPTIONS
            inv_query      = 1
            no_batch       = 2
            frontend_error = 3
            OTHERS         = 4.
    Hope it helps
    Regards,
    Renaud Wanschoor

  • Upload PDF file from SAP Portal and save in SAP

    A file in PDF format needs to be uploaded from SAP Portal and the file is to be saved in SAP. Request for help, how to do the same. What are the FM to be used etc..
    Thanks,

    hi
    Use FM  GUI_UPLOAD with file type as BIN
    there are similar threads...pls refer to them for more details:
    https://www.sdn.sap.com/irj/sdn/profile?userid=3166533
    Upload pdf file to SAP
    PDF File
    reward if helpful
    regards,
    madhu

  • Storing Excel or PDF files from attachments

    Hi all,
    I know that you can read Excel or pdf attachments from email. But can you store those files on the phone for later reading, or must you keep the email and attachment? I have a 4 column, 5000 line Excel sheet that I need to be able to read on the phone. I don't presently own an iPhone; I'm considering purchasing the 3G.
    Thanks,
    Jenn

    JennMartin wrote:
    Hi all,
    I know that you can read Excel or pdf attachments from email. But can you store those files on the phone for later reading, or must you keep the email and attachment?
    You cannot store anything on the iPhone, its view only.

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • Opening or saving a pdf file from my email

    I just got a new computer which operates using Vista. I get many emails with pdf attachments and when I try to open or save them nothing happens. The little window pops up which shows the file transferring but it never finishes. I am not computer savvy and would appreciate anyones help.

    I too am having that problem opening files in certain programs, as they open in others. I have installed Adobe reader 8, but it started before I downloaded this program. I updated to Norton Internet Security 08 and that's when my problems started happening. Do you know why the pdf file keeps running as to open, but doesn't? It is necessary that I get this straightened out as my boss has the same problem and we only have one other computer that we can use to open these files. Thank You for your time.

  • Write Special Characters in PDF file from SAP Script

    Hi there,
    Need a quick help...
    We are converting SAP Script to PDF using the function module CONVERT_OTF
    and saving the file on presentation server using GUI_DOWNLOAD...
    But in certain cases where the item text is maintained with some special
    characters like @#$% u03B1 u03B2 u03B3 u03B4 ®... then, some of these characters are seen
    as junk/garbage characters...
    how do we handle this??
    P.S. Our Forms are already using Korean Font...
    Any help is highly appreciated
    Kind Regards,
    Tanuja

    Hi,
    Use the FM  CONVERT_OTF to get the Binary data and  down load it as PDF .
    sample
    */ Convert the OTF data into PDF.
        call function 'CONVERT_OTF'
         exporting
           format                      = 'PDF'
         importing
           bin_filesize                = lv_bin_filesize
            bin_file                   = lv_xstring
          tables
            otf                        = lt_otf_data-otfdata[]
            lines                      = lt_pdf_data
         exceptions
           err_max_linewidth           = 1
           err_format                  = 2
           err_conv_not_possible       = 3
           err_bad_otf                 = 4
           others                      = 5  .
    */ Convert the Xstring data into PDF
        call method cl_document_bcs=>xstring_to_solix
          exporting
            ip_xstring = lv_xstring
          receiving
            rt_solix   = lt_mess_att .
    Then down load the table lt_mess_att  with extension PDF.
    Edited by: UmaMaheswaraRao Surapaneni on Apr 1, 2009 5:44 PM

  • I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version

    I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version. I was able to access them in 4.3.1 .
    Can anybody tell when is this getting resolved.

    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile
    Your old Profile is located here in Vista & Win7: <br />
    ''drive'':\Users\''Windows login user name''\AppData\Roaming\Mozilla\Firefox\Profiles\''profile_name''

  • Downloaded file from SAP to excel 2007(*.xlsx, *.xlsm)  - unable to open

    Hi All,
    I am downloading a data from SAP to excel(*.xlsx) format. I am able to conver/download the file in *.xlsx format, but if try to open the downloaded excel file, it gives teh error message 'Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file'. with a OK button. When I press the OK button, no data is displayed.
    So kindly let me know how to download the file from SAP to *.xlsx format without any errors.
    Note: I am able to download the data in *.xls format without any erros.
    Thanks in advance,
    Regards,
    Vijay

    Hi,
    You are probably not being able to open the file of .XLSX format because you do not have Microsoft Office 2007 installed on your system. You might be having a lower version of Microsoft Office. e.g. 2003.
    What you can do is, before opening the .XLSX file directly on a system which does not have Microsoft Office 2007, you can convert it into .XLS format and then open the same.
    See the below code.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY
      EXPORTING
        SOURCE               = 'C:\Users\Danish\Desktop\test1.xlsx'
        DESTINATION          = 'C:\Users\Danish\Desktop\test2.xls'
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        WRONG_PARAMETER      = 3
        DISK_FULL            = 4
        ACCESS_DENIED        = 5
        FILE_NOT_FOUND       = 6
        DESTINATION_EXISTS   = 7
        UNKNOWN_ERROR        = 8
        PATH_NOT_FOUND       = 9
        DISK_WRITE_PROTECT   = 10
        DRIVE_NOT_READY      = 11
        NOT_SUPPORTED_BY_GUI = 12
        OTHERS               = 13.
    IF SY-SUBRC NE 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Danish

  • Exporting PDF files from SSRS 2012 - "There was an error opening this document. The file is damaged and could not be repaired"

    Good day
    I have the situation where we are exporting PDF files from reporting services in our website. 
    When dividing the data into sections, the report exports perfectly, but when exporting the entire set and trying to open the file, we get the following error in Adobe Reader:
    "There was an error opening this document.  The file is damaged and could not be repaired"
    We tried to repair the file, no luck.  We tried to use different PDF readers, no luck
    We then checked the file sizes.  When exporting the subsections, each section exports a file of about 2mb. 
    When exporting the entire set, the file is about 1.3mb. 
    Adding all the sections together gives me a rough estimate of 40mb.
    Exporting to TIFF works beautifully and returns a file of 41.5mb. Word and Excel formats also work well, only issue there is the page numbering and formatting.
     The problem we have is the clients are adamant about having it in PDF format.
    Any advice please?

    This was one of the temporary suggestions I gave the client...
    Unfortunately they do not like this as the page numbering and formatting in Word does not appear right.  We are talking about over 1300 pages.  I can't expect them to change the formatting with each export.  Additionally,  the data is
    constantly changing and each client has their own data.  The clients export the reports randomly.  I therefore can't post the reports back onto the server.
    Thanks for the speedy response though

  • Very slow opening PDF files from Windows Explorer

    When I open a file from within Acrobat X Standard - whether through File>Open or the recent files list - the file opens very quickly.  When I open a PDF file from Windows Explorer, it takes 10 seconds or longer for the file to open.  Is this an Acrobat issue or a Windows/system problem?  (I don't experience the same delay when opening Word and Excel files from Windows Explorer.)

    I had to install adobe reader, but   PDF's used to display just fine with IE, any idea what happened ?
    Windows 8.1 pro.
    thx
    lee

Maybe you are looking for

  • DMU 1.1 Released!

    We are very pleased to announce the availability of the DMU 1.1 production release for download from OTN and My Oracle Support (MOS). For new features and changes in the new release, please see Release Notes. <br><br> Best regards, The DMU Developmen

  • How do I request a refund for a movie after receiving the "An error occurred loading this content. try again later." error?

    I watched the first 11 minutes of a movie, paused and then when I tried to play again recieved the error - An error occurred loading this content. try again later.  No amount of retrying later fixed the problem.  I will not be able to finish watching

  • How to handle BAPI RETURN message?

    Hi , I developed a bapi ,it is calling from java  application . i don't konw how to send the return message to java application .Pl any one help out this problem. Thanks&Regards, Pratap

  • Query panel validation

    I have a query panel in which i have a field from date and to date I have defined view criteria taking an attribute date and giving the between operator so i got this from and to date fields Now i want to do the validation that from date should not b

  • Thunderbolt WD Duo, does not show in Disk Utility

    Hi Have imac 27 (late 2012) with 10.8.3 update OSX. Connecting to WD Thunderbolt Duo, the disk does not show in disk Utility, sys log or in any connection to the system. WD utility does not seems it either. Restart does not help. By disk returning to