Export data in CSV and store the file in local drive

Hi,
Here is the requirements.
Fetch the values from table (around 60000 records), and export them into CSV file and store the file in local drive.
I have written servlet to to this and it is working fine expect saving the file in local drive. At the moment, it is asking to save as in local drive. i want to save the file automatically in particular path (/var/www/files/). Below is the code.
String file = "CandidatesDetails" + sd + ".csv";
                    queryString = "select * from candidate where candidate.status='A'";
                    connection = ConnectionPoolHelper.getConnection();
                    response.setContentType("application/csv");
                    response.setHeader("content-disposition", "filename=" + file);
                    System.out.println("Query= " + queryString);
                    ps = connection.prepareStatement(queryString,
                              ResultSet.TYPE_SCROLL_INSENSITIVE,
                              ResultSet.CONCUR_READ_ONLY);
                    rs = ps.executeQuery();
                    datas = "CANDIDATE ID,CANDIDATE TITLE,FIRST NAME,LAST NAME,E-MAIL,NATIONALITY ID,NATIONALITY,COUNTRY ID,COUNTRY NAME,INDUSTRY ID,INDUSTRY DESCRIPTION,EXPERIENCE,DATE OF BIRTH,HEAR ABOUT US\n";
                    oout.write(datas);
                    String country = "";
                    String nationality = "";
                    String hearABtUs = "";
                    while (rs.next()) {
                         nationality = rs.getString(7);
                         if (nationality == null)
                              nationality = "";
                         else if (nationality.equals("null"))
                              nationality = "";
                         country = rs.getString(9);
                         if (country == null)
                              country = "";
                         else if (country.equals("null"))
                              country = "";
                         hearABtUs = rs.getString(14);
                         if (hearABtUs == null)
                              hearABtUs = "";
                         else if (hearABtUs.equals("null"))
                              hearABtUs = "";
                         else
                              hearABtUs = hearABtUs.replaceAll(",", ";");
                         datas = rs.getInt(1) + "," + rs.getString(2) + ","
                                   + rs.getString(3) + "," + rs.getString(4) + ","
                                   + rs.getString(5) + "," + rs.getInt(6) + ","
                                   + nationality + "," + rs.getInt(8) + "," + country
                                   + "," + rs.getInt(10) + "," + rs.getString(11)
                                   + "," + rs.getString(12) + "," + rs.getString(13)
                                   + "," + hearABtUs + "\n";
                         oout.write(datas); Regards,
Dongan.

Here is the first few lines
public void doGet(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException {
          HttpSession session = request.getSession(true);
          String datas = "";
          PreparedStatement ps = null;
          ResultSet rs = null;
          String queryString = "";
          Connection connection;
          PrintWriter oout = response.getWriter();
          java.util.Date d = new java.util.Date();
          SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMM-yyyy");
          String sd = dateformat.format(d);
          tryAt the moment, when i run http://localhost:8080/project/CandidatesDetail, it will ask me to save the file somewhere. I should manually mention the path to save the file. what i want is, it should automatically save it in the location C:\projects\files\.
thanks.
Regards,
Dongan
Edited by: Dongan on Oct 26, 2007 5:22 AM

Similar Messages

  • How to export data to .csv and send that file to folder using sql commands?

    Really hoping someone can provide some code sample or point me in the right direction (with examples using sql).
    I am using oracle 11g with plsql developer. My requirement is that the data retrieval should be automatic. That means when query a data in oracle table , the data should be convert into .csv file and then it should send that to some specific folder.
    Example: Assume that student_sub1 table have all students subject1 data.when i write a query like select * from student_sub1 where student=1, the student1 data should convert into .csv file and then the .csv file should go to student1 folder.
    Hence I am requesting you to suggest me how write a sql code to convert the data into .csv file and to create a folder to send that file using oracle.
    Your inputs helps me alot.
    Thanks in advance!!!!
    Waiting for your replies.... Cheers

    981145 wrote:
    Really hoping someone can provide some code sample or point me in the right direction (with examples using sql).
    I am using oracle 11g with plsql developer. My requirement is that the data retrieval should be automatic. That means when query a data in oracle table , the data should be convert into .csv file and then it should send that to some specific folder.
    Example: Assume that student_sub1 table have all students subject1 data.when i write a query like select * from student_sub1 where student=1, the student1 data should convert into .csv file and then the .csv file should go to student1 folder.
    Hence I am requesting you to suggest me how write a sql code to convert the data into .csv file and to create a folder to send that file using oracle.
    Your inputs helps me alot.
    Thanks in advance!!!!
    Waiting for your replies.... CheersSET COLSEP ,
    spool student1.csv
    select * from student_sub1 where student=1;
    spool off
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ
    Handle:     981145
    Status Level:     Newbie
    Registered:     Jan 10, 2013
    Total Posts:     25
    Total Questions:     10 (8 unresolved)
    I extend my condolences to you since you rarely get answers to your questions here.

  • Read file and store the file into a string

    i want to read the file and copy it to a string.
    i wrote this code but don't know what to do next..
    please help me urgent.....
    File file_to_text = new File("c:\\wtgapp.xml");
    String wtgapp_string=new String();
    try
    BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file_to_text));
    catch (FileNotFoundException file_error)
    JOptionPane.showMessageDialog(null, "FILE READ ERROR", "READ ERROR!",JOptionPane.INFORMATION_MESSAGE );
    System.exit(1);
    }

    BufferedReader reader = new BufferedReader(new FileReader(file_to_text));
    try
    while(reader.readLine() !=)
    wtgapp_string = wtgapp_string+ reader.readLine();
    System.out.println(wtgapp_string);
    i did this..
    but reader.readLine() != null
    didn't work.
    what shoud i write? to go to the end of file
    no it is 16.00pm in here i live in TURKIYE istanbul :)

  • Missing Header Row When Exporting Data to Excel and Program Runs Slow

    Hello all,
    I am new to programming. I’ve dabbled with VB.NET at times over the years but this is the first time I’m trying C#. Although, it’s been quite a while since I’ve done any type of programming other than writing SQL queries at work. For the sake of trying to
    learn I have given myself a project that is something I can actually use at work. Right now I'm doing it at home. I’m querying a database on SQL Server 2008 R2; putting the data from the DB into a DataViewGrid and then exporting the data into Excel and saving
    the file on my C:\ drive. On the form I have two buttons; one that queries the DB and the other to do the export. The code below does work but I have two issues that I need assistance with:
    All of the SQL table data goes into Excel properly with the exception of it is missing the header row.
    After I click the Export button it takes a long time to create the Excel file. It takes between 2.5 and 3 minutes. It is not a big file (only 447 rows and 125 KB in size) so I don’t know why it takes so long. Does it have anything to do with the number
    of times Microsoft.Office.Interop.Excel is being referenced? I read somewhere online that is an old COM method although I’m not familiar with what a COM method is
    and why it would make things run so slow.
    When I click the button to run the SQL query and load the DataGridView it runs immediately.
    I plan on taking this project further such as adding date parameters including validation on the dates and then maybe adding buttons that can be used to insert, update and delete records. But I don’t want to go any further until the two issues mentioned
    above are resolved. Any assistance / guidance will be greatly appreciated. Here’s the code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using Exccel = Microsoft.Office.Interop.Excel;
    using System.IO;
    namespace Bills_DB_DataGridView
        public
    partial
    class
    Form1 :
    Form
    SqlCommand sqlCMD;
    SqlDataAdapter sqlDA;
            SqlCommandBuilder sqlCB;
    DataSet sqlDS;
    DataTable sqlDT;
    public Form1()
    InitializeComponent();           
    private
    void btnExit_Click(object sender,
    EventArgs e)
    this.Close();
    private
    void btnLoad_Click(object sender,
    EventArgs e)
    string sqlCon =
    "Data Source = localhost\\DAVE_DB; Initial Catalog=Bills;Integrated security = true;";
    string sqlQry =
    "SELECT * FROM Acct ORDER BY Name, PaymentDate";
    SqlConnection connection =
    new
    SqlConnection(sqlCon);
    connection.Open();
    sqlCMD = new
    SqlCommand(sqlQry, connection);
    sqlDA = new
    SqlDataAdapter(sqlCMD);
           sqlCB = new
    SqlCommandBuilder(sqlDA);
    sqlDS = new
    DataSet();
    sqlDA.Fill(sqlDS, "Acct");
    sqlDT = sqlDS.Tables["Acct"];
    connection.Close();
    dataGridView1.DataSource = sqlDS.Tables["Acct"];
                dataGridView1.SelectionMode =
    DataGridViewSelectionMode.FullRowSelect;
    private
    void btnExport_Click(object sender,
    EventArgs e)
    Microsoft.Office.Interop.Excel.Application xlApp;
    Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
    Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
    object misValue = System.Reflection.Missing.Value;
    Int32 i, j;
    xlApp = new Microsoft.Office.Interop.Excel.Application();        
    xlWorkBook = xlApp.Workbooks.Add(misValue);
    xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);          
    for (i = 0; i <= dataGridView1.RowCount - 2; i++)
    for (j = 0; j <= dataGridView1.ColumnCount - 1; j++)
    xlWorkSheet.Cells[i + 1, j + 1] = dataGridView1[j, i].Value.ToString();
    xlWorkSheet.Cells[1, 2].EntireColumn.NumberFormat = "@";
    //Format column 2 to text
    xlWorkSheet.Cells[1, 2].HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;
    xlWorkBook.SaveAs(@"c:\Bills\Bills.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal,
    misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
    xlWorkBook.Close(true, misValue, misValue);
    xlApp.Quit();
    releaseObject(xlWorkSheet);
    releaseObject(xlWorkBook);
    releaseObject(xlApp);
    private
    void releaseObject(object obj)
    try
    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
    obj = null;
    catch (Exception ex)
    obj = null;
    MessageBox.Show("Exception Occured while releasing object "
    + ex.ToString());
    finally
    GC.Collect();
    Thank you,
    Dave
    David Young

    Hello again Kristin,
    I tried the code snippet to include the headers in the Excel file but it didn't work for me. Maybe I put the code in the wrong place? Again I have put the code below including where I placed the snippet. I get no error message and the application runs. Am
    I doing something wrong?
    Thank you,
    Dave
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using Exccel = Microsoft.Office.Interop.Excel;
    using System.IO;
    namespace Bills_DB_DataGridView
        public partial class Form1 : Form
            SqlCommand sqlCMD;
            SqlDataAdapter sqlDA;
            SqlCommandBuilder sqlCB;
            DataSet sqlDS;
            DataTable sqlDT;
            public Form1()
                InitializeComponent();            
            private void btnExit_Click(object sender, EventArgs e)
                this.Close();
            private void btnLoad_Click(object sender, EventArgs e)
                string sqlCon = "Data Source = localhost\\DAVE_DB; Initial Catalog=Bills;Integrated security = true;";
                string sqlQry = "SELECT * FROM Acct ORDER BY Name, PaymentDate";
                SqlConnection connection = new SqlConnection(sqlCon);
                connection.Open();
                sqlCMD = new SqlCommand(sqlQry, connection);
                sqlDA = new SqlDataAdapter(sqlCMD);
                sqlCB = new SqlCommandBuilder(sqlDA);
                sqlDS = new DataSet();
                sqlDA.Fill(sqlDS, "Acct");
                sqlDT = sqlDS.Tables["Acct"];
                connection.Close();
                dataGridView1.DataSource = sqlDS.Tables["Acct"];
                dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            private void btnExport_Click(object sender, EventArgs e)
                Microsoft.Office.Interop.Excel.Application xlApp;
                Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
                Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
                object misValue = System.Reflection.Missing.Value;
                Int32 i, j;
                xlApp = new Microsoft.Office.Interop.Excel.Application();         
                xlWorkBook = xlApp.Workbooks.Add(misValue);
                // storing header part in Excel
                xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);  
                for (int h = 1; h < dataGridView1.Columns.Count + 1; h++)
                    if (dataGridView1.Columns[h - 1].Visible)
                        xlWorkSheet.Cells[1, h] = dataGridView1.Columns[h - 1].HeaderText;
                xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);           
                for (i = 0; i <= dataGridView1.RowCount - 2; i++)
                    for (j = 0; j <= dataGridView1.ColumnCount - 1; j++)
                        xlWorkSheet.Cells[i + 1, j + 1] = dataGridView1[j, i].Value.ToString();
                        xlWorkSheet.Cells[1, 2].EntireColumn.NumberFormat = "@"; //Format column 2 to text
                        xlWorkSheet.Cells[1, 2].HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;
                xlWorkBook.SaveAs(@"c:\Bills\Bills.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
    misValue, misValue, misValue, misValue, misValue);
                xlWorkBook.Close(true, misValue, misValue);
                xlApp.Quit();
                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
            private void releaseObject(object obj)
                try
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    obj = null;
                catch (Exception ex)
                    obj = null;
                    MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
                finally
                    GC.Collect();
    David Young

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • HT201250 Can I back up with time machine AND store additional files on the same external drive?

    I just bought an external drive to move and archive some files off my iMac to free up some space. I'm being asked if I want to use the drive to back up files with Time Machine. Can I use this drive to do both? (Back up with TM AND store other files?
    Your input is appreciated.

    Technically you can but it is not a very good idea at all. The reason it is a flawed idea is if the HD fails (not really if but when) you will have defeated the whole idea of backup. A failure means you will lose the data files you stored on it and it's backup! A good backup plan has at least 2 forms of backup because backups can fail too. I would strongly recommend getting at least one additional external HD and use it for storing the data files you wanted off the internal HD and use the second for a Time Machine backup drive.
    Personally I have 3 external HD's attached to my computer. Disk 1 is my Time Machine backup, Disk 2 is a Bootable Clone of my internal HD and Disk 3 stores my music, photography and movie libraries.
    Please read these articles, they will discuss different backup strategies and I think you will see that each suggest redundant backups.
    Backup Plan I
    Backup Plan II
    Backup Plan III

  • Export QuickTime file with new audio and maintain the file size and quality as the original.

    I shot some footage for a client yesterday and ran into an issue. To make a long story short I have QuickTime mov files shot with my Panasonic GH4 that have a buzzing sound in the audio track. I have clean audio from a recorder that can be sync'd. Is there a way for me to do this for the client and deliver them as the same QuickTime file but with the clean audio and keep the file size close to the original and not have quality loss in the image?
    If so I will probably put all of the spanned clips together from each interview and sync the audio before delivery. I am just not sure which codec will give the client the same quality footage compared to the originals and not have a massive difference in the overall file size. They did request that they be Quicktime MOV files though so that is a must.
    I don't see this as an option in the codecs in the export settings in PP, but is there a way to export as ProRes or another MAC native codec that will save them from having to convert it on their end? I am on a PC with Adobe CS5.5 so I am not too familiar with MACs, but from what I understand they would need to convert the files if I sent them straight out of the camera.
    I found some related search results for this but they pertained to "Best quality" for export. I am not sure how the varying options work but I don't want to create files that are considerably larger, just not less quality.
    If anyone has experience with this it would be greatly appreciated.
    Thanks,
    Cole

    Here's the workflow: I imported the video footage into iMovie '08 and did my edits. Then I exported it (share) to my desktop with compression set @ 740 X 480. Then I used QuickTime Pro to fix the audio track. The file plays perfectly with both audio tracks working. It's a QuickTime file (.mov).
    I hope this jars any replies as to why the file when uploaded to my iWeb gallery drops the second audio track.
    Hmm,
    Jack

  • HT4059 I got an error message that I should connect to Wi-Fi after trying to download a Book Sample from the iBooks Store. I still get this error message even after I bought, downloaded, and transferred the file to my iPad's iBook thru iTunes. Wi-Fi ain't

    I got an error message that I should connect to Wi-Fi after trying to download a Book Sample from the iBooks Store. I still get this error message even after I bought, downloaded, and transferred the file to my iPad's iBook thru iTunes. Wi-Fi ain't cheap.

    Hi I had a similar issue to you, I could connect to the router but no internet. Here is my explanation of how I sorted it.....I hope this works for you.
    *To anyone that is reading this it appears that the problem lay in the airport setting: IPV6: set to 'Automatically'. I turned it off (after reading someones plight on MacFixIt) & everything is back to normal.*
    *The worrying thing is although my problem was extreme with other computers on the network being locked out nothing was changed, one minute it worked the next it didn't. Reading on other forums it appears to be a problem with laptops (but I could be mistaken). A lot of people on the Macfixit forum are complaining of network just dropping out even when they are next to the router.*
    *I hope this is the fix (although I dont know why it suddenly went to sh*t!) & I hope my hair pulling & trawling the forums can help someone else out.*
    Much Respect
    Lammo

  • Ok, so I want to buy the new iPod touch 5g this week and I have an iPhone 4. I want to transfer all the data from the phone to the iPod and have the files the exact same. I don't want to redo data, say erase game data (campaigns, achievements)...

    Ok, so I want to buy the new iPod touch 5g this week and I have an iPhone 4. I want to transfer all the data from the iPhone to the iPod and have the files the exact same. I don't want to redo data, say erase game data (campaigns, achievements)... I have apps that have very important data on them and if I sync it to iTunes and then transfer all that data to the iPod Touch 5g, will that erase app data?

    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • How to execute unix command through odi and store the result in table

    I have to reconcile  if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not,  Please assist me how to make package/interface/procedure to  execute unix command and store result in oracle table.
    Thanks in Advance

    Use ODI OS command tool in the ODI package.
    create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target

  • Open, Write and Close the file using Powershell

    Hi All,
    I need to create/open a file and write some data into it and close that file.
    Could anyone please help me with this.
    Thanks.

    You don't need to explicitly create, open, or close a file in Powershell.  Here are some ways to write to a file, in addition to New-Item:
    $text = 'Hello World'
    # Create file:
    $text | Set-Content 'file.txt'
    #or
    $text | Out-File 'file.txt'
    #or
    $text > 'file.txt'
    # Append to file:
    $text | Add-Content 'file.txt'
    #or
    $text | Out-File 'file.txt' -Append
    #or
    $text >> 'file.txt'
    Grant Ward, a.k.a. Bigteddy
    The problem with Out-File is that it works like the console. When text is output, it will be truncated if it is wider than the default. So if you are looking for something where you need to store lots of long strings, then you may want to choose a different
    route, or ensure than you specify a width for your output.
    http://technet.microsoft.com/en-us/library/ee176924.aspx
    For example to get 200 characters of width:
    $text | Out-File
    'myfile.txt' -width 200
    I do not know for certain if there is a limit to how wide it can be. I also assume the default is the standard console width (80 characters I believe.)

  • How to store the File Name from a Unix Directory into a ODI variable?

    Hi,
    I have built a ODI package with the following steps:
    1. ODI is polling for a flat file in a Unix directory. I have used OdiFileWait tool for this purpose. Here the file name is not fixed, so I am using wild character (*) to poll for file. Example: DF*ABC1*.DAT where the first wild character denotes 1 letter and the second wild character denotes 2 digits.
    2. In the second step, if the file is found, I am moving the file to ODI file server path (../oracledi/demo/file). Here I have used ODIFileMove tool.
    3. Then I am using an ODI Interface to Load the file data into a Oracle database table.
    4. I am using a Process log table to keep the log for each step I am executing in ODI that is ODIFileWait, ODIFileMove, Interface etc. for each file. In this table a row needs to be inserted after ODIFileWait tool gets the file, with the File Name and File Date. Later on this row will be updated as the consequent steps are executed.
    Here is my concern, I need to get the exact File Name of the file after ODIFileWait gets the file and I need to insert that in the Process Log table after the ODIFileWait step gets a file. So if I can store the File Name in a ODI Variable, I can insert it into the Process log table at this point. This I am not able to do.
    The files are coming in a different directory (not in ODI file server path), So after getting the file it is moved to ODI file server path (../oracledi/demo/file)
    The Files which I am processing are fixed length format. Also, the File name and File Date is stored in the 1st Record(Header record) of the files.
    Kindly provide me suggestions to implement this in my code.
    Thanks and Regards,
    Anik
    Edited by: 809820 on Nov 10, 2010 11:36 PM

    Look at this link -http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory
    change the command to fetch the ls command and write into File and then using either java or jython break the data and fetch the file name and date and insert into log table.
    (or)
    you can use the os.system command and get the complete ls command into string and then process and insert it.
    Let us know if you need any other help.

  • Read data from .xls and store it in blob

    Hi,
    I am getting the file using CLIENT_GET_FILE_NAME. I need to read the data from the .xsl file and convert it into blob. The file should not be stored in DB.
    Please help me by providing suggestions / solutions.
    Thanks.
    Edited by: tharini on 10-Aug-2010 04:16

    InoL,
    You can use an OLE Container or you can use a database stored procedure to write the file to the BLOB or extract the file from the BLOB. Then, using WebUtil you can serve the file to the the user. Of course, you would use WebUtil to allow the user to upload the document to the server so you can call the stored proc to load the file into the BLOB.
    The file should not be stored in DB.Hence my question:
    Why do you want to store the raw data from the spreadsheet in a BLOB instead of the file in a BLOB?What is the business requirement and how do you plan on using the data once it is stored in the BLOB?
    If it is a hard requirment to not store the file, then tharnini has to figure out how to take the contents read from the .xls file using WebUtil and store this in the BLOB. More importantly, how do you take the contents of the file stored in the BLOB and write it back out to a file in the same format as the original file so the user can view the information.
    I've not done this using the aforementioned method - I've not done using the OLE container either. ;-)
    Craig...
    Edited by: CraigB on Aug 10, 2010 12:49 PM

  • How to fetch data from XML and store it in internal table

    Hi All,
    Can anyone help me out, in fetching data from xml and store it in an internal table. Is there any standard function module is there?
    Regards,
    Karthick

    to do this you can either develop a XSLT program and use it with CALL TRNSFORMATION key word to tranform the XML into itab .
    (search the ABAP General forum, i have posted few samples)
    or simply use the following FM which converts your XML into a itab of name value pair (name would holw the element name and value would hold the value of the element) which you can then loop and read it to your itb.
    data:             xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    CALL FUNCTION 'SMUM_XML_PARSE'
      EXPORTING
        xml_input       = xmldata
      TABLES
        xml_table       = result_xml
        return          = return .
    Regards
    Raja

  • Where does GUI_UPLOAD function store the files?

    Where does GUI_UPLOAD function store the files?

    Hi Audrey
    Here is an example of accessing files from application server: 
    open dataset w_file for input in text mode.
      if sy-subrc <> 0.
        message e895 with 'Unable to locate file'.
      else.
        do.
          read dataset w_file into it_data.
          if sy-subrc eq 4.            " End of file reached
            clear it_data.
            exit.
          else.
            append it_data.
            clear it_data.
          endif.
        enddo.
        close dataset w_file.
    In the above example, w_file is declared as string containing  c:\usr\sap\test.txt
    And this file should be there on this path on application server.
    And, yes, you need to declare it_data as an internal table containing fields corresponding to file from which you are reading data.
    Regards
    Ashish Jain
    [email protected]

Maybe you are looking for

  • EXCEPTION in REUSE_ALV_GRID_DISPLAY

    Hi All, This is my first post, and I would greatly appreciate any help. My question is, exactly what kind of error does the exception in REUSE_ALV_GRID_DISPLAY pick up on? what is the purpose of checking the subrc in REUSE_ALV_GRID_DISPLAY. I am curr

  • Ok writing DLLs in Java

    Can I compile a DLL using java! Or how about an ActiveX! And if I can how?

  • My photos won't sync in proper order in i0s4

    It used to be that they all loaded according to the filename within the folder so I was able to title the file by date and keep them chronologically sequenced. Now it seems to be stuck organizing them by creation date, which is incorrect for those ph

  • Clear desktop

    I seem to recall reading somewhere that one can have a desktop folder with files in it but have it set up so that none of the files would appear on the screen. T or F?

  • Ipod shuffle 1st gen

    i wish to find out can i use an ipod nano and a ipod shuffle 1st gen 512mb on 1 computer, as i wish 2 buy my child an ipod