Uploading/Downloading table to/from *.csv - file

Hi all.
First I need to upload this internal table (actually it is a copy of database table) to a file *.csv, and then to be able to download the table back from it.
All this should be done using field symbols and methods GUI_UPLOAD, GUI_DOWNLOAD from class CL_GUI_FRONTEND_SERVICES.
*-- STRUCTURE OF INTERNAL TABLE
TYPES: BEGIN OF in_tab,
        mandt TYPE zng_so_head-mandt,
        so_num TYPE zng_so_head-so_num,          "type numc
        vend_num TYPE zng_so_head-vend_num,      "type numc
        cust_num TYPE zng_so_head-cust_num,      "type numc
        so_date TYPE zng_so_head-so_date,        "type dats
       END OF in_tab.
*-- INTERNAL TABLE HOLDING LIST DATA
DATA res_tab TYPE TABLE OF in_tab WITH HEADER LINE.
START-OF-SELECTION.
SELECT h~mandt h~so_num h~vend_num h~cust_num h~so_date
INTO TABLE res_tab FROM zng_so_head AS h.
thanks all.
Message was edited by:
        nikolai gurlenia

Hi,
I hope following code will solve your problem.
DATA : it_itab  TYPE TABLE OF string WITH HEADER LINE,
       v_file1  TYPE rlgrap-filename,
       v_file2  TYPE string.
CALL FUNCTION 'F4_FILENAME'
  IMPORTING
    file_name = v_file1.
v_file2 = v_file1.
CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename                = v_file2
  CHANGING
    data_tab                = it_itab[]
  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
    not_supported_by_gui    = 17
    error_no_gui            = 18
    OTHERS                  = 19.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF it_itab[] IS NOT INITIAL.
  CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
      filename                = v_file2
    CHANGING
      data_tab                = it_itab[]
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      not_supported_by_gui    = 22
      error_no_gui            = 23
      OTHERS                  = 24.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDIF.
Reward points if the answer is helpful.
Regards,
Mukul

