Uploading text file (TAB delimited) to Oracle database table

Hi, im creating a form that will upload a text file(TAB delimited) that will insert a data in a database table. How would i do this? And what trigger will i use in the upload button? Please help..
Thanks,
Majic

hi majic,
Check any of this site related to oracle sql and plsql
and do reply me if not found.
1) http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/03_types.htm#LNPLS003
Oracle composite data type help
2) http://www.cs.umb.edu/cs634/ora9idocs/appdev.920/a96624/07_errs.htm#784
Oracle plsql help good one check out
3) http://www.orafaq.com/faqsql.htm#WHAT
Oracle frequently asked questions
4) http://www.bijoos.com/ora9/index.htm
Oracle diff version comparasion help in above no 4 web site
5) http://www.unix.org.ua/orelly/oracle/prog2/index.htm
Oracle oreilly hand book good book for oracle pl/sql
6) http://www.orafaq.com/glossary/faqgloss.htm#SQL_Loader
check out for oracle faq good one
7) http://www.rittman.net/archives/cat_oracle_9ias.html
check out for Froms10g Installation and much more
8) http://www.devarticles.com/c/a/Oracle/Creating-a-Database-in-Oracle-9i/2/
check this for creating a oracle database in 9i***
9) http://tahiti.oracle.com/
suggested my many user for oracle help..check out this also
10) http://www.jlcomp.demon.co.uk/faq/ind_faq.html
For Full oracle related questions and answer****
Regards,
Asif A K.

