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

Similar Messages

  • 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.

  • HT2674 I have an iMac purchased in May 2011.  OSX Lion 10.7.3.  I deleted backup file from the external hard drive. Now, the trash can will not empty some of the files deleted.  File folder: "Core Services" contains a locked file: "boot.efi".  It will not

    I have an iMac purchased in May 2011.  OSX Lion 10.7.3.  I deleted backup file from the external hard drive which operates from Time Machine.
    Now, the trash can will not empty some of the files deleted from the backup harddrive.
    The trash contains-- File folder: "Core Services" which contains a locked file: "boot.efi". 
    It will not delete.
    How do I get the trash can empty of these files?

    Yes, the Old Master file has a folder for each year where I find all photos from that specific year. I am attaching a screen shot of the file.
    In the meantime i have managed to download all photos (it did not download any video files though in mpg, avi, 3gp, m4v,mp4 and mov format) to a new iphoto library. Unfortunately the photos are quite mixed and often doubled up. I ma considering to purchase iphoto library which checks all duplicates in iphoto. this will save me a lot of time. What do you think?

  • Is it okay to copy files from my Itunes folder to an external drive with my ipod connected and Itunes open?

    I'm backing up my Itunes library and dragging files from the Itunes folder on my computer to my external hard drive. Is it okay to do this while Itunes is open and my Ipod is connected to the computer charging?
    I'm on a windows 7 computer.

    You should always close iTunes before any backup operation on your library.  Your iPod will continue charging (but make sure any sync operations have completed before exiting iTunes) - doesn't have to be removed while backing up the library.

  • When I try to import .olm files from my external hard drive back up, where do they go? It says on different forums they go to the "on my computer" folder but they are not there

    When I try to import .olm files from my external hard drive back up, where do they go? It says on different forums they go to the "on my computer" folder but they are not there.
    I go through all the instructions but then my emails do not appear. I'm starting to panic a bit!

    You might want to try asking on the MS Office Outlook forum - http://answers.microsoft.com/en-us/mac/forum/macoutlook - since those are Outlook files.
    Also note which method you're using to create a backup.
    Clinton

  • Reading file from a folder : File dir = new File(URL+aFile_to_add);

    Hi,
    Trying to read files from a dir on my site using a JSP and bean. I've tried nearly every option for the filepath I can think of and it doesn't seem to be finding the file...
    Here's the bit:
    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    It's working locally, but I obviously had to change the path from c://... to the above.
    The full code is listed below in the addWedding Method
    The method removes the .jpg from the file name and then writes the new file name to a database
    Thanks for any insight.
    Regards
    Jim
    public String addWedding(String aFile_to_add)
    String feedback = "unset in scrubWedding";
    try
    String URL = "images\\wedding_photos\\";
    Class.forName("org.gjt.mm.mysql.Driver");
    java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/rhwedd2_shop?user=**********&password=*******");
    java.sql.Statement statement = connection.createStatement();
    File dir = new File(URL+aFile_to_add);
    String[] files = dir.list();
    if (files == null)
    feedback = "Sorry, couldn't find the file "+aFile_to_add+"...no files have been added.";
    else
    for (int i=0; i<files.length; i++)
    // Get filename of file or directory
    String filename = files;
    String no_extension;
    //convert string array element into a char array
    char [] charsfilename = filename.toCharArray();
    int newlength = charsfilename.length -4;
    no_extension = String.valueOf(charsfilename,0,newlength);
    filesAdded = filesAdded+", "+no_extension;
    // Show the new file names in stack trace without extension
    //System.out.println("String no_extension " + no_extension );
    statement.executeUpdate("INSERT INTO items VALUES ('"+no_extension+"',5,'"+aFile_to_add+"')");
    // write to table with item_id and weddingid
    feedback = "The following files have been added..."+filesAdded;
    if (statement != null )
    statement.close();
    if ( connection != null )
    connection.close();
    catch(Exception e)
    feedback = "Into the catch";
    e.printStackTrace(System.err) ;
    return feedback;
    }//end addWedding

    String URL = "images\\wedding_photos\\";
    File dir = new File(URL+aFile_to_add); ok, ok, I'll answer...
    1) What gives you the impression that the relative directory "images\\..." exists (or, in other words, what makes you think your current directory is the parent of "images"?

  • Moving LR files from one external drive to another

    How do I move LR image files from one external drive to another external drive?

    Move the photos using your operating system and then re-connect in Lightroom following these instructions: Adobe Lightroom - Find moved or missing files and folders
    Do not use this as an opportunity to re-arrange folders or move photos from folder to folder. Just move the entire "tree" of folders.

  • .DS_store won't let me move files from one external drive to another

    I am trying to move some music files from one external harddrive to another.  They are both connected to my mac mini.
    In the "from" harddrive I have a folder with a bunch of music files in it and it also has a new file in it called DS_store. When I open this folder and select all, it naturally selects all of my music files and this DS_store file.  When I try to drag all of this to the "destination" harddrive I open the folder that I want to drag them to which already has some music and it has the DS_store file too, it won't let me drag the files to it   It says something like there is already a DS_store file there.  So I tried deleting that file from each external drive and it just reappears.
    If I create an empty folder in the destination drive, I can drag all of the files to it.  The problem is I want the new files to be in the same folder with the older files.  
    In addition there are a few other ghost type files that have shown up too.
    Any suggestions would be welcome.  Thanks.

    If you're copying from a FAT-formatted volume, do as below.
    Back up all data.  
    Select the text on the line below by dragging across it. Don't include the blank space at the end of the line. Only the text should be highlighted.
    dot_clean -m
    Copy the selected text to the Clipboard by pressing the key combination command-C.  
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the page that opens.
    Now switch to the Finder and and select the icon of the FAT volume. Drag into the Terminal window. More text will be added to what you entered.
    Click in the Terminal window to activate it, then press return.
    The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear. Then quit Terminal and try the copy again.

  • I can't copy iTunes media files from one external hard drive to another.

    Hi, I am running the latest iTunes and Mavericks software on my MacBook Pro. My iTunes library is stored on an external Seagate 2tb hard drive and it is almost full. I want to transfer the files to a WD Elements 3tb external hard drive and have made that new volume the destination folder for my iTunes library. However, even though I have enabled read/write on both volumes and made the iTunes media folders on both shared folders, I can't copy all the files from the Seagate drive to the WD drive. It comes up with an error message that says "The operation can't be completed because an unexpected error occurred (error code -8058)". I can transfer files from my MacBook hard drive to the new volume, but can't copy files from the old Seagate volume to my MacBook hard drive; it makes the "boing" sound that indicates it is copying but nothing transfers. Files that won't copy include all music files, some video files and all podcast files. Some transferred with no problem. Any ideas out there?

    Hi Limnos, thanks very much for your reply.
    both external drives came preformatted for Windows but I erased each and reformatted them for Mac before using them.
    i made the destination folder on the new WD drive the new iTunes folder using Advanced preferences in iTunes.
    my original iTunes folder on the first drive contained all my iTunes files, as that, also, was the destination folder that was linked via Advanced preferences.
    If I download new content now with the new drive attached, iTunes has no trouble finding where to place the files.
    in Preferences I have both boxes checked (copy files" and "organize") that deal with copying iTunes files.
    When  I first attempted to copy all iTunes files from one media folder to the other on the external drives, I just did a drag and drop of the whole iTunes media folder from one to the other while both were mounted on my desktop. It started copying immediately with no problems, but as it progressed it started skipping files, each time displaying the error message I reported earlier. that included my entire Music folder. When I open, for example, a season folder that contains files that would not copy, eg, Modern Family Season 5, the episodes that won't copy are there and visible but any attempt to drag and drop them into the correct folder on the new drive results in the error message. There is no pattern to it; it will choose some episodes from some seasons but not others, and no music at all.
    when I look at the "missing" files in  iTunes they have the small exclamation mark that indicates the file is missing, but when I locate it through iTunes it doesn't copy the file on the old external drive to the new one. It just plays it having found the file on the old drive.
    originally I had to make the iTunes folder on the old drive into a shared folder using the Get info window after either a software upgrade or an OS upgrade (I can't remember which, it was several years ago). For some reason the upgrade changed the preferences of that folder to a Read Only folder and after researching the problem found the only way to keep using the drive was to make the folder a shared one. I can't remember why and I apologise for that but it was a long time ago.; I can tell you that at the time it was necessary.
    thanks again for your time; I have a good working knowledge of iTunes and Macs in general so I truly believe I have done everything according to how it should be done,, but clearly I've done something wrong!

  • Importing .mxf Files from an external hard drive...

    Any advice or tips would be greatly appreciated. My problem comes close to others discussed, but I haven't been able to find a duplicate post. And I apologize for the length; I just want to give you as much info. as possible (I also put details in my signature) to help you help me.
    I shot a short film using Panasonic's HVX200 camera, filming in HD 720p/24p, and downloaded each P2 card through a PC laptop into a LaCie Brick external hard drive. I was originally planning on editing the footage with Adobe Premiere Pro 2.0, but became frustrated with how much trouble it was having handling the .mxf files. Assured by Apple salespeople that FCP 5 would have no problem importing the footage from an external hard drive, I purchased the computer described in my signature.
    Now I know that FCP/Apple only supports importing footage from the P2 card directly, and not from an external hard drive. A representative from ProMax.com was able to help me out, however. First, he had me copy the footage files onto my Mac internal drive from the external hard drive. Then, he had me select IMPORT -> PANASONIC P2. Then, I was to highlight the CONTENTS folder and import away. And it worked... sort of.
    There are two major problems: 1) During this transfer, not all of the footage is making it across. I import it, and then get the much-talked about "one or more P2 clips failed to import; probable incomplete or corrupt clips" warning. After checking the original video folder on the internal hard drive and comparing it to the number of clips FCP imported, I learned that I had lost around 20 clips/video files at one point. Other shooting day transfers worked completely smoothly with all of the files imported (we split up the footage by shooting day, without touching or changing the CONTENTS folders). So, some transfers work and some don't. And 2) When I try to import the files from our 4th day of shooting, I get a "Selected path does not contain a P2 volume." Nothing is imported.
    So, that's my situation, and I'm getting very desperate. I know that I'm not doing things in the Apple-supported way, but I'm really hoping there's still someway to successfully get the files from the external hard drive into FCP completely. It seems to work some of the time.
    Final notes: When importing, I make sure to import the entire CONTENTS folder. There is never a LASTCLIP.TXT file listed under it in the window, but some of the days of footage have transferred perfectly, so I'm hoping that's not a dealbreaker. If it is, isn't there some way to rebuild a lastclip.txt file? I don't even know if that's the issue. And one last note: In most of my folders, the "CLIP" folder has a number of files in it. In the 4th day's footage that I can't import at all, I noticed that the CLIP folder is empty. And on the days where FCP isn't importing all the files (like I mentioned above), there isn't a CLIP file for every single VIDEO file. Could this be the main problem? Along this line, is there a way to somehow put the footage on the external hard drive back through a p2 card and then into the Mac?
    Okay, I'll stop typing. Thank you so, so much for any help.
    Tom
    PowerMac G5 (Dual 2.3 GHz)   Mac OS X (10.4.6)   Quicktime 7.1.1 - Final Cut Pro 5.1 - Aforementioned External Hard Drive: LaCie Brick (FAT 32 based)
    PowerMac G5   Mac OS X (10.4.6)  

    The problem didn't turn out to be as complicated as I had thought. The process I described above ended up working fine, and I'll explain how. And this is a cool workaround, because the AppleCare helpers told me that they didn't think it would work (FCP P2 import is only supported straight from the P2 card/viewer or the camera).
    I hooked up my external hard drive to the Power Mac G5, and copied the files and folders onto my internal scratch disk. Then, I opened FCP and chose IMPORT -> Panasonic P2. I chose the "CONTENTS" folder for each day's filming, and imported them in, no problems. There was no visible "lastclip.txt" file shown (under the "CONTENTS" folder or anywhere else), but this didn't seem to cause any problems.
    The reason that not all of the footage was bring imported (the aforementioned "one or more P2 clips failed..." warning) was because we were missing clip files (in the CLIP folder) corresponding to certain video files (in the VIDEO folder). Luckily, we had just forgotten to transfer all of them from the original external hard drive, and once we transfered them completely, FCP could read all the video files. FCP needs a clip file for every video file in order to make it work (that's why our aforementioned "Day 4" could not be read; we hadn't copied all of the clip files over with the video files).
    Even after we did this, we STILL were getting the "one or more P2 clips..." warning for our Day 5. After taking a look at all the folders, we figured out that there were still more files in the VIDEO folder than in the CLIP folder, even after we transferred them all over. Finally, we figured out what had happened. For some reason, some of the audio files for some of the clips had been included in the VIDEO folder for our Day 5. There is no way we did this accidentally; somehow, the HVX200 placed some of the audio files into both the VIDEO and AUDIO folders. And FCP was trying to read those as video files, and therefore couldn't find the corresponding clips in the CLIP folder. After making sure that those audio files were also in the AUDIO folder, we simply deleted them from the VIDEO folder and stopped getting the "failed to import" warning.
    Final thing to share: If we had actually been unable to find the corresponding clip files in our original external hard drive, we had also found a potential solution (that we didn't end up needing to try). You can record from FCP back onto the P2 card, in the hopes that the clip files would be regenerated when you re-import it into FCP. I received a PDF file about this process, and I'm not sure how to put it up on the page here. If interested in this described process (which, again, I can't fully vouch for), feel free to email me at [email protected] and I can forward it to you.
    Hope this helps.
    PowerMac G5   Mac OS X (10.4.6)  
    PowerMac G5   Mac OS X (10.4.6)  

  • How do i download my files from an external hard drive to my new macbook pro

    how do i dowload my files from my external hard drive onto my new macbook pro?

    Can you not just drag them from the external drive to a folder on your new computer?

  • How do i switch wma files from an external hard drive to mp3 on itunes?

    how do i switch wma files from an external hard drive to mp3 on itunes?

    Can you not just drag them from the external drive to a folder on your new computer?

  • How do i copy my files from my external hard drive onto my imac

    how do i copy my files from my external hard drive onto my imac

    You should be able to 'migrate them' without having to do so during a reinstall, from an external drive. In some cases, you may be able to use TimeMachine software even if the drive had not been used as a backup.
    The usual way, though, is to drag & drop copy from one to another (volume or folder) you created in there and have open. Or drag an item on top of the icon of a hard disk drive when it is mounted on the desktop. I'm used to working with open folders and windows, because that works best; and then see if I want to change how things look inside their destination. This helps should I later want to burn them to a DVD and have it correct. And I want to know where they are.
    I had more links to some information about importing or migrating data into a Mac from an external, a week ago, but can't find them now. A few good links to pages, but I think I posted what I did find directly to answer someones question about it; and believe the info was in an Apple Support article about TimeMachine, near the lower part of the page with blue words with a disclosure triangle, so you could read more in that page. But I don't believe these two are correct in that TimeMachine (some versions) only allow wireless backup to a drive in a base station unit such as Apple sells, for this. The link I saw simply said how to work around not using the wireless stuff. Maybe it was a dated item, not in these?
    See a main general portal to TimeMachine support,
    here: http://www.apple.com/support/timemachine/
    Or basics that may not provide optional copy methods:
    Mac Basics - Time Machine backs up your mac:
    http://support.apple.com/kb/ht1427
    Perhaps a search of Apple Support database (or even ASC discussions?) would yield ideas, and perhaps find what may work for the kind of files you want to copy, and where they can be found & used later. Are the files for specific applications? Or images, music, etc?
    Good luck & happy computing!
    edited.

  • Delete file from an FTP folder

    Hi expert,
    I wanna know if it's possible delete with abap command a file from a FTP folder.
    I mean, there is a ftp folder periodically filled with excel files. An ABAP program read this folder and the files content must be moved in a SAP Table. Aftre this, I must delete excel files with an abap command write in the same abap program.
    Thanks a lot
    Michele Garofalo

    1) read directory with fm EPS_GET_DIRECTORY_LISTING
    2) process table dir_list
    and 3) finally delete files with
    abap command:  DELETE DATASET dsn.
    hope that helps
    Andreas

  • HT203200 Cannot delete the file from the itunes folder

    I cannont delete the file from the itunes folder because it tells me I need permission to do so.  I am the admin person for the laptop plus I have checked my permissions under the security tab in the files properties.  How do I delete this file to start again?  It downloaded 1.2GB of the file before the error message appeared, so its paid for and all but not looking like I'll get to watch it before the time runs out on the movie being available for me to watch. :-(

    Try deleting the file without iTunes running.
    When you next open iTunes it should then be marked as a missing file and you should be able to delete the entry from iTunes.
    Hope this works
    Regards,
    Colin R.

Maybe you are looking for

  • ITunes 6.0.1.3 not syncing Outlook Contacts or Calendar with ipod Nano 4GB

    I have Outlook 2003 installed and setup with a Microsoft Exchange Server. I have about 200 contacts currently stored in it. I recently purchased a ipod nano 4gb with hopes of syncing my contacts and calendar with that and being able to throw away my

  • How do I choose a different adobe ID in creative cloud?

    I have a MAC which has had a previously had another Adobe ID installed on it (I don't have access to that account or the email address it's associated with). I'm trying to sign up with a new Adbobe ID I just created but every time I install the Creat

  • How can i change the colour of makeup in a photo?

    hi there i have a photo with red bluch on her checks and blue eye shadow. both colors are too strong and i would like to remove or at least reduce them please. also can you make cheek bones less prominant? in case you havn't figured it out, i am a ne

  • Unable to return from a column link to popup page in the same window

    Using 3.2 I have a tabform with a link to a pop-up page (and passing values). It's working fine but when I 'Save' on the pop-up, instead of returning to the originating page, it opens up a new window with the originating page on it. How do I get back

  • Cant change my bbm profile picture

    Ever since i updated to the new OS, my bbm profile pic has not been updated. My software release is : 10.1.0.273. OS versipn : 10.1.0.1720. This is very frustrating, pls help