Read file stored in MIME folder

Hello
I have a word(.doc) file stored in MIME folder in webdynpro java.while clicking the filedownlad UI,I need to read this file from the MIME folder.I heard we can use binary chache and WDURLGenerator.Can someone please send me the details how to do it.
regards
John

HI,
Same problem but with HTML file was solved here Re: How to connect to a html using webdynpro
Best regards, Maksim Rashchynski,

Similar Messages

  • Reading file from an external folder.

    Iam tring to read an external file from the C:\ drive. Given below is the code.
    DATA LV_XLS(100) TYPE C.
    DATA LV_CONTENT TYPE XSTRING.
    LV_XLS = 'C:\XML\Report.xls'
    READ DATASET LV_XLS INTO LV_CONTENT.
    But when i execute iam getting an error - FILE NOT FOUND. How do i read file from an external folder. My requirement is to strictly read from an external folder. Please help.
    If this is not possible please advice as to how the file could be moved to the SAP root directory. Iam not able to locate the root.

    hi,
    This is the code to read a excel file from the local system.
    Read data set you are using in your code corresponds to files on application server thats the reason its throwing an error.
    * Parameter variable declaration for browsing the file location       *
    PARAMETERS:
      p_file TYPE ibipparms-path OBLIGATORY.
    data:
    it_text TYPE truxs_t_text_data .
    AT SELECTION-SCREEN  ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         program_name        = syst-cprog
    *   DYNPRO_NUMBER       = SYST-DYNNR
         field_name          = ' '
       IMPORTING
         file_name           = p_file.
    START-OF-SELECTION.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_tab_raw_data             = it_text
          i_filename                 = p_file
        TABLES
          i_tab_converted_data       = t_cust
      EXCEPTIONS
        conversion_failed          = 1
        OTHERS                     = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    This is to read a text file from local system.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
        filename                      =  'D:\FILEINTERFACE\file.TXT'
    *    FILETYPE                      = 'ASC'
         has_field_separator           = 'X'
    *    HEADER_LENGTH                 = 0
    *    READ_BY_LINE                  = 'X'
    *    DAT_MODE                      = ' '
    *    CODEPAGE                      = ' '
    *    IGNORE_CERR                   = ABAP_TRUE
    *    REPLACEMENT                   = '#'
    *  IMPORTING
    *    FILELENGTH                    =
    *    HEADER                        =
        TABLES
          data_tab                      = t_kna1
    *  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.
    PS.  In both of the above mentioned function modules make sure that the file structure is similar to the internal tables used.
    Thanks
    Sharath

  • Reading Files from client directory folder using servlets or struts.

    HI All,
    Could you please help me out int the below query.
    I want read all files from paricular directory folder from the client machine in web application. I am able to do it from my local machine. but when I am try to do it from some other machine I am not able to get the file list.
    It is very urgent ..please hep me ASAP.

    It should be problem with the file permissions in your client machine ???Hardly.
    @OP: a servlet executes at the server. It doesn't haved any access whatsoever to the client machine.

  • Accessing files stored in a folder on portal through application

    Hi
    I have to access the files that are stored in the folder in "irj" folder on portal, through one link.
    the path i gave is:
    <a href= "http://myserver:12345/irj/<folder name>/<file name>">
    but it is not taking this path and gives the error that requested resource not found.
    Can anybody please help in this regard, whether this way is correct or have to specify the path in some other format.
    Thanks & regards,
    Anupreet

    Hi,
    as Dieter stated implicitely, irj/root on the file system is the "root" folder when calling .../irj via http. There is no access to the irj folder by default.
    On NW04, the mapped folder in fact is ...\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root (so there are two irj folders, the second counts).
    Hope it helps
    Detlev

  • Reg: Deleting the file stored on the folder

    Hi All,
    I do have the requirement where I need to download a billing document(scipt) onto the folder in PDF format and then upload the same PDF document to the transaction VF03.
    My question is how to delete the downloaded PDF file programatically.
    Answers will be rewarded.
    Thanks,
    Kishore

    Hi Krishna,
    If ur file exist in front end then Use the FM GUI_DELETE_FILE. make sure that file name is case sensitive.
    If it is application server then use DELETE DATASET filepath.
    It will perfectly works fine.
    Thanks,
    Vinod.

  • Can you read files stored on the Windows partition through Mac OSX?

    I'm new to Mac, getting one soon, so correct me if I'm wrong in assuming that OS X can make shortcut folders to other locations on the disk drive like windows can.
    I'm getting a 500GB hard drive and have a decent movie collection to store on the hard drive, and the Macbook Pro is coming preconfigured with 256GB each for Mac and Windows. I won't really put much on the Windows side, so I thought maybe I could put my movies on the Windows side and then create a shortcut over to there and place it on my Mac side desktop, so that when I click on it, it takes me to the folder in Windows which stores the movies, so that I would still have easy access to them but they would be counted under Windows' partition. First off can you make shortcuts like that, going cross partition? And secondly, I just assumed they would open fine as long as I got VLC player, until I read stuff about NTFS and HTS+ and stuff, meaning Mac can't write to Windows and vice-versa, but I think Mac can read Windows or something from the bootcamp drivers.
    Do you think this will work? Thanks

    Thanks for the feedback.
    Any ideas on what this software could be? I'm not sure what to look for.
    Would it be a once off program or something I need to run in the background to do it? Not too keen on bogging my computer down with programs to launch at startup or constantly running them.

  • Write file in text and stored in seperate folder!

    Hi guys,
    i need a help.
    I want to write a file into an text file and stored it in seperate folder in default colon(ie., if i install an .exe in any colon(c or D:/ or E:/) , then write a string into a text file and save it in .exe instalation colon in seperate folder.
    eg.,
    File f=new File("Survey.txt");
                 FileWriter fw1=new FileWriter(f,true);i want to save survey.txt into a folder storage_folder.
    how can i do it?.

    Thanks for your reply.
    Actually, I want to create an folder automatically without specifing the directory (ie.,not specifying C:/ or D:/ or E:/ ) and store that file.
    ie.,
    File f=new File(" log/text.txt");
    OutputStream f0=new FileOutputStream ("log/text.txt",true);So, the text file stored in log folder (Creats automatically) . The log folder may creat where the installation software installed (Weather it is C:/ or D:/ or E:/).
    pls, clarify my doubt , sir.

  • Read a text file stored in WebDynpro packages(SRc/packages)

    Hi Experts,
    I have a text file stored in the folder structure of WebDynpro Development component.
    Its stored under src>packages>com>sap>file-->data.txt
    Now i need to read data from this file and fill the context node of WD controller.
    can you guys give me an example of how to do it?
    Regards,
    Ashish Shah

    /** get file as binary */
              File file = new File(
                             WDURLGenerator.getResourcePath(
                                  wdComponentAPI.getDeployableObjectPart(),
                                  "data.txt");
              FileInputStream instream = new FileInputStream(file);
              long filelen = file.length();
              byte[] binary = new byte[(int)filelen];
              int offset = 0;
              int numread = 0;
              while(offset<binary.length &&
                        (numread = instream.read(binary,
                         offset,
                          binary.length-offset))>=0){
                   offset +=numread;
              instream.close();
              /** create Resource out of binary read */
              if(binary!=null){
                   cachedresource = WDWebResource.getWebResource(binary, WDWebResourceType.TXT);
                   url = cachedresource.getURL();
              /** create window to open document */
              IWDWindow docwin = wdComponentAPI
                                       .getWindowManager()
                                       .createNonModalExternalWindow(url, Attachment);
              docwin.show();
         }catch(Exception e){
              msgBox("error reading file");
    nikhil

  • How to open multiple folders and read file?

    Hello,
    I try to use this bridge script. The script work very well for me but some times I have multiple folders.
    Now script work that:
    1. Read file in folder
    2. Save text file and show me popup with full quadrature
    http://forums.adobe.com/message/3996179?tstart=56
    1. Open folder
    2. Read file
    3. Close folder
    4. Read next folder
    5. Read file
    6. Close folder
    7. ....
    8. Save text file with all folders and show me popup with full quadrature
    Please help!
    Best regards.

    Lightwave wrote:
    I don't think you guys are hearing my question. I can see how to restore a single file or folder.
    I want to restore ALL the changed or deleted files and folders since my last backup (but not the entire disk, that would be unnecessary)
    Were all (or most) of the items in, say, your Documents folder, or your Music folder? If so, you can restore the whole folder via TM. That will put all sub-folders and files back exactly the way they were at the time of the backup. You just have to be careful to pick the right backup (date & time).
    Or, if they were scattered through your Home Folder, you can restore that entire folder in the same way.
    If you've made changes subsequent to that backup, however, they will be lost in the process. What you can do in that case is, restore to a different location, then compare the two folders, and drag & drop what you want. (To restore to a different location, select the folder in TM, then click the "gear" icon in the TM Finder window, and select +Restore <item selected> to ...+ and you'll be prompted for a restore location.)

  • Unzipping files from a zipped folder

    Hi,
    I need unzip files stored in .zip folder using ABAP. Could you please tell me of a utility/Funtion Module or any other method which exists for the same?
    Thanks a lot
    Shujath

    Hi Mohammed,
    you just have to execute an external program from your ABAP.
    For example, if the ZIP file is in the client computer you have to use the WS_EXECUTE.
    Have fun
    Frédéric

  • Downloading .exe file stored in KM

    Hi,
    I'm trying to download a .exe file stored in KM folder using KM APIs in Webdynpro. But while downloading am giving WDWebResourceType as UNKNOWN. So at runtime it is asking for save and cancel only. While saving it gets saved without extension,so user will not be able to run the exe without renaming the file. Is there any solution for this?
    I even tried setting a new WDWebResourceType as follows 
          WDWebResourceType type = new WDWebResourceType("exe","application/octet-stream",false)
    But yielded the same result.
    Thanks n Regards
    Renu.

    marco,
    (i don't know the english naming, but I try to translate from my german browser version)
    go to menu Extras / Settings...
    On tab Content (the world bowl) is a section "File types", there you can edit the desired action for your file type. e.g. download ("save as") for pdf-files.
    kr, achim

  • Display PDF in different window by reading Binary file in MIME folder.

    Hi all,
    I've kept binary file in MIME folder and I'm trying to read the contents of it. and I'm trying to display contents in pdf format in separate window.
    For this I was able to read the file by using FileInputStream
    byte[] bytes = new byte[1000];
         try
                  //File file = new File(WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"data.bin"));
                   File file = new File(WDURLGenerator.getResourcePath("test.bin"));
                   FileInputStream is = new FileInputStream(file);
                  long length = file.length();
                   //Create the byte array to hold the data
                   byte[] bytesA = new byte[(int)length];
                   //Read in the bytes
                    int offset = 0;
                    int numRead = 0;
                    while (offset < bytesA.length&& (numRead=is.read(bytesA, offset, bytesA.length-offset)) >= 0)
                         offset += numRead;
                        is.close();
                   bytes = bytesA;
                   wdContext.currentContextElement().setPdfSource(bytes);
                 catch(Exception e)
                   wdComponentAPI.getMessageManager().reportException("Error Reading File:"+e.getCause(),true);
                   wdComponentAPI.getMessageManager().reportException("Error Reading File To String:"+e.toString(),true);
    I've to show this in external window. I created attribute "pdfResource" of type binary
    and declared in the source
    private ISimpleType myPdfDoc;
    After that I added this bit of code in Init Method
    myPdfDoc = wdContext.getNodeInfo().getAttribute("pdfResource").getModifiableSimpleType();
    ((IWDModifiableBinaryType)myPdfDoc).setMimeType(WDWebResourceType.PDF);
    ((IWDModifiableBinaryType)myPdfDoc).setFileName("PDF");
    After this I made an action handler which has following code.
    final byte[] documentContent = bytes
    final String docUrl = myPdfDoc.format( bytes );
    String docUrl = myPdfDoc.format(bytes);
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(docURL,"Resource", true);
    window.open();
    But it is throwing Null Pointer exception for Init Method and also while displaying.
    Where is that I'm faltering. Any Pointers will be help ful
    Thanks
    Srikant

    First of all why do you need those three lines of code in your wdDoInit() ?
    Simply, you may use this:
    IWDCachedWebResource cachedResource = null;
    String url = null;
    byte[] pdf = wdContext.currentContextElement().getPdfSource();
    if (pdf != null) {
       cachedResource = WDWebResource.getWebResource(pdf, WDWebResourceType.PDF);
       url = cachedResource.getURL();
    Refer <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/4a/fb8342a7d30d53e10000000a155106/content.htm">Utilizing the IWDCachedWebResource-API</a> for further assistance.
    /* Changed the code */
    Message was edited by: Bala Krishnan

  • I have produced a number of DVD on my iMac. They are stored in a folder called Burn Folder. I want to get them into iTunes so I can play them on Apple TV. I have tried to convert them to MP4s using Handbrake but Handbrake does not recognize these files.

    I have produced a number of DVD on my iMac. They are stored in a folder called Burn Folder. I want to get them into iTunes so I can play them on Apple TV. I have tried to convert them to MP4s using Handbrake but Handbrake does not recognize these files. I am stumped.

    If you have the original movie files, you'd be much better converting those, otherwise try MPEGstreamclip.

  • ITunes not storing files in iTunes media folder location

    A number of years ago I wanted to move my itunes media files to an external drive. At the time an article was posted that explained how to do such that. Additionally the article explained how to put the media files in one folder on the external file server and all the itunes definition files in another folder on the same external file server. It worked perfectly! All seemed well. Of course since making this change there have been many many updates to iTunes and the OS.
    Recently, I was scanning through the folders of the external file server and noticed some media files that appeared in the iTunes application listing were missing in the physical iTunes media folder (folder A). After a little searching I found the media files were in the iTunes definitions folder (folder B). Initially I thought somehow I had changed the folder location under the iTunes advanced tab. I checked it stilled pointed to the ORIGINAL folder A location. Yet iTunes had for a while as it turns out had created a whole new media folder tree and was adding the media files to that media tree (folder B). This is the folder the original only contained the iTunes definitions.
    Thinking I had made a mistake somewhere sometime ago, I copied all the media files to the proper folder (folder A) and reset the iTunes Media folder location to point to folder A. All was fine.
    Today I added some new media to the iTunes library and once again, iTunes created a new media folder tree in folder B were only the iTunes definitions are supposed to be stored. So once again I moved the media files to the proper folder.
    There is no question THIS IS A SOFTWARE BUG. It does NOT matter what folder location is specified in the Preferences->Advanced->itunes media location is specified, iTunes will either CHANGE the folder location to wherever the definitions files are located or begin putting the media files where the definitions files are located even though the iTunes media location is setting to a different folder.
    when this started I do not know. I have been using itunes for a number of years and once I had my external file server set up never had reason to check it.
    One might ask why put the media files in one location and the definition files in another location. That is because there was a time when iTunes for some reason would think it definition files were corrupted and start to do nasty things to the media library. Once I lost a number of songs it is then when I found a note in this forum that suggested putting the definitions in one folder and the media in another folder. It was great idea. Is there a work around of a fix for this bug?

    Some additional information.
    When I click the apps tab in iTunes, some of the applications listed are actually songs (the songs are also shown in the music list and point to the proper location), when I click Get Info on some of the apps, it points to a song, and some apps that actually exist in the Mobile Apps folder are shown to located in a song folder. Bottom line the apps database is corrupted.
    When I consolidated the music files I did not touch the mobile applications folder. As best I can tell all the movies and songs are fine (about 3000 items in total).
    When I export the library it does not include the apps in the xml file. So deleting the iTunes DB and re-importing the .xml will not work.
    To recap. All the songs and movies are in one folder (folder A). This is the folder listed in the Preferences->Advanced->Itunes media location. The apps folder is located in a different folder (folder B) where the iTunes definition files are located. How they got there I do not know.
    How do I fix the apps tab and have the app icons (and physical applications) to point to the proper location? Also to remove the songs listed in the apps list without removing the song from the iTunes library.

  • How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    Welcome to the Apple community.
    Only photos taken on the iOS device and after photo stream was enabled will be added to photo stream.

Maybe you are looking for