Similar Messages

  • Issues with external table from text file ( tab delimiter )

    Hello Guru,
    --Data in my file, file name : TEST1 ( tab delimiter )
    "C1" "C2"
    "test column1" "01/27/2012"
    "test column1" "01/27/2012"
    "test column1" "01/09/2012"
    -- Table
    CREATE TABLE EXT_TEST
    C1 VARCHAR2(50 BYTE),
    C2 VARCHAR2(12 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "TEST"
    ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE
    SKIP 1 FIELDS
    TERMINATED BY X'9' missing field VALUES are NULL REJECT ROWS
    WITH ALL NULL FIELDS ) LOCATION ( 'TEST1' )
    REJECT LIMIT UNLIMITED;
    -- my current output
    select * from EXT_TEST ;
    C1 C2
    "test column1" "01/27/2012"
    "test column1" "01/27/2012"
    "test column1" "01/09/2012"
    -- I need output in this way
    C1 C2
    "test column1" "01/27/2012"
    "test column1" "01/27/2012"
    "test column1" "01/09/2012"
    my version :
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for HPUX: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    Please help me resolve this and learn further steps.
    Thank You!

    Try this:
    -- Etc ---
    FIELDS TERMINATED BY X'9'
    OPTIONALLY ENCLOSED BY '"'
    missing field VALUES are NULL REJECT ROWS
    -- Etc ---
    {code}
    :p                                                                                                                                                                                                                                                                                                               

  • Saving a text file as CLOB into oracle database

    Hi techies,
    I have a text file, which I have to insert into the oracle database as a CLOB field. Please give me some code to read the file and store the contents of the file into the database.
    Thanks in advance
    Yogesh

    Hi,
    Please find attached sample code to read and write the data to the CLOB data type in the database.
    Here, the column name called "DATA" is defined as CLOB data type in the Database.
    Program Name : ClobSample.java
    JDK Version : jdk1.4
    import java.util.Properties;
    import java.util.Hashtable;
    import java.sql.*;
    import javax.sql.DataSource;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.util.*;
    import java.io.*;
    class ClobSample
         public static void main(String[] args) throws Exception
              Connection con = null;
              try
                   con = getConnection();
                   PreparedStatement ps = con.prepareStatement("INSERT INTO CLOBTEST(DATA) VALUES(?)");
                   String data = getMyString("c://mani.txt");
                   Reader reader = new StringReader(data);
                   ps.setCharacterStream(1, reader, data.length());
                   ps.executeUpdate();
                   System.out.println("DATA Inserted !!!!");
                   ps = con.prepareStatement("SELECT DATA FROM CLOBTEST");
                   ResultSet rs = ps.executeQuery();
                   Clob clob = null;
                   while (rs.next())
                        clob = rs.getClob("DATA");
                        System.out.println(clob.getSubString(1,(int)clob.length()));
              catch(Exception e)
                   e.printStackTrace();
              finally
                   if (con!= null)
                        con.close();
         private static Connection getConnection()
              Connection con = null;
              try
                   String url = "t3://10.3.26.16:9001";
                   Hashtable env = new Hashtable();
                   env.put(Context.INITIAL_CONTEXT_FACTORY, weblogic.jndi.WLInitialContextFactory.class.getName());
                   env.put(Context.PROVIDER_URL, url);
                   InitialContext initialContext = new InitialContext(env);
                   DataSource ob = (DataSource)initialContext.lookup("mcone.journal.txds.ds");
                   System.out.println("DataSource Object obtained--->"+ob);
                   con =ob.getConnection();
              catch(Exception exc)
                   exc.printStackTrace();
                   System.exit(0);
              return con;
         public static String getMyString(String File)
              byte a[] = null;
              try
                   InputStream fso = new FileInputStream(File);
                   a = new byte[fso.available()];
                   fso.read(a);
                   fso.close();
              catch(Exception e)
                   e.printStackTrace();
              System.out.println("DATA READ FROM THE FILE");
              return (new String( a,0,a.length));

  • Upload text file to oracle table with checking and aggregation

    Hi Friends,
    I am new to ODI.  I have encountered a problem which is specific to ODI 11G (11.1.1.6.3) to upload text file to oracle table with checking and aggregation.  Would you please teach me how to implement the following requirement in ODI 11G?
    Input text file a:
    staffCode, staffCat, status, data
    input text file b:
    staffCodeStart, staffCodeEnd, staffCat
    temp output oracle table c:
    staffCat, data
    output oracle table d:
    staffCat, data
    order:
    a.staffCode, a.staffCat, a.status
    filter:
    a.status = ‘active’
    join:
    a left outerjoin b on a.staffCode between b.staffCodeStart and b.staffCodeEnd
    insert temp table c:
    c.staffCat = if b.staffCat is not null then b.staffCat else a.staffCat
    c.data = a.data
    insert table d:
    if c.staffCat between 99 and 1000 then d.staffCat = c.staffCat, d.data = sum(c.data)
    else d.staffCat = c.staffCat, d.data = LAST(c.data)
    Any help on fixing this is highly appreciated. Thanks!!
    Thanks,
    Chris

    Dear Santy,
    Many thanks for your prompt reply.  May I have more information about the LAST or SUM step?
    I was successful to create and run the following interfaces p and q
    1. Drag text file a to a newly created interface panel p
    2. Filter text file a : a.status = ‘active’
    3. Lookup text file a to text file b : a.staffCode between b.staffCodeStart and b.staffCodeEnd
    4. Drag oracle temp table c to interface panel p
    5. Set c.staffCat : CASE WHEN b.staffCat IS NULL THEN a.staffCat ELSE b.staffCat END
    6. Set c.data : a.data
    7. Drag oracle temp table c to a newly created interface panel q
    8. Drag oracle table d to interface panel q
    9. Set UK to d.staffCat
    10. Set Distinct Rows to table d
    11. Set d.staffCat = c.staffCat
    12. Set d.data = SUM(c.data)
    However, the interface q should be more than that:
    If c.staffCat is between 99 and 1000, then d.data = the last record c.data; else d.data = sum(c.data)
    Would you please teach me how to do the LAST or SUM steps?  Moreover, can interface p and interface q be combined to one interface and do not use the temp table c?  Millions thanks!
    Regards,
    Chris

  • How to load text file data to Oracle Database table?

    By using Oracle Forms, how to load text file data to Oracle Database table?

    Metalink note 33247.1 explains how to use text_io as suggested by Robin to read the file into a Multi-Row block. However, that article was written for forms 4.5 and uses CREATE_RECORD in a loop. There was another article, 91513.1 describing the more elegant method of 'querying' the file into the block by transactional triggers. Unfortunately this more recent article has disappeared without trace and Oracle deny its existence. I know it existed as I have a printed copy in front of me, and very useful it is too.

  • How to import the data in a .xls or .xlsx file into a oracle database table

    Hi,
    Please tell me how to import the data in a .xls or .xlsx file into a oracle database table in Oracle 10gR2 using Oracle Warehouse Builder 10gR2.

    ....can we do something through Non-Oracle->ODBC?Yes, it is possible, look at this thread
    [SQLServer access from AIX Warehouse builder|http://forums.oracle.com/forums/thread.jspa?messageID=2502982]
    If your server (with target DB and OWB runtime) is on Windows OS this configuration will be simpler - you can use single server.
    And additional link on OWB blog (with 11g transparent gateway)
    [http://blogs.oracle.com/warehousebuilder/2008/01/11g_heterogeneous_agent.html]
    (configuring nonoracle connection with 10g generic connectivity very similar to 11g gateway)
    Also look at
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4406709207206#18830681837358
    Regards,
    Oleg

  • Upload text files with non-english characters

    I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
    What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
    Some other info:
    * I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
    * Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
    * NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)

    Hi
    Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
    Thanks,
    Manish

  • Uploading a file to be saved in database

    Hi all,
    I have a web application which users access through browser. There is a screen where I list certificates of a person from database. My requirement is that for a particular certificate, user will select a file and click Attach button. I then need to upload this file and saved in database for that certificate.
    What are the steps involved in uploading a file to be saved in database?
    <form>
    <input type="hidden" name="certificate_id" />
    <input type="file" name="certificate_file" />
    <input type="submit" value="Attach" />
    </form>Edited by: srhcan on Jun 16, 2012 8:48 AM

    Thanks guys for your help.
    My environment is Eclipse Indigo and JBoss 4.2.0. I have created a simple web application in to test Apache Commons FileUpload. This app consist of just one jsp and one servlet. The jsp has the input type file and is submitted to the servlet. The servlet prints out the file info. The 2 Commons jars fileupload and io are in WEB-INF\lib folder.
    I have tested it successfully when I run the Jboss from within Eclipse.
    But when I run the JBoss outside of Eclipse, I get this error message from servlet:
    2012-06-19 19:54:55,405 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[TestFileUpload].[FileUploadServlet]] Servlet.service() for servlet FileUploadServlet threw exception
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:199)
         at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:361)
         at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
         at com.abc.servlet.FileUploadServlet.doPost(FileUploadServlet.java:59)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
         at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:595)
    What could be the reason?
    This is the servlet:
    package com.abc.servlet;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.commons.fileupload.FileItem;
    import org.apache.commons.fileupload.FileItemFactory;
    import org.apache.commons.fileupload.FileUploadException;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    * Servlet implementation class FileUploadServlet
    public class FileUploadServlet extends HttpServlet {
         private static final long serialVersionUID = 1L;
         * @see HttpServlet#HttpServlet()
        public FileUploadServlet() {
            super();
            // TODO Auto-generated constructor stub
          * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
          * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              boolean isMultiPart = false;
              try {
                   // Check that we have a file upload request
                   isMultiPart = ServletFileUpload.isMultipartContent(request);
                   System.out.println("isMultiPart=" + isMultiPart);
                   if (isMultiPart) {
                        // Create a factory for disk-based file items
                        FileItemFactory fileItemFactory = new DiskFileItemFactory();
                        // Create a new file upload handler
                        ServletFileUpload servletFileUpload = new ServletFileUpload(fileItemFactory);
                        List fileItemsList = servletFileUpload.parseRequest(request);
                        FileItem fileItem = null;
                        String fileName = null;
                        InputStream inputStream = null;
                        long inputStreamSize = -1;
                        Iterator iter = fileItemsList.iterator();
                        while (iter != null && iter.hasNext()) {
                             FileItem fileItem1 = (FileItem) iter.next();
                             System.out.println("---fileItem1.isFormField()=" + fileItem1.isFormField());
                             if (fileItem1.isFormField()) {
                                  String fieldName = fileItem1.getFieldName();
                                  String fieldValue = fileItem1.getString();
                                  System.out.println("fieldName=" + fieldName);
                                  System.out.println("fieldValue=" + fieldValue);
                             } else {
                                  fileItem = fileItem1;
                        fileName = fileItem.getName();
                        inputStream = fileItem.getInputStream();
                        inputStreamSize = fileItem.getSize();
                        System.out.println("fileName=" + fileName);
                        System.out.println("inputStream=" + inputStream);
                        System.out.println("inputStreamSize=" + inputStreamSize);
                        inputStream.close();
                        System.out.println("inputStream closed");
              } catch (FileUploadException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Edited by: srhcan on Jun 19, 2012 8:04 PM

  • Uploaded text file has a new line added at the top using BSP MVC applicatio

    I have a BSP MVC application that uploads data on to the application server. When I open the uploaded text file, the very first line on the file looks like the line below. ->
    htmlb:button:click:nullhtmlb_form_1UploadUpload0htmlbdfsdf
    But the rest of the file looks okay. This is causing other than .txt files to get corrupted.
    Here is the code from my DO_HANDLE_EVENT.
    data: entity   type ref to if_http_entity,
          name     type string,
          content  type xstring,
          content_type type string,
          idx      type i value 1,
          v_root(26) value '
    houappl131\SRM_Download\',
          v_unxfile(100),
          v_transfer type xstring,
          v_type(6),
          v_len type i,
          v_dirfile type zfileinfo,
          v_ofile(80),
          v_guid type guid_32.
      class cl_htmlb_manager definition load.
      data:        v_asn(10) type n.
      data: fu        type ref to cl_htmlb_fileupload,
                       file_id   type string value 'batchfile'.
      data: o_page_context type ref to if_bsp_page_context.
      data: parent type ref to cl_bsp_controller2,
            lo_model                       type ref to cl_sus_m_asn_detail.
      o_page_context = me->get_page_context( ).
      cl_htmlb_manager=>dispatch_event_ex( request = request
      page_context = o_page_context
      event_handler = me ).
      refresh z_batch->message.
      if htmlb_event->server_event = 'Upload'.
        fu ?= cl_htmlb_manager=>get_data( request = request id = file_id name
                                             = 'fileUpload' ).
        if fu->file_name gt space.
              z_batch->parameters-fpath = fu->file_name.
              v_len = strlen( z_batch->parameters-fpath ).
              if v_len gt 4.
                v_len = v_len - 3.
              endif.
              v_type = z_batch->parameters-fpath+v_len(3).
              search z_batch->parameters-fpath for '.'.
              if sy-fdpos gt 0 and v_len gt 0.
                v_len = v_len - sy-fdpos.
                v_type = z_batch->parameters-fpath+sy-fdpos(v_len).
              endif.
              clear v_asn.
              v_asn = z_batch->parameters-asnhdr.
              concatenate v_asn
                          z_batch->parameters-asnitem
                          z_batch->parameters-batch
                          v_type
                          into v_unxfile separated by '.'.
              concatenate v_root v_unxfile into v_unxfile.
              condense v_unxfile no-gaps.
              open dataset v_unxfile for output in binary mode.
                while idx <= request->num_multiparts( ).
                  entity = request->get_multipart( idx ).
                  name = fu->file_name .
                  if name is not initial.
                    content_type = entity->get_header_field( 'Content-Type' ).
                    clear content.
                    content      = entity->get_data( ).
                    v_transfer = content.
                    transfer content to v_unxfile.
                    append content to z_batch->filetab.
                  endif.
                  idx = idx + 1.
                endwhile.
                close dataset v_unxfile.
            endif.
      endif.
    Here is my fileupload button in the view
    <htmlb:page title="File Upload " >
        <htmlb:form method       = "post"
                    encodingType = "multipart/form-data" >
          <htmlb:label id     = "Batchnum"
                       design = "Label"
                       for    = "Batchnumber"
                       text   = "Batch" />
          <htmlb:inputField id    = "Batchinput"
                            value = "//zbatch/parameters.batch" />
          <htmlb:fileUpload id="batchfile" />
          <htmlb:button id      = "Upload"
                        text    = "Upload"
                        onClick = "Upload" />
          <htmlb:button id      = "Close"
                        text    = "Close window"
                        onClick = "Close" />
    Any of you gurus know why this is happening?

    I solved it myself

  • How to list the JAR files loaded into the Oracle Database ?

    How to list the JAR files loaded into the Oracle Database ?

    From 11.1 onwards, the below two views are available to identify the jar files loaded into the Database.
    JAVAJAR$
    JAVAJAROBJECTS$
    By querying the JAVAJAR$ view you can know information about the JAR files loaded into the Database and using JAVAJAROBJECTS$ view you can find all the java objects associated with the given JAR file.
    These views are populated everytime you use LOADJAVA with "-jarsasdbobjects" option to load your custom java classes.
    But unfortunately this feature is available only from 11.1 onwards and there is no clear workaround for above in 10.2 or earlier.

  • How to upload text file

    hi
    i want to create BDC program for the data uploding.. but i dont hv much knwloadge of about it. i need to sample code the data upload program. i hv to upload text file format. im using gui_upload funtion  if u hv any sample plz send me it plz... thnx
    regad
    nawa

    Check the following code:
    Selection screen :
    SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-020.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
    PARAMETERS: p_locl  RADIOBUTTON GROUP g1                   " desktop file
                        DEFAULT 'X' USER-COMMAND fil,
                p_phys  RADIOBUTTON GROUP g1.                  " appln server file
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
    PARAMETERS: p_ifile  TYPE   dxfile-filename LOWER CASE,       " source file
                p_afile  TYPE   dxfile-filename LOWER CASE,       " asset class file
                p_cfile  TYPE   dxfile-filename LOWER CASE,       " Cost center file
                p_dfile  TYPE   dxfile-filename LOWER CASE,       " Depr key  file
                p_ofile  TYPE   dxfile-filename LOWER CASE.       " Audit file
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-015.
    PARAMETERS: p_test RADIOBUTTON GROUP g2 DEFAULT 'X',        " test run
                p_create RADIOBUTTON GROUP g2.                  " data migretion
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN END OF BLOCK b4.
    Main program :
    REPORT  zfaac900
            LINE-SIZE 132
            LINE-COUNT 65
            NO STANDARD PAGE HEADING
            MESSAGE-ID ZFAA.
    * includes
    INCLUDE: zfaac900_top,
             zfaac900_selection_screen,
             zfaac900_subroutine.
    * AT SELECTION SCREEN ON VALUE REQUEST
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ifile.
      PERFORM help_input_file USING p_phys p_locl CHANGING p_ifile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_afile.
      PERFORM help_asset_file USING p_phys p_locl CHANGING p_afile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cfile.
      PERFORM help_cost_file USING p_phys p_locl CHANGING p_cfile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
      PERFORM help_depr_file USING p_phys p_locl CHANGING p_dfile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ofile.
      PERFORM help_audit_file USING p_phys p_locl CHANGING p_ofile.
    * AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
      PERFORM check_screen USING p_ifile p_afile p_cfile p_dfile
                                 p_ofile p_locl p_phys.
    * TOP-OF-PAGE
    TOP-OF-PAGE.
      ULINE.
       PERFORM sjm_heading IN PROGRAM zacai0005.
      ULINE.
    * START_OF_SELECTION
    START-OF-SELECTION.
      PERFORM get_input USING    p_ifile p_afile p_cfile p_dfile
                        CHANGING i_input i_asset i_cost i_depr.
    Subroutines :
    *&      Form  help_input_file
    *        text
    FORM help_input_file  USING    p_phys_file   TYPE c
                                   p_locl_file   TYPE c
                          CHANGING p_source_path TYPE any.
      IF p_phys_file EQ 'X'.
        CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
          EXPORTING
            dynpfield_filename = 'P_IFILE'
            dyname             = sy-repid
            dynumb             = sy-dynnr
            filetype           = 'P'
            location           = 'A'.
      ELSEIF p_locl_file EQ 'X'.
        PERFORM help_local_file CHANGING p_source_path.
      ENDIF.
    ENDFORM.                    " help_input_file
    *&      Form  help_asset_file
    *       text
    FORM help_asset_file  USING    p_phys_file   TYPE c
                                   p_locl_file   TYPE c
                          CHANGING p_source_path TYPE any.
      IF p_phys_file EQ 'X'.
        CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
          EXPORTING
            dynpfield_filename = 'P_AFILE'
            dyname             = sy-repid
            dynumb             = sy-dynnr
            filetype           = 'P'
            location           = 'A'.
      ELSEIF p_locl_file EQ 'X'.
        PERFORM help_local_file CHANGING p_source_path.
      ENDIF.
    ENDFORM.                    " help_asset_file
    *&      Form  help_cost_file
    *       text
    FORM help_cost_file  USING     p_phys_file   TYPE c
                                   p_locl_file   TYPE c
                          CHANGING p_source_path TYPE any.
      IF p_phys_file EQ 'X'.
        CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
          EXPORTING
            dynpfield_filename = 'P_CFILE'
            dyname             = sy-repid
            dynumb             = sy-dynnr
            filetype           = 'P'
            location           = 'A'.
      ELSEIF p_locl_file EQ 'X'.
        PERFORM help_local_file CHANGING p_source_path.
      ENDIF.
    ENDFORM.                    " help_cost_file
    *&      Form  help_depr_file
    *       text
    FORM help_depr_file  USING     p_phys_file   TYPE c
                                   p_locl_file   TYPE c
                          CHANGING p_source_path TYPE any.
      IF p_phys_file EQ 'X'.
        CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
          EXPORTING
            dynpfield_filename = 'P_DFILE'
            dyname             = sy-repid
            dynumb             = sy-dynnr
            filetype           = 'P'
            location           = 'A'.
      ELSEIF p_locl_file EQ 'X'.
        PERFORM help_local_file CHANGING p_source_path.
      ENDIF.
    ENDFORM.                    " help_depr_file
    *&      Form  help_audit_file
    *        text
    FORM help_audit_file  USING    p_phys_file TYPE c
                                   p_locl_file TYPE c
                          CHANGING p_audit_path TYPE any.
      IF p_phys_file EQ 'X'.
        CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
          EXPORTING
            dynpfield_filename = 'P_OFILE'
            dyname             = sy-repid
            dynumb             = sy-dynnr
            filetype           = 'P'
            location           = 'A'.
      ELSEIF p_locl_file EQ 'X'.
        PERFORM help_local_file CHANGING p_audit_path.
      ENDIF.
    ENDFORM.                    " help_audit_file
    *&      Form  help_local_file
    *       Local File Path
    FORM help_local_file  CHANGING p_path TYPE any .
      DATA:  lt_file_table TYPE filetable,
             la_file_table LIKE LINE OF lt_file_table,
             l_rc TYPE i,
             l_pcdsn TYPE cffile-filename.
      REFRESH lt_file_table.
      CLEAR la_file_table.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        CHANGING
          file_table = lt_file_table
          rc         = l_rc.
      READ TABLE lt_file_table INTO la_file_table INDEX 1.
      l_pcdsn = la_file_table-filename.
      MOVE l_pcdsn TO p_path.
    ENDFORM.                    " help_local_file
    *&      Form  check_phys_file
    *      Validation of Physical  File
    FORM check_phys_file  USING  p_file TYPE any.
      DATA: l_str(300) TYPE c.
      CLEAR l_str.
      OPEN DATASET p_file IN TEXT MODE FOR INPUT ENCODING DEFAULT.
      IF sy-subrc <> 0.
        IF g_file_flag = 'I'.
          MESSAGE e000 WITH text-021.
        ELSEIF g_file_flag = 'A'.
          MESSAGE e000 WITH text-095.
        ELSEIF g_file_flag = 'C'.
          MESSAGE e000 WITH text-096.
        ELSEIF g_file_flag = 'D'.
          MESSAGE e000 WITH text-097.
        ENDIF.
      ENDIF.
      READ DATASET p_file INTO l_str.
      IF sy-subrc <> 0.
        IF g_file_flag = 'I'.
          MESSAGE e000 WITH text-017.
        ELSEIF g_file_flag = 'A'.
          MESSAGE e000 WITH text-098.
        ELSEIF g_file_flag = 'C'.
          MESSAGE e000 WITH text-099.
        ELSEIF g_file_flag = 'D'.
          MESSAGE e000 WITH text-100.
        ENDIF.
      ENDIF.
      CLEAR: g_file_flag.
      CLOSE DATASET p_file.
    ENDFORM.                    " check_phys_file
    *&      Form  check_local_file
    *       Validation of Local File
    FORM check_local_file  USING    p_file TYPE any.
      DATA:  l_size       TYPE     i.
      CLEAR: l_size.
      CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
        EXPORTING
          fname          = p_file
        IMPORTING
    *      exist          = l_exist
          filesize       = l_size
        EXCEPTIONS
          fileinfo_error = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
        IF g_file_flag = 'I'.
          MESSAGE e000 WITH text-016.
        ELSEIF g_file_flag = 'A'.
          MESSAGE e000 WITH text-101.
        ELSEIF g_file_flag = 'C'.
          MESSAGE e000 WITH text-102.
        ELSEIF g_file_flag = 'D'.
          MESSAGE e000 WITH text-103.
        ENDIF.
      ENDIF.
      IF l_size IS INITIAL.
        IF g_file_flag = 'I'.
          MESSAGE e000 WITH text-024.
        ELSEIF g_file_flag = 'A'.
          MESSAGE e000 WITH text-107.
        ELSEIF g_file_flag = 'C'.
          MESSAGE e000 WITH text-108.
        ELSEIF g_file_flag = 'D'.
          MESSAGE e000 WITH text-109.
        ENDIF.
      ENDIF.
      CLEAR: g_file_flag.
    ENDFORM.                    " check_local_file
    *&      Form  get_input
    *       To gate input data from local file or from application server
    FORM get_input USING     p_ifilename TYPE   any
                             p_afilename TYPE   any
                             p_cfilename TYPE   any
                             p_dfilename TYPE   any
                   CHANGING  p_input_table TYPE t_input_table
                             p_asset_table TYPE t_asset_table
                             p_cost_table  TYPE t_cost_table
                             p_depr_table TYPE t_depr_table.
    * to populate the input table
      PERFORM upload_file USING p_ifilename CHANGING i_local.
      g_file_flag = 'I'.
      PERFORM split_localtable CHANGING p_input_table p_asset_table
                                        p_cost_table  p_depr_table.
      CLEAR g_file_flag.
      REFRESH i_local.
    * to populate the asset class table
      PERFORM upload_file USING p_afilename CHANGING i_local.
      g_file_flag = 'A'.
      PERFORM split_localtable CHANGING p_input_table p_asset_table
                                        p_cost_table  p_depr_table  .
      CLEAR g_file_flag.
      REFRESH i_local.
    * to populate the cost center table
      PERFORM upload_file USING p_cfilename CHANGING i_local.
      g_file_flag = 'C'.
      PERFORM split_localtable CHANGING p_input_table p_asset_table
                                        p_cost_table  p_depr_table  .
      CLEAR g_file_flag.
      REFRESH i_local.
    * to populate the depr key table
      PERFORM upload_file USING p_dfilename CHANGING i_local.
      g_file_flag = 'D'.
      PERFORM split_localtable CHANGING p_input_table p_asset_table
                                        p_cost_table  p_depr_table  .
      CLEAR g_file_flag.
      REFRESH i_local.
    ENDFORM.                    " get_input
    *&      Form  upload_file
    *       text
    FORM upload_file  USING    p_filename TYPE any
                 CHANGING p_local_table TYPE t_local_table.
    * To get the input data from desktop file
      IF p_locl = 'X'.
        DATA:  l_file TYPE string.
        CLEAR: l_file,
               p_local_table.
        l_file = p_filename.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                = l_file
            filetype                = 'ASC'
          TABLES
            data_tab                = p_local_table
          EXCEPTIONS
            file_open_error         = 1
            file_read_error         = 2
            no_batch                = 3
            gui_refuse_filetransfer = 4
            invalid_type            = 5
            no_authority            = 6
            unknown_error           = 7
            bad_data_format         = 8
            header_not_allowed      = 9
            separator_not_allowed   = 10
            header_too_long         = 11
            unknown_dp_error        = 12
            access_denied           = 13
            dp_out_of_memory        = 14
            disk_full               = 15
            dp_timeout              = 16
            OTHERS                  = 17.
        IF sy-subrc <> 0.
          MESSAGE e002 WITH l_file.
        ENDIF.
      ELSE.
    *    To get the data from application server file
        OPEN DATASET p_filename IN TEXT MODE FOR INPUT ENCODING DEFAULT.
        IF sy-subrc <> 0.
          MESSAGE e001 WITH p_filename.
        ENDIF.
        CLEAR: wa_local.
        DO.
          READ DATASET p_filename INTO wa_local.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          APPEND wa_local TO p_local_table.
          CLEAR: wa_local.
        ENDDO.
        CLOSE DATASET p_filename.
      ENDIF.
    ENDFORM.                    " upload_file
    *&      Form  split_localtable
    *       text
    FORM split_localtable CHANGING p_input_tab TYPE t_input_table
                                   p_asset_tab TYPE t_asset_table
                                   p_cost_tab  TYPE t_cost_table
                                   p_depr_tab TYPE t_depr_table.
      DATA: l_cnt TYPE i.
      CLEAR: l_cnt, wa_local.
      LOOP AT i_local INTO wa_local.
        REFRESH i_split[].
        SPLIT wa_local AT c_tab INTO TABLE i_split.
        CLEAR l_cnt.
        ADD 1 TO l_cnt.
        CLEAR wa_split.
        LOOP AT i_split INTO wa_split.
          IF g_file_flag = 'I'.
            ASSIGN COMPONENT l_cnt OF STRUCTURE wa_input TO <fs_field>.
          ELSEIF g_file_flag = 'A'.
            ASSIGN COMPONENT l_cnt OF STRUCTURE wa_asset TO <fs_field>.
          ELSEIF g_file_flag = 'C'.
            ASSIGN COMPONENT l_cnt OF STRUCTURE wa_cost TO <fs_field>.
          ELSEIF g_file_flag = 'D'.
            ASSIGN COMPONENT l_cnt OF STRUCTURE wa_depr TO <fs_field>.
          ENDIF.
          CLEAR <fs_field>.
          <fs_field> = wa_split-col.
          ADD 1 TO l_cnt.
          CLEAR wa_split.
        ENDLOOP.
        IF g_file_flag = 'I'.
          APPEND wa_input TO p_input_tab.
          CLEAR: wa_input .
        ELSEIF g_file_flag = 'A'.
          APPEND wa_asset TO p_asset_tab.
          CLEAR: wa_asset .
        ELSEIF g_file_flag = 'C'.
          APPEND wa_cost TO p_cost_tab.
          CLEAR: wa_cost .
        ELSEIF g_file_flag = 'D'.
          APPEND wa_depr TO p_depr_tab.
          CLEAR: wa_depr .
        ENDIF.
        CLEAR: wa_local .
      ENDLOOP.
    ENDFORM.                    " split_localtable

  • Generate XML file from an Oracle Database Table

    Hello All,
    I want to generate a xml file from an Oracle Database table which contains a blob column.
    Can somebody give pointers on this please.
    Thanks in advance
    Sulakshana

    Use the DBMS_XMLGEN package.

  • Upload a file of Excel Format into Internal Table!!!

    Dear All,
    Currently i have a question for upload a file of excel format, I can just convert the file of excel format to text format first. Then it would be OK.
    As we all know, Frequently,The users would always like to provide the excel format to us. Thus, Is there any solutions directly uploaded the file of Excel format into database for web dynpro for ABAP? Not web dynpro for Java.
    Appreciated what you reply!
    Thanks in advance.
    Richard

    Richard,
    I saw my developer use LSMW to load the excel file to the db table. You must careful with the data that you're going to upload.
    Cheers.
    P/S Point reward is appreciated.

  • Oracle Database Table data Load it into Excel

    Hello All,
    Please I need your help for this problem:
    I need to load Oracle database Table data and load it into Excel and saved with xls format.
    Example -Select * from Slase data load it into the Excel.
    I appreciate ans sample code to help me do that, Please help me out. This is very urgent.
    Thanks alot and best regards,
    anbu

    >
    I need to load Oracle database Table data and load it into Excel and saved with xls format.
    Example -Select * from Slase data load it into the Excel.
    I appreciate ans sample code to help me do that, Please help me out. This is very urgent.
    >
    Nothing in these forums is 'urgent'. If you have an urgent problem you should contact Oracle support or hire a consultant.
    You have proven over and over again that you are not a good steward of the forums. You continue to post questions that you say are 'urgent' but rarely take the time to mark your questions ANSWERED when they have been.
    Total Questions: 90 (78 unresolved)
    Are you willing to make a commitment to to revisit your 78 unresolved questions and mark them ANSWERED if they have been?
    The easiest way to export Oracle data to Excel is to use sql developer. It is a free download and this article by Jeff Smith shows how easy it is
    http://www.thatjeffsmith.com/archive/2012/09/oracle-sql-developer-v3-2-1-now-available/
    >
    And One Last Thing
    Speaking of export, sometimes I want to send data to Excel. And sometimes I want to send multiple objects to Excel – to a single Excel file that is. In version 3.2.1 you can now do that. Let’s export the bulk of the HR schema to Excel, with each table going to it’s own workbook in the same worksheet.
    >
    And you have previously been ask to read the FAQ at the top of the thread list. If you had done that you would have seen that there is a FAQ for links that have many ways, with code, to export data to Excel.
    5. How do I read or write an Excel file?
    SQL and PL/SQL FAQ

  • How to store BDC error messages into oracle database table?

    Hello Experts,
    I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
    Thanks in advance.

    Hi,
    Structure of BDCMSGCOLL.
    TCODE -> BDC Transaction code
    DYNAME -> Batch input module name
    DYNUMB -> Batch input screen number
    MSGTYP ->Batch input message type
    MSGSPRA -> Language ID of a message
    MSGID -> Batch input message ID
    MSGNR -> Batch input message number
    MSGV1 -> Variable part of a message
    MSGV2 -> Variable part of a message
    MSGV3 -> Variable part of a message
    MSGV4 -> Variable part of a message
    FLDNAME -> Field name
    Ex :
    DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
    BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
    CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
    IF SY-SUBRC 0.
    PERFORM ERR.
    CLEAR I_MSG.
    REFRESH I_MSG.
    ENDIF.
    *& Form ERR
    text
    --> p1 text
    <-- p2 text
    form ERR .
    DATA V_MSG(255) TYPE C.
    READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
    IF SY-SUBRC = 0.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = I_MSG-MSGID
    LANG = 'E'
    NO = I_MSG-MSGNR
    V1 = I_MSG-MSGV1
    V2 = I_MSG-MSGV2
    V3 = I_MSG-MSGV3
    V4 = I_MSG-MSGV4
    IMPORTING
    MSG = V_MSG
    EXCEPTIONS
    NOT_FOUND = 1
    OTHERS = 2
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE V_MSG. " Error Message Displayed Here.
    CLEAR V_MSG.
    ENDIF.
    endform. " ERR
    hope this will help you.
    Reward if found helpfull,
    Cheers,
    Chaitanya.

Maybe you are looking for