Similar Messages

  • How to use LSMW to upload database table directly from flat file extract

    Hi Guru's,
    I am new to LSMW tool. I have searched the fourm before posting this thread for my issue but i didn't find any good posts for the same.
    my requirement is : I will have a flat ( tab -delimited ) or Excel file with number of records downloaded using the databrowser for some of standard tables from one SAP systesm  . I wanted to upload the records using the LSMW  to the same tables  in some other SAP systesm . Please help me to How to upload the same using the LSMW.
    Thanks & Regards,
    Praveen.

    Hi Praveen,
    There is a risk trying to migrate data directly into standard tables because this can generate database inconsistences or wrong inserted data according to what is customized in the target system. I do not recommend migrate like this. 
    With LSMW you use objects like direct input programs, idocs, bapis and recorded batch input. Try to create a project and use an standard object for your data. Also, check in SXDA transaction (Goto-->DX programs) if there is a standard program for your data.
    Anyway, if you want to upload data directly to tables, read below thread:
    ["UPLOAD  CSV  FILE";
    [how to upload .csv file into a custom table;
    Regards,
    Roger

  • Random Records are being skipped while uploading data in PSA from CSV File

    Hi Experts,
    I am facing issue in data uploading in PSA through CSV file, Random Records are being skipped while uploading data in PSA.
    First Load
    We have flat file (.txt in CSV format), which contains 380240 Records.
    We are uploading the flat file data into PSA from Application Server. But it uploads Only 380235 records, 5 Records are being skipped.
    Second Load
    We have re-generated same file next day, which contains same No of Records (380240), but this time it uploads Only 380233 records, 7 Records are being skipped.
    We found 1 skipped record (based on key columns combination, by cross verifying from source and PSA table) from First load. But same records (combination of key column) is available in second load. It means same records are not being skipped every time.
    Earlier (5 months ago) , We have loaded 641190 Records from flat file in same PSA and all records (641190) were uploaded successfully.
    There is no change is Source, PSA and flat file structure.
    Thanks & Regards
    Bijendra

    Hi Bijendra,
        Please check in the file if at the begining if it has got any excape sign then that record may be skipped so the records may be mssing
    Please check the excape sign like ; if they are present at the beginign that recor entirely will be skipped.
    Regards
    vamsi

  • Loading data from .csv file into existing table

    Hi,
    I have taken a look at several threads which talk about loading data from .csv file into existing /new table. Also checked out Vikas's application regarding the same. I am trying to explain my requirement with an example.
    I have a .csv file and I want the data to be loaded into an existing table. The timesheet table columns are -
    timesheet_entry_id,time_worked,timesheet_date,project_key .
    The csv columns are :
    project,utilization,project_key,timesheet_category,employee,timesheet_date , hours_worked etc.
    What I needed to know is that before the csv data is loaded into the timesheet table is there any way of validating the project key ( which is the primary key of the projects table) with the projects table . I need to perform similar validations with other columns like customer_id from customers table. Basically the loading should be done after validating if the data exists in the parent table. Has anyone done this kind of loading through the APEX utility-data load.Or is there another method of accomplishing the same.
    Does Vikas's application do what the utility does ( i am assuming that the code being from 2005 the utility was not incorporated in APEX at that time). Any helpful advise is greatly appreciated.
    Thanks,
    Anjali

    Hi Anjali,
    Take a look at these threads which might outline different ways to do it -
    File Browse, File Upload
    Loading CSV file using external table
    Loading a CSV file into a table
    you can create hidden items in the page to validate previous records before insert data.
    Hope this helps,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • Loading data from .csv file into Oracle Table

    Hi,
    I have a requirement where I need to populate data from .csv file into oracle table.
    Is there any mechanism so that i can follow the same?
    Any help will be fruitful.
    Thanks and regards

    You can use Sql Loader or External tables for your requirement
    Missed Karthick's post ...alredy there :)
    Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM

  • Loading records from .csv file to SAP table via SAP Program

    Hi,
    I have a .csv file with 132,869 records and I am trying to load it to an SAP table with a customized SAP program.
    After executing the program, only 99,999 records are being loaded into the table.
    Is there some setting to define how many records can be loaded into a table? Or what else could be the problem?
    Pls advice.
    Thanks!!!

    hi Arun ,
    A datasource need a extract structure to fetch data .It is nothing but a temp table to hold data.
    First you need to create atable in SE11 with fields coming from CSV file.
    Then you need to write a report program to read you CSV file and populate your table in BW .
    Then you can create a datasource on top of this table .
    After that replicate and load data at PSA and use to upper flow.
    Regards,
    Jaya Tiwari

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

  • SQL* Loader Loading specific column from CSV file to the table

    Dear All,
    Iam Loading specific column from .CSV file to the oracle table.
    Could pls help how i can load only that cols into the table
    Eg: CSV file having id, Frst_name,Last_name, Address,Phone,Insurance etc
    out of this I want to load only Frst_name,Last_name columns to oracle table say fname and lname.
    Thanks in Adv.
    Junu

    Lily,
    I made some changes to your table def but you will get the idea
    -- Table EMPLOYEE
    CREATE TABLE EMPLOYEE
      EMPID        NUMBER                           NOT NULL,
      EMPNICKNAME  VARCHAR2(10 BYTE)                    NULL,
      FNAME        VARCHAR2(20 BYTE)                NOT NULL,
      MI           VARCHAR2(20 BYTE)                    NULL,
      LNAME        VARCHAR2(20 BYTE)                NOT NULL,
      FULLNAME     VARCHAR2(20 BYTE)                NOT NULL,
      HIREDATE     DATE                             DEFAULT SYSDATE               NOT NULL
    --  data file employee.dat
    1,amy,b,amy b
    2,cindy,d,cindy d
    3,eric,f,eric f
    4,gary,h,gary
    -- Control file : Employee.ctl ( you can use truncate, replace or append , see sqlldr for more options)
    load data
    Truncate into table employee
    fields terminated by ","
    optionally enclosed by '"'
    TRAILING NULLCOLS
    empId INTEGER EXTERNAL,
    FName char(20),
    LName char(20),
    FullName char(30)
    now to load use following or you can speicify infile in control fle
    sqlldr username/passowrd control=employee.ctl  data=employee.dat log=employee.log
    {code}
    Hope this help.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL bulk copy from csv file - Encoding

    Hi Experts
    This is the first time I am creating a PowerShell script and it is almost working. I just have some problems with the actual bulk import to SQL encoding from the text file since it replaces
    special characters with a question mark. I have set the encoding when creating the csv file but that does not seem to reflect on the actual bulk import. I have tried difference scenarios with the encoding part but I cannot find the proper solution for that.
    To shortly outline what the script does:
    Connect to Active Directory fetching all user - but excluding users in specific OU's
    Export all users to a csv in unicode encoding
    Strip double quote text identifiers (if there is another way of handling that it will be much appreciated)
    Clear all records temporary SQL table
    Import records from csv file to temporary SQL table (this is where the encoding is wrong)
    Update existing records in another table based on the records in the temporary table and insert new record if not found.
    The script looks as the following (any suggestions for optimizing the script are very welcome):
    # CSV file variables
    $path = Split-Path -parent "C:\Temp\ExportADUsers\*.*"
    $filename = "AD_Users.csv"
    $csvfile = $path + "\" + $filename
    $csvdelimiter = ";"
    $firstRowColumns = $true
    # Active Directory variables
    $searchbase = "OU=Users,DC=fabrikam,DC=com"
    $ADServer = 'DC01'
    # Database variables
    $sqlserver = "DB02"
    $database = "My Database"
    $table = "tblADimport"
    $tableEmployee = "tblEmployees"
    # Initialize
    Write-Host "Script started..."
    $elapsed = [System.Diagnostics.Stopwatch]::StartNew()
    # GET DATA FROM ACTIVE DIRECTORY
    # Import the ActiveDirectory Module
    Import-Module ActiveDirectory
    # Get all AD users not in specified OU's
    Write-Host "Retrieving users from Active Directory..."
    $AllADUsers = Get-ADUser -server $ADServer `
    -searchbase $searchbase -Filter * -Properties * |
    ?{$_.DistinguishedName -notmatch 'OU=MeetingRooms,OU=Users,DC=fabrikam,DC=com' `
    -and $_.DistinguishedName -notmatch 'OU=FunctionalMailbox,OU=Users,DC=fabrikam,DC=com'}
    Write-Host "Users retrieved in $($elapsed.Elapsed.ToString())."
    # Define labels and get specific user fields
    Write-Host "Generating CSV file..."
    $AllADUsers |
    Select-Object @{Label = "UNID";Expression = {$_.objectGuid}},
    @{Label = "FirstName";Expression = {$_.GivenName}},
    @{Label = "LastName";Expression = {$_.sn}},
    @{Label = "EmployeeNo";Expression = {$_.EmployeeID}} |
    # Export CSV file and remove text qualifiers
    Export-Csv -NoTypeInformation $csvfile -Encoding Unicode -Delimiter $csvdelimiter
    Write-Host "Removing text qualifiers..."
    (Get-Content $csvfile) | foreach {$_ -replace '"'} | Set-Content $csvfile
    Write-Host "CSV file created in $($elapsed.Elapsed.ToString())."
    # DATABASE IMPORT
    [void][Reflection.Assembly]::LoadWithPartialName("System.Data")
    [void][Reflection.Assembly]::LoadWithPartialName("System.Data.SqlClient")
    $batchsize = 50000
    # Delete all records in AD import table
    Write-Host "Clearing records in AD import table..."
    Invoke-Sqlcmd -Query "DELETE FROM $table" -Database $database -ServerInstance $sqlserver
    # Build the sqlbulkcopy connection, and set the timeout to infinite
    $connectionstring = "Data Source=$sqlserver;Integrated Security=true;Initial Catalog=$database;"
    $bulkcopy = New-Object Data.SqlClient.SqlBulkCopy($connectionstring, [System.Data.SqlClient.SqlBulkCopyOptions]::TableLock)
    $bulkcopy.DestinationTableName = $table
    $bulkcopy.bulkcopyTimeout = 0
    $bulkcopy.batchsize = $batchsize
    # Create the datatable and autogenerate the columns
    $datatable = New-Object System.Data.DataTable
    # Open the text file from disk
    $reader = New-Object System.IO.StreamReader($csvfile)
    $columns = (Get-Content $csvfile -First 1).Split($csvdelimiter)
    if ($firstRowColumns -eq $true) { $null = $reader.readLine()}
    Write-Host "Importing to database..."
    foreach ($column in $columns) {
    $null = $datatable.Columns.Add()
    # Read in the data, line by line
    while (($line = $reader.ReadLine()) -ne $null) {
    $null = $datatable.Rows.Add($line.Split($csvdelimiter))
    $i++; if (($i % $batchsize) -eq 0) {
    $bulkcopy.WriteToServer($datatable)
    Write-Host "$i rows have been inserted in $($elapsed.Elapsed.ToString())."
    $datatable.Clear()
    # Add in all the remaining rows since the last clear
    if($datatable.Rows.Count -gt 0) {
    $bulkcopy.WriteToServer($datatable)
    $datatable.Clear()
    # Clean Up
    Write-Host "CSV file imported in $($elapsed.Elapsed.ToString())."
    $reader.Close(); $reader.Dispose()
    $bulkcopy.Close(); $bulkcopy.Dispose()
    $datatable.Dispose()
    # Sometimes the Garbage Collector takes too long to clear the huge datatable.
    [System.GC]::Collect()
    # Update tblEmployee with imported data
    Write-Host "Updating employee data..."
    $queryUpdateUsers = "UPDATE $($tableEmployee)
    SET $($tableEmployee).EmployeeNumber = $($table).EmployeeNo,
    $($tableEmployee).FirstName = $($table).FirstName,
    $($tableEmployee).LastName = $($table).LastName,
    FROM $($tableEmployee) INNER JOIN $($table) ON $($tableEmployee).UniqueNumber = $($table).UNID
    IF @@ROWCOUNT=0
    INSERT INTO $($tableEmployee) (EmployeeNumber, FirstName, LastName, UniqueNumber)
    SELECT EmployeeNo, FirstName, LastName, UNID
    FROM $($table)"
    try
    Invoke-Sqlcmd -ServerInstance $sqlserver -Database $database -Query $queryUpdateUsers
    Write-Host "Table $($tableEmployee) updated in $($elapsed.Elapsed.ToString())."
    catch
    Write-Host "An error occured when updating $($tableEmployee) $($elapsed.Elapsed.ToString())."
    Write-Host "Script completed in $($elapsed.Elapsed.ToString())."

    I can see that the Export-CSV exports into ANSI though the encoding has been set to UNICODE. Thanks for leading me in the right direction.
    No - it exports as Unicode if set to.
    Your export was wrong and is exporting nothing. Look closely at your code:
    THis line exports nothing in Unicode"
    Export-Csv -NoTypeInformation $csvfile -Encoding Unicode -Delimiter $csvdelimiter
    There is no input object.
    This line converts any file to ansi
    (Get-Content $csvfile) | foreach {$_ -replace '"'} | Set-Content $csvfile
    Set-Content defaults to ANSI so the output file is converted.
    Since you are just dumping into a table by manually building a recorset why not just go direct.  You do not need a CSV.  Just dump theresults of the query to a datatable.
    https://gallery.technet.microsoft.com/scriptcenter/4208a159-a52e-4b99-83d4-8048468d29dd
    This script dumps to a datatable object which can now be used directly in a bulkcopy.
    Here is an example of how easy this is using your script:
    $AllADUsers = Get-ADUser -server $ADServer -searchbase $searchbase -Filter * -Properties GivenName,SN,EmployeeID,objectGUID |
    Where{
    $_.DistinguishedName -notmatch 'OU=MeetingRooms,OU=Users,DC=fabrikam,DC=com'
    -and $_.DistinguishedName -notmatch 'OU=FunctionalMailbox,OU=Users,DC=fabrikam,DC=com'
    } |
    Select-Object @{N='UNID';E={$_.objectGuid}},
    @{N='FirstName';Expression = {$_.GivenName}},
    @{N='LastName';Expression = {$_.sn}},
    @{N=/EmployeeNo;Expression = {$_.EmployeeID}} |
    Out-DataTable
    $AllDUsers is now a datatable.  You can just upload it.
    ¯\_(ツ)_/¯

  • Display data from CSV file in iWeb page

    Hi,
    I like to display data from a CSV file in iWeb page if a date value from CSV file matches todays value from the system. Here is an example.
    CSV data values
    01/20/2011,Sunny,87
    01/21/2011,Cloudy,100
    01/22/2011,Rainy,60
    If today's date value is 01/21/2011 the page should display 01/21/2011 Cloudy 100 in a tabular format.
    Appreciate your help in providing HTML code for this issue.
    Thanks

    I suspect there is a soft return in the excel database somewhere that can't be seen. Take the csv/txt file into notepad and look for a line that starts oddly compared to the others.
    I haven't had luck removing soft returns from excel files so I do this a rather odd way. I take the excel file into InDesign as a table, and then use find/change to replace any soft returns with nothing, then convert the text to table and then export the text out again by going export, and selecting text from the dropdown menu.
    For my money, I always save tab delimited text files from excel so that if a field does contain commas, it doesn't "trick" indesign into thinking a new field is beginning or not... instead the field delimiters are tabs and they are unlikely to have been used in the excel database.
    If you do choose to use this indesign import method of mine to clean up the database, i also noticed two things in your screengrab: first was that some fields have spaces at the start of the text... easy enough to fix with a GREP that looks for ^\s (start of a sentence followed by a space) and replace with nothing. The second thing is the T&C field that all entries (at least in the screengrab) all start the same – if all entries in the database start the same, couldn't that line be in the indesign file? Its only a small detail I know.

  • Problem in converting table data into CSV file

    Hi All,
    In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
    com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
    SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
    And i used below code for converting.......
    import string
    import java.sql as sql
    import java.lang as lang
    import re
    sourceConnection = odiRef.getJDBCConnection("SRC")
    output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
    myStmt = sourceConnection.createStatement()
    my_query = "select FROM E$_COMPANY"*
    *my_query=my_query.upper()*
    *if string.find(my_query, '*') > 0:*
    *myRs = myStmt.executeQuery(my_query)*
    *md=myRs.getMetaData()*
    *collect=[]*
    *i=1*
    *while (i <= md.getColumnCount()):*
    *collect.append(md.getColumnName(i))*
    *i += 1*
    *header=','.join(map(string.strip, collect))*
    *elif string.find(my_query,'||') > 0:*
    *header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
    *else:*
    *header = my_query[7:string.find(my_query, 'FROM')]*
    *print header*
    *old=output_write.read()*
    *output_write.seek(0)*
    *output_write.write (header+'\n'+old)*
    *sourceConnection.close()*
    *output_write.close()*
    Any one can you help regarding this
    Edited by: 30021986 on Oct 1, 2012 6:04 PM

    This may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
    You will need to change your content type to application/vnd.ms-excel.
    <% response.setContentType("application/vnd.ms-excel"); %>

  • How to refer/store  a vaue from csv file in control file

    Hi,
    Consider the following control file script.
    Load data
    infile 'suv.csv'
         append      into table mast_equipmnet_test
    fields terminated by "," optionally enclosed by '"'     
    TRAILING NULLCOLS
    equipment_id,
    sub_vehicle_type,
    ebiz_carrier_no expression "(select ebiz_carrier_no from mast_carrier where carrier_id=?)",
    licence_no,
    equip_type,
    ebiz_appown_no,
    ebiz_equip_no sequence(1,1)
    here is my csv file
    CABNO,          SUBTYPE     CARRIER_ID               REG_NO,     VEHICLE_TYPE,          EBIZ_APPOWN_NO
    6954,          SUMO,          SWAMY,                         6954,          SUV,                    228
    9183,          SUMO,          SWAMY,                         9183,          SUV,                    228
    3173,          QUALIS,          SWAMY,                         3173,          SUV,                    228
    In my csv file i have carrier_ids which are string values in 3rd column.
    for every carrier_id ,the corresponding ebiz_carrier_no(numeric value) is stored in a master table called "mast_carrier".
    While loading the data i need to fetch the ebiz_carrier_no for each carrier_id from mast_carrier table .
    but here i got strucked in the where clause of select statement.
    I am not able to refer the carrier_id from csv file in where clause.
    can any body tell me how to refere a value from csv file in the select statement of control file script.
    cheers
    RRK

    Sorry..
    "EXPRESSION" is not needed..
    ebiz_carrier_no "(select ebiz_carrier_no
    from mast_carrier
    where carrier_id=:ebiz_carrier_no )",
    <br>
    <br>
    "Tested" as
    <br>
    load data
    infile *
    into table t truncate
    fields terminated by ','
    (id,
    name "(select ename from emp
                       where empno = :name)"
    begindata
    1,7900
    2,7902
    <br>
    QL> select * from t;
           ID NAME
            1 JAMES
            2 FORD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Import From CSV File statement runs forever, no error, does not finish

    Hello,
    I am trying to import a CSV file in a JAVA program, with the following statement:
    IMPORT FROM CSV FILE '/debug/testdatabase/FILE.csv'
    INTO "JOSEPH"."TEST_TABLE"
    WITH COLUMN LIST IN FIRST ROW
    RECORD DELIMITED BY '\n'
    FIELD DELIMITED BY '\t' ERROR LOG '/debug/testdatabase/file.err'
    THREADS 10
    BATCH 10000
    I have two HANA instances on different machines A and B:
    Both machines run HANA version 1.00.74.00.389160 (NewDB100_REL), while the OS is
    SUSE Linux Enterprise Server 11.1 on machine A and
    SUSE Linux Enterprise Server 11.2 on machine B.
    The statement above runs fine on machine A and the rows are imported properly from JAVA as well as when executed from HANA Studio SQL console.
    If I copy the file to machine B and try the exact same statement with the same file, it does not finish (neither from JAVA nor from HANA Studio SQL console). There is no error either. It cannot be cancelled, only a HANA restart stops the statement. Also the sample file I use has only 2 rows, and memory does not seem to be a problem.
    I seem to have a similar problem to the one described here, but the answers there do not help me: http://scn.sap.com/thread/3396582 I specified the record delimiter, and I used a python script to check for any strange characters that are not supposed to be there, but didn't find any.
    If I copy the file to my windows PC and use the "File Menu -> Import -> SAP Hana Content -> Data from Local file" function, it imports the file correctly into B, but I need to be able to do it from JAVA.
    Machine A administration view:
    Machine B administration view:
    If you have any idea what might cause this behavior or where I can find more information on this problem please give me a hint.

    Hi Joseph,
    First from the pics, the revision of your SAP HANA instance is 73 instead of 74. Since I have no identical environment, I cannot test it for you. But can you try the simplest scenario? You can create a table with only one column table try to import a CSV file with only one row.
    Best regards,
    Wenjun

  • Download table data from se16 to excel

    Hi I am trying to download table data from SE16 (field widths, descriptions etc) to Excel, but cannot as the option local file is greyed out under System>List>Save.
    Table>Print doesn't let mn downlaod either, jsut print. As I have 50 tables to download, is there a better option than copy and paste into excel?
    Thanks

    Hi,
    You can use the T-code SE11 for downloading the values from database table, after entering Table name ,
    click on Display (F7), it will take you to new screen, then enter (CtrlAltF10),
    Now enter the input values and execute.
    Kindly check with this.
    Best Regards,
    Vasu.

  • Trigger while importing from .csv file

    hey
    i am importing data from .csv file into a table called temp.
    .csv file is having column sales. the data in that also contains some empty filed or N/A or -
    sales coulmn in my table is NUMBER.
    so while importing some column are not able to import.
    how to write a trigger to eliminate '-' or 'N/A' or ' ' values from the sales column before inserting into the table

    It might be easier if the field on temp was a varchar2 field instead?
    The values entered should be loaded into this field and you can then use the trigger to test the values and convert these into numbers or nulls before inserting onto the proper data table.
    Check out the TO_NUMBER() function in SQL for info on how to convert strings to numbers.
    Regards
    Andy

Maybe you are looking for

  • IPod nano error with windows vista?

    Ive had the ipod for a few months now and using this computer have loaded a few songs 2 it. When I pluged up 2 watch some movies it gave me this message.. **This computer is no longer athorized 2 play perchased itums that are on the iPod Mine. Would

  • Many times Firefox do not load any webpage and after refresh/reload it open, Why?

    Many times firefox do not open the web page and TRY AGAIN message comes but when refresh or reload button pressed, immediately page loads. This happen regularly. == This happened == Every time Firefox opened == last month

  • FITV_POWL_TRIPS new button

    Hi all, I would like to add a new button to the FITV_POWL_TRIPS web dynpro that opens me a popup for another link (e.g. http://www.sdn.sap.com) I already manage to put that button on screen by setting the metod GET_ACTIONS of feeder. My problem is on

  • Unable to perform a V2V to a CSV in Virtual Machine Manager if there is insufficient disk space on the local drive

    Server 2012 R2 with 60 Gb SSD mirror http://support.microsoft.com/kb/2685247 does not work, as the attached vhdx storage never appears as volume in VMM / Fabric / Host / Properties / Storage Disk shows there, but no volume (even one was created) VMM

  • IVerio for converting MOD files??

    Hi, I have been looking through this forum up and down for decent suggestions regarding MOD files from a newly purchased JVC Everio camcorder. I am using iMovie6 and MOD files will not work the conventional way like miniDV etc. Should've bought a DV