How to read a spread sheet ( .xls ) file using a pl/sql procedure or func

Hello All,
Is it possible to read a spread sheet using Oracle pl.sql .
I know their is a util package that is read a file but how to read a spread sheet ... ?
thanks
kumar

hi kumar,
Here is an example of how i read an excel file
DECLARE
l_start_file_name varchar2(50) := 'invoice_excel_c';
l_end_file_name varchar2(50)   := '.csv';
l_file_name varchar2(100);
l_sql varchar(32767);
refresh_cdc varchar2(5) := '00304';
begin
l_file_name := l_start_file_name||REFRESH_CDC||l_end_file_name;
l_sql :=
'create table exter_invoice_excel               '||
'(                                              '||
'Product_name                varchar2(255),     '||
'Net_Sales                   Number,            '||
'Net_Adjustments             Number,            '||
'Cancels_Count               Number,            '||
'Cancels_Amount              Number,            '||
'Cashes_Count                Number,            '||
'Cashes_Amount               Number,            '||
'Claims_Count                Number,            '||
'Claims_Amount               Number,            '||
'Returns_Count               Number,            '||
'Returns_Amount              Number,            '||
'Free_Prize_Count            Number,            '||
'Free_Prize_Amount           Number,            '||
'Free_Promo_Count            Number,            '||
'Free_Promo_Amount           Number,            '||
'Promo_Credit_Count          Number,            '||
'Promo_Credit_Amount         Number,            '||
'Return_Commission           Number,            '||
'Net_Discounts               Number,            '||
'Total_Fees                  Number,            '||
'Sales_Commission            Number,            '||
'Cash_Commission             Number,            '||
'Tkt_Charge                  Number,            '||
'Subscription_Commission     Number,            '||
'Interim_Sweeps              Number,            '||
'Net_Due                     Number,            '||
'Retailer_id                 Number,            '||
'Retailer_Name               varchar2(255)      '||
')                                              '||
              'ORGANIZATION EXTERNAL (                 '||
              ' TYPE oracle_loader                     '||
               ' DEFAULT DIRECTORY GTECHFILES          '||
               ' ACCESS PARAMETERS (                   '||
               '   RECORDS DELIMITED BY NEWLINE        '||
               '      CHARACTERSET WE8MSWIN1252        '||
               '   BADFILE ''invoice_excel.bad''       '||
               '   DISCARDFILE ''invoice_excel.dis''   '||
               '   LOGFILE ''invoice_excel.log''       '||
               '   FIELDS TERMINATED BY '','' RTRIM      '||
               '  MISSING FIELD VALUES ARE NULL        '||
               '   )                                   '||
               '   LOCATION ('''||l_file_name||''')    '||
               ' )                                     '||
               'PARALLEL                               '||
               'REJECT LIMIT UNLIMITED ';
        execute immediate l_sql;
      l_sql:=  'INSERT INTO INVOICE_EXCEL_TEMP                '||
                  ' ( Product_name               ,            '||
                  '  Net_Sales                   ,            '||
                  '  Net_Adjustments             ,            '||
                  '  Cancels_Count               ,            '||
                  '  Cancels_Amount              ,            '||
                  '  Cashes_Count                ,            '||
                  '  Cashes_Amount               ,            '||
                  '  Claims_Count                ,            '||
                  '  Claims_Amount               ,            '||
                  '  Returns_Count               ,            '||
                  '  Returns_Amount              ,            '||
                  '  Free_Prize_Count            ,            '||
                  '  Free_Prize_Amount           ,            '||
                  '  Free_Promo_Count            ,            '||
                  '  Free_Promo_Amount           ,            '||
                  '  Promo_Credit_Count          ,            '||
                  '  Promo_Credit_Amount         ,            '||
                  '  Return_Commission           ,            '||
                  '  Net_Discounts               ,            '||
                  '  Total_Fees                  ,            '||
                  '  Sales_Commission            ,            '||
                  '  Cash_Commission             ,            '||
                  '  Tkt_Charge                  ,            '||
                  '  Subscription_Commission     ,            '||
                  '  Interim_Sweeps              ,            '||
                  '  Net_Due                     ,            '||
                  '  Retailer_id                 ,            '||
                  '  Retailer_Name               ,            '||
                  '  SOURCE                      ,            '||
                  '  INSERTED_DATE               ,            '||
                  '  CDC                         ,            '||
                  '  UPLOADED                                 '||
                  ')                                          '||
'              select                                         '||
                  '  ltrim(rtrim(product_name)) ,             '||
                  '  Net_Sales                   ,            '||
                  '  Net_Adjustments             ,            '||
                  '  Cancels_Count               ,            '||
                  '  Cancels_Amount              ,            '||
                  '  Cashes_Count                ,            '||
                  '  Cashes_Amount               ,            '||
                  '  Claims_Count                ,            '||
                  '  Claims_Amount               ,            '||
                  '  Returns_Count               ,            '||
                  '  Returns_Amount              ,            '||
                  '  Free_Prize_Count            ,            '||
                  '  Free_Prize_Amount           ,            '||
                  '  Free_Promo_Count            ,            '||
                  '  Free_Promo_Amount           ,            '||
                  '  Promo_Credit_Count          ,            '||
                  '  Promo_Credit_Amount         ,            '||
                  '  Return_Commission           ,            '||
                  '  Net_Discounts               ,            '||
                  '  Total_Fees                  ,            '||
                  '  Sales_Commission            ,            '||
                  '  Cash_Commission             ,            '||
                  '  Tkt_Charge                  ,            '||
                  '  Subscription_Commission     ,            '||
                  '  Interim_Sweeps              ,            '||
                  '  Net_Due                     ,            '||
                  '  Retailer_id                 ,            '||
                  '  Retailer_Name               ,            '||               
                  ' '''||l_file_name                           ||''', '||
                  '   sysdate                    ,            '||
                  ' '''||    REFRESH_CDC                       ||''', '||
                  '''N'''                                      || 
                  'FROM                                       '||
                  'exter_invoice_excel                        '||
                  'WHERE retailer_id is not null and ltrim(rtrim(product_name)) in (''Loto'',''Inst Tk'')';
        execute immediate l_sql;   
        l_sql :='drop table exter_invoice_excel';
        execute immediate l_sql;
exception
when others then
rollback;
l_sql :='drop table exter_invoice_excel';
execute immediate l_sql;
debug_message('INVOICE_EXCEL_UPLOAD/'||REFRESH_CDC,'Unexpected Error '||sqlerrm);
END;
--truncate table invoice_excel_tempjust go through the code, it would help u for sure
cheers

Similar Messages

  • How to get Header in Downloaded .xls file using  GUI_Download function

    How to get Header in Downloaded .xls file using  GUI_Download function ???
    How to use the the Header parameter available in GUI_Download function .

    HI,
    see this sample code..
    data : Begin of t_header occurs 0,
           name(30) type c,
           end of t_header.
    data : Begin of itab occurs 0,
           fld1 type char10,
           fld2 type char10,
           fld3 type char10,
           end   of itab.
    DATA: v_pass_path TYPE string.
    append itab.
    itab-fld1 = 'Hi'.
    itab-fld2 = 'hello'.
    itab-fld3 = 'welcome'.
    append itab.
    append itab.
    append itab.
    append itab.
    append itab.
    t_header-name = 'Field1'.
    append t_header.
    t_header-name = 'Field2'.
    append t_header.
    t_header-name = 'Field3'.
    append t_header.
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension     = 'XLS'
        IMPORTING
          fullpath              = v_pass_path.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_pass_path
          filetype                        = 'DBF'
        TABLES
          data_tab                        = itab
          FIELDNAMES                      = t_header
    Cheers,
    jose.

  • How to load decimal values into a file using bcp in SQL Server 2000?

    Hi everyone,
    I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
    Here are the DDLs and DMLs of what I'm trying to run:
    CREATE TABLE [dbo].[Product_Sales](
    [Year_of_Sale] [smallint] NOT NULL,
    [Product_Type] [varchar](25) NOT NULL,
    [Product_Group] [varchar](25) NOT NULL,
    [Category_Type] [varchar](25) NOT NULL,
    [Category_Group] [varchar](10) NOT NULL,
    [Product_Count] [bigint] NOT NULL,
    [Product_Amount] [decimal](19, 2) NOT NULL,
    [Category_Count] [bigint] NOT NULL,
    [Category_Amount] [decimal](19, 2) NOT NULL,
    CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
    [Year_of_Sale] ASC,
    [Product_Type] ASC,
    [Product_Group] ASC,
    [Category_Type] ASC,
    [Category_Group] ASC
    ) ON [PRIMARY]
    ) ON [PRIMARY]
    INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
    VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
    EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
    And the output I see in the file is:
    2010 Online Web Cameras Electronics 547 .00 0 .00
    The values before decimals are being truncated.
    Thanks,
    Bangaaram
    Known is a DROP, Unknown is an OCEAN.

    You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
    alter table [dbo].[Product_Sales]
    Alter column [Product_Amount] varchar(20)
    alter table [dbo].[Product_Sales]
    Alter column [Category_Amount] varchar(20)
    Does that make any sense?
    Known is a DROP, Unknown is an OCEAN.
    Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
    Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
    Known is a DROP, Unknown is an OCEAN.

  • How to read an image from an file using jsp

    reading an image from an file present on local disk using jsp

    Server-local or client-local? First, File I/O, second: better get a new job.

  • How to read data from the excel file using java code.

    Hi to all,
    I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
    advance thanks....
    import java.io.*;
    import java.sql.*;
        public class sample{
                 public static void main(String[] args){
                      Connection connection = null;
                          try{
                               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                               Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
                               Statement st = con.createStatement();
                               ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
                               System.out.println("sample:"+rs);
                                  ResultSetMetaData rsmd = rs.getMetaData();
                                  System.out.println("samplersd:"+rsmd);
                               int numberOfColumns = rsmd.getColumnCount();
                                  System.out.println("numberOfColumns:"+numberOfColumns);
                                   while (rs.next()) {
                                            System.out.println("sample1:"+rs);
                                            for (int i = 1; i <= numberOfColumns; i++) {
                                                 if (i > 1) System.out.print(", ");
                                                 String columnValue = rs.getString(i);
                                                 System.out.print(columnValue);
                                            System.out.println("");
                                       st.close();
                                       con.close();
                                      } catch(Exception ex) {
                                           System.err.print("Exception: ");
                                           System.err.println(ex.getMessage());
                        }

    1: What is the name of the excel sheet?
    2: What is printed in this program? null ? anything?
    error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
    ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
    sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
    samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
    numberOfColumns:2

  • How to read client's home directory files using  signed applets

    hi
    i want to konw the exact procedure for the creation of signed applets . using that i want to read my client files....
    Thanks
    Dileep

    google: http://www.google.com/search?q=how+to+sign+an+applet

  • How to read the data of  a file using upload option....

    Hi Frndz..
    As per my requirment , i need to provide a upload UI to the user , so he can select file to be upload whenever user select the file n clicks on upload button i need to read the data of that fiel that user selects.
    I have a solutions for this in JSP/JAVA , but i was unable to handle this in web dynpro..c this link in jsp ..
    http://www.roseindia.net/jsp/fileupload.shtml
    Thanks in Advance..
    Regards
    Rajesh

    Hi,
    Create a Value attribute (resource) of type Resource, bind it with the property of File Upload UI element.
    On action place the code and Deploy the application
    byte[] bytes = new byte[ 1024];
    FileOutputStream out = new FileOutputStream( new File( <path in server>));
    InputStream in = resource.read( true);
    int len;
    while( ( len = in.read( bytes)) > 0)
         out.write( bytes, 0, len);
    in.close();
    out.close();
    Regards
         Vinod V

  • Reading Multiple lines in a file Using File Adapter

    Hi All,
    Iam new to this technology.How to read multiple lines in a file using file adapter.Brief me with the methodology.

    I didn't look at anything else but if you want to write more than one line ever to your file you should change this
    out = new FileOutputStream("Calculation.log");to this...
    out = new FileOutputStream("Calculation.log",true);A quick look at the API reveals the follow constructor FileOutputStream(File file, boolean append) append means should I add on the end of the file or over-write what is there.
    By default you over-write. So in our case we say true instead which says add on to what is there.
    At the end of that little snippet you shoudl be closing that stream as well.
    So where you have
    p.close();You should have
    p.close();
    out.close();

  • How to specify path to read E$ tab records into .xls file using odisqlunlod

    Hi
    Can any one help me how to specify specific path in odisqlunload tools which is useful for both windows and linux.
    I am developing and testing in windows and moving generated scenario into linux box to test for testing people
    If in case any error out records are populated in E$ table then how that records will populated on xls file, later I am sending that attachement for email notification to concern people
    Below code is present in odisqlunload tool
    OdiSqlUnload "-FILE=d:\ODI_Error_Out_Files\Notification_Error_Records.xls" "-DRIVER=oracle.jdbc.OracleDriver" "-URL=jdbc:oracle:thin:@10.75.114.146:1521:POCWCDS" "-USER=wcds" "-PASS=h2yXeih4hFlXXV,QaMeRR2Fy" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from E$_notification
    Please help how to make a single code which is useful and work on both windows and linux
    Any sugession willl help me
    Thanks in advance
    Regards,
    Phanikanth

    Hi Bhabani,
    I have written below code in KM itself and select technology as Java BeanShall
    Code:
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/Middleware/logs/wcds/odi_logs/<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=<%=odiRef.getInfo("DEST_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("DEST_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("DEST_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("DEST_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from <%=odiRef.getTable("L","ERR_NAME", "W")%>
    It was executed well and below is the Execution code of the above code
    Execution Code:
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\1341360.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/Middleware/logs/wcds/odi_logs/1341360.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=oracle.jdbc.OracleDriver" "-URL=jdbc:oracle:thin:@10.75.114.146:1521:POCWCDS" "-USER=wcds" "-PASS=<@=snpRef.getInfo("DEST_ENCODED_PASS") @>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from WCDS.E$_CDS_COMPANY
    Please confirm me if the above Code is correct or not, if Not, please correct it and DESC_ENCODE_PASS is not encoding the password
    Regards
    Phanikanth
    Edited by: Phanikanth on Feb 18, 2013 1:09 AM

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read MG1, MGU, SG1, SGU files?

    I have copies of Band in a Box and Aebersold music software, from an older PC.
    How to read MG1, MGU, SG1, SGU files on my MacBook Air?
    Many thanks, Antoine

    I believe in Linux/Unix, everything is treated as a file descriptor, be it a disk, socket, hardware device or an actual file. Since Java will simply call the appropriate method (length() for example) on the descriptor, I would imagine it would be up to the operating system to determine what to return. If I ask for the length() of a socket, I'm not sure what it would return. The bytes not flushed in the buffer? Total transmitted? Some random uid? I'm sure it is defined somewhere but the behavior may not be what you expect. See if you can use a 'vanilla' command-line method to get the file length from that device. If it too returns zero, you know it's not your program.
    - Saish

  • How to read the complete path in file upload UI

    Hi,
    I want to know how to read the complete path in file upload UI in java web dynpro.
    I have created 1 file upload UI and than when i do browse and select some file say small.jpg from my local PC, desktop , its path is coming in file upload UI like E:\small.jpg,
    I want to know how to get this path in java webdynpro code.
    please let me know..

    Hi Satyam,
    In webdynpro java, first file stores in server location then it reads from server.
    Create a button with upload and write this code OnAction
    Resource is the attribute name in context of type com.sap.ide.webdynpro.uielementdefinitions.Resource, this attribute is for Resource property for Upload UI Element.
    Then in OnAction of button
    InputStream text = null;
           int temp=0;
           try{
                File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
               String path = file.getAbsolutePath();
                wdComponentAPI.getMessageManager().reportSuccess(path);
           }catch(Exception e){
                e.printStackTrace();
        //@@end
    Regards,
    Pradeep
    Edited by: pradeep_546 on May 11, 2011 12:22 PM

  • How to read and upload microsoft word file into database using forms9i

    Hi,
    How to read and upload microsoft word file into oracle database using forms9i. I appretiate if anyone can send me example or atleast a sujjetion.
    Thanks in advance
    Mahesh Ragineni

    The webutil package includes the ability up upload from the client to the database. See otn.oracle.com/products/forms and click on webutil for more details.
    Regards
    Grant Ronald
    Forms Product Management

  • How to read contents of a property file sequentially

    hello all,
    please can any one tell me how to read contents of a property file sequentially.
    i saw most of the classes provided by JAVA API, which get All keys and there return type is enumeration which dosent preserve , or may the getKeys() method of those classes do not preserve the sequential order.
    Kindly do let me know if anyone has done this before.
    Thanks.

    The best solution is that you redesign your program so that it does not depend on the order of the entries in the properties file.
    If you really want to stay with your design, you will have to read the properties file yourself, line by line, just like you would read any other text file, and parse the content of each line yourself.
    BufferedReader in = new BufferedReader(new FileReader("stuff.properties"));
    String line;
    while ((line = in.readLine()) != null) {
        // Parse the line, use e.g. String.split() to split it around the '='
    in.close();

  • How to get field separator in flat file using GUI_DOWNLOAD function

    hi,
    how to get field separator in flat file using GUI_DOWNLOAD function.
                                    thanking you.

    Hi,
      Use WRITE_FIELD_SEPARATOR = 'X'.
      Check this sample code
    REPORT  z_file_download.
    DATA: w_name(90) TYPE c.
    DATA:
      BEGIN OF fs_flight,
        carrid   LIKE sflight-carrid,
        connid   LIKE sflight-connid,
        fldate   LIKE sflight-fldate,
        price    LIKE sflight-price,
        currency LIKE sflight-currency,
      END OF fs_flight.
    DATA:
      BEGIN OF fs_head,
        carrid(10) TYPE c,
        connid(10) TYPE c,
        fldate(10) TYPE c,
        price(10) TYPE c,
        curr(10) TYPE c,
      END OF fs_head.
    DATA:
      t_head LIKE
       TABLE OF
             fs_head.
    DATA:
      t_flight LIKE
         TABLE OF
               fs_flight.
    fs_head-carrid = 'CARRID'.
    fs_head-connid = 'CONNID'.
    fs_head-fldate = 'FLDATE'.
    fs_head-price  = 'PRICE'.
    fs_head-curr   = 'CURRENCY'.
    APPEND fs_head TO t_head.
    SELECT-OPTIONS:
      s_carrid FOR fs_flight-carrid.
    START-OF-SELECTION.
      SELECT carrid
             connid
             fldate
             price
             currency
        FROM sflight
        INTO TABLE t_flight
       WHERE carrid IN s_carrid.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = 'D:\flight.xls'
       FILETYPE                      = 'ASC'
    *   APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    *   CONFIRM_OVERWRITE             = ' '
    *   NO_AUTH_CHECK                 = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   WRITE_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = t_head
    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
       OTHERS                        = 22
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'D:\flight.xls'
          filetype                = 'ASC'
          append                  = 'X'
          write_field_separator   = 'X'
        TABLES
          data_tab                = t_flight
        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
          OTHERS                  = 22.
      IF sy-subrc EQ 0.
        MESSAGE 'Download successful' TYPE 'I'.
      ENDIF.
      IF sy-subrc <> 0.
    *  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

Maybe you are looking for

  • How to reboot a macbook pro with no cd

    i'm having trouble downloading a cd to my computer its asking for my password. i put it in but it won't take. so i try to change it, but it say that it the wrong one. so have can it reboot my macbook pro without the cd

  • Modifying cold fusion script not picked up by iis

    We are running coldfusion 7, using iis6 on windows 2003 server. I am not a cold fusion developer and this is the only coldfusion script we have created by a previous developer. I needed to make some simple modifications to the script, including a cha

  • How do I stop iTunes connection to iStore when it starts up?

    Title says it all really. I can't see any obvious way of stopping iTunes trying to connect every time, is there any way of doing this?

  • Saved logons (user ids & password) are not filling out logons

    I have user ids and passwords saved but when I navigate to the site for which the user id and password are saved, the logon fields are no longer being filled. These are valid logons which worked under older versions of Firefox. I've looked for any se

  • Can't start photoshop no any error

    My Photoshop stopped working. I couldn't start it. You click on the icon and nothing happen. I uninstalled and reinstalled software. Problem still not resolved.