Reading text file from forms6i

hi all ,
i want to read a text file how can i classify its coordinates (columns) to insert it into different columns of a table .
i want that first ten characters of text file will go in first column of table , next 5 characters will go into 2nd column and so.
but how to identify the characters from - to for columns.
Message was edited by:
Najeeb ur Rehman

declare
v_line varchar2(2000);
v_text_io TEXT_IO.FILE_TYPE;
begin
v_text_io:= TEXT_IO.FOPEN(c:\temp\file.txt,'r');
LOOP
TEXT_IO.GET_LINE(v_text_io, v_line);
v_first_column:= SUBSTR(v_line,1,10);
v_second_column:= SUBSTR(v_line,11,5);
INSERT INTO your_table VALUES(v_first_column, v_second_column);
END LOOP;
EXCEPTION
WHEN no_data_found
THEN
TEXT_IO.FCLOSE(v_text_io);
END;
You can also try it with the sql-loader.
tom

Similar Messages

  • How can I read text files from LAN if I only know the hostname?

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    <p>1. How can I read text files from LAN if I only know the hostname, or IP address?
    <p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
    (ex. how can I read the 120th line?)
    <p>Please help!
    <p>sorry for the bad english

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
    The hostname is server, not file.
    2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
    (ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is

  • HI,,,How to read text file from my emulators root

    hi friends,
    Actully i m having problem with file connection i.e. i cant read text file from my root of the emulator.....
    i have tried like this...
    plz help me out
    String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/New Folder/main.txt";
    InputConnection conn = (InputConnection)Connector.open( uri,Connector.READ );
    InputStream in = conn.openInputStream();
    conn.close();
         for(int j=0;j<12;j++)
         ch=in.read();
         str.append((char)ch);
    par1=str.toString();
    in.close();
         screen4.append(par1);
         display.setCurrent(screen4);

    still its not working.........
    String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/readme.txt";
                        FileConnection conn = (FileConnection)Connector.open( uri,Connector.READ);
                        InputStream in = conn.openInputStream();
                        conn.close();
                   String ss="";
                   String str1="";     
                   int ch=0;
                   byte b[]=new byte[753];     
                             ch=in.read(b,0,753);
                             str1= new String(b,0,ch);
                                  ss=str1.substring(493,501);                     
                        screen4.append(ss);
                        display.setCurrent(screen4);
                        }catch(IOException io){}

  • Reading text file from database server in OA Page

    Hi Guys,
    I am trying to embed an applet with in an OA Page. The applet is used to mainly for showing Gantt chart. I have to pass my connection details from OA Page to applet, I dont pass directly the connection details to the applet so i am placing all the server details, user name and password in a text file on the database server.
    So from the OA Page i have to read the contents of the file on the database server and pass them to the applet using the <PARAM> tag. My question is how to read the text file from the database server.Any Inputs?
    Thanks in advance for your help.
    Regards,
    Nagesh Manda.

    If the file to be read is on the database, then it makes sense to use the pl/sql code to read the file. Make a call to this pl/sql code from page controller to get back the values.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                           

  • Reading Text File from selection Screen and populating table (Urgent)

    Hi All,
    I have some requirment like i in my report i have to initial my Input feild from text file is it good to populate a internal table or range.
    I have three feild in a excel file that entry can more then 500
    data example
    Matnr Date             Day
    A1     10.07.2007    12
    B1     10.07.2007    10
    A1     19.07.2007    15
    C1     20.08.2007    30
    E1     11.09.2007    12
    This report for Price Protection claim.
    even u can help me out with proper table plz this is urgent.

    Hi..
    <b>parameters:</b>
      p_file(50) type c.
    <b>data:</b>
      begin of itab occurs 0,
         matnr type vbak-matnr,
         date type sy-datum,
         day(2) type n,
      end of itab.
    <b>at selection-screen on value-request for p_fname.</b>
      perform get_path.
    <b>start-of-selection.</b>
    <b>CALL FUNCTION 'GUI_UPLOAD'</b>
      <b>EXPORTING
        FILENAME                      =  p_fname
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'</b>
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    <b>  TABLES
        DATA_TAB                      = itab</b>
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    This Sub routine is used to get the file name
    *There are no interface parameters passed to this subroutine.
    FORM get_path .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME            =  P_FNAME
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME                =  P_FNAME
      RC                     =
    EXCEPTIONS
       INV_WINSYS             = 1
       NO_BATCH               = 2
       SELECTION_CANCEL       = 3
       SELECTION_ERROR        = 4
       OTHERS                 = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " get_path
    data:

  • Reading text file from stored procedure

    Hi
    I have a text file coming daily. I need to read the file.
    1st line contain the file source
    Last line contain the no of records in the file.
    I need to count all the lines in text file compare with the number of lines mentioned in the last line of the file.
    Can any one help me in achieving the above task.
    Thanks a lot in advance.
    KLSRAO

    Re: UTL_FILE Examples

  • Can I save and read text files on a server that I host?

    Hello everyone,
    I am a java hobbiest. I was wondering if I set up my own server, running out of my house, could I have my applets save to my computer and read from my computer without having to learn JDBC and a DATABASE language. In other words could i just have my applet save and read text files from and to my server?
    I'm trying to set up a sight for my 5th grade class where parents can log into. Thanks for your time.
    Oh yeah, which is easier, learning how to set up a server or learning JDBC and a DATABASE language?
    If you have any other good idease please tell me them
    Thank you, Bryan

    Short answer: This isn't gonna work
    Long answer: For this to work, the first thing you're going to need is a static IP address and a DNS name registered -actually you don't necessarily need #2 but you're probably gonna want it and it's by far the easier of the steps.
    As far as I know to get a fixed IP address you've either gotta be directly attached to a larger network (ie university network) or get a leased line from an ISP.
    Once you've got that done come back to us.

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • Reading a text file from a URL

    I am having problems trying to read a text file from a URL.
    This is the code i have been using:
    package Java;
    import java.net.*;
    import java.io.*;
    public class Main_1 {
    public static void main(String[] args) throws Exception {
         URL myAddress = new URL("http://www.geocities.com/simonrobinson1/java/farrago.txt");
         BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        myAddress.openStream()));
         String inputLine;
         while ((inputLine = in.readLine()) != null)
         System.out.println(inputLine);
         in.close();
    but it returns an error saying:
    java.net.NoRouteToHostException: Operation timed out: no further information
    at java.net.PlainSocketImpl.socketConnect(Native Method) .....etc etc.
    Is this just a problem due to my network or is there something wrong with my code ????

    Altho you can access the file by typing the URL in a browser, geocities being a free web-hosting service don't like you to access the materials without seeing their ads. You have to find a way to trick it into thinking that you are indeed coming in from a web browser even tho you aren't.
    V.V.

  • Read a text file from DB directly (don't use PLSQL).

    how can I Read a text file from DB directly (don’t use PLSQL). ?

    If there is a known structure, you could use External Table access and query that "file" as any table.
    Nicolas.

  • How to read a text file from a Jar file

    Hi
    How can I read a text file from a Jar file?
    Thanx in advance..

    thanx
    helloWorld it works.damn, I didn't remove it fast enough. Even if it is urgent, it is best not to mention it, telling people just makes them take longer.

  • Extract text file from a folder and read the content

    Hi
    I have "n" no.of text files saved in a folder with automatically generated naming convention which include DD/MM/YYYY and also some measurement output value.
    Eg: 1) Die_1_DUT_outputvalue_DD_MM_YYYY.txt
        2) Die_1_DUT_outputvalue_DD_MM_YYYY_ABC.txt
    In the above files part of the 2nd file naming convention same as the first file (i.e. Die_1_DUT and DD_MM_YYYY) whereas outputvalue is different and an additional string named ABC is appended.
    Now I want to search the 2nd file based on matching the naming pattern with the 1st file (note: the outputvalue in the file name is different for both files) and so far followed this method
    1) Use a list folder with *.txt pattern to search all the text files and the output is a 1D array
    2) then use array to cluster and then flatten to XML function to have all the text file names as a string element (not 1D array)
    3) then pass the output of the 2nd step to the sting match pattern and use a regular expression to get the required file name
    4) send the output of the 3rd step to search 1D array to get the index and then get the file name and later use read text file to read the content of the text file
    And I am stuck at the 3rd step while sending an input as the regular expression to match the pattern as the outputvalue in the namming convention of the above two files is different is there any way I can actually extract the filename/file?
    Any suggestions?
    Attachments:
    1.png ‏11 KB

    Some bits in your code are unnecessary, a leaner implementation here:
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Data Federator: Access Text file from secured Network Share or Sharepoint?

    Hi,
    I am using BusinessObjects Data Federator Designer XI 3.0 Service Pack 2 - 12.2.2.0 (Build 1002172322) and I'm new to DF.
    I am trying to use the Text File Datasource type to connect to a file on a secured Network Share and from a Sharepoint 2010 document repository. Is this possible?
    I am currently able to use the Text File datasource to read a file from a public network share (
    share\public\folderpath\file) or on the local federator machine using the "Local File" connection but cannot put in a username/password for accessing a secure network share. Is there a built in DF username/password that should be granted access to the share?
    Neiher the FTP File System or SMB Share seemed like it would work here either.
    For the Sharepoint connection, I know that I can make a webservice on a list and connect DF to the webservice, but I want to just connect to the document repository. I was unable to get this to work even with Sharepoint repositories using WebDav since the Local File method did not accept the url string (http://mysite.<org>.com/personal/<user>/Shared Documents). Is there any way to do this without having to change the way the file is exposed on the Sharepoint side?
    How is this normally handled? Put the files on a unsecured network share or on the DF server? Import the files into a DB and just use DB connections?
    Finally, is there a way to import XLS/XLSX files in DF or only CSV files?  I saw DI has an Excel Adaptor but didn't see anything for DF and when I tried it either could not retrieve the XML schema or reading the file's data failed.
    Thanks alot for the help.
    Kerby

    Bump, any help here with Data Federator usage?  Sharepoint, XLS files, or using secured network share?

  • How to read .xls file from FTP server t oInternal table

    Hi
    am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
    but the data i get in LT_TEXT is special characters.
    CALL FUNCTION 'FTP_SERVER_TO_R3'
    EXPORTING
    handle = hdl
    fname = f_name "ProdDataFromCRM.xls.
    * CHARACTER_MODE = 'X'
    * IMPORTING
    * BLOB_LENGTH =
    TABLES
    BLOB = lt_text
    * TEXT = lt_text
    EXCEPTIONS
    TCPIP_ERROR = 1
    COMMAND_ERROR = 2
    DATA_ERROR = 3
    OTHERS = 4
    can any one help me out to get the exact data..
    Really appreciate your quick response..
    Thank You

    Hi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
    CALL METHOD document->open_document_from_table
    of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
    Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
    But, who knows, perhaps you want "And Now For Something Completely Different".
    Regards
    Clemens

  • How to read the file from a folder.

    Hi All,
    How to read the file from a folder or directory from the non sap server / remote server.
    Regards
    Sathis

    open dataset filename for input in text mode
                         encoding default.
    filename is character type variable with the destination filename.
    Edited by: Jino Augustine on Apr 19, 2010 1:31 PM

Maybe you are looking for

  • 10.4.10 External Hard drives, and other oddites

    Greetings, I decided to turn my Mini into my file server tonight, and connected a 160 GB hard drive via an external USB 2.0 Case, and formatted it, and then copied some 50 GB of data from another hard drive that was formatted EXT3. I then installed t

  • Can't remove breakpoint in NetBeans

    This is probably the dumbest question I've ever asked, but why can't I remove this breakpoint?? I'm using Netbeans 5.0 and I've got a breakpoint on a line where I don't want it (and its an onMouseClick, so I can't do my OTHER debugging). If I click o

  • Installing Adobe Photo Elements on a MacBook Pro.

    I am trying to install Adobe Photoshop Elements 2.0. When it tries to install it gives an error that says that it can't find the "Classic Environment". The install manual says to go to System Preferences and select a classic environment which is not

  • My phone won't turn on anymore

    I have an iPhone 5  and recently it had started to turn off at 20% and then 40% and then 80% and then it got to the point where I had to have it plugged in to be able to use it. Now even when plugged in I am unable to use my

  • New line character  is not working in BPEL 11g

    I am trying to use new line character &#13; in string concat operation in BPEL 11g, but it is not giving new line in output. Any idea why?