Code for reading particular  fields from the file placed in application

hi,
code for reading particular  fields from the file placed in application server in to the internal table.

Hi,
Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
         fwa TYPE FILE_TABLE,
         FILENAME TYPE STRING,
         RC TYPE I.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
  EXPORTING
    WINDOW_TITLE            = 'Open File'
   DEFAULT_EXTENSION       =
   DEFAULT_FILENAME        =
   FILE_FILTER             =
   INITIAL_DIRECTORY       =
   MULTISELECTION          =
   WITH_ENCODING           =
  CHANGING
    FILE_TABLE              = FILE_TABLE
    RC                      = RC
   USER_ACTION             =
   FILE_ENCODING           =
  EXCEPTIONS
    FILE_OPEN_DIALOG_FAILED = 1
    CNTL_ERROR              = 2
    ERROR_NO_GUI            = 3
    NOT_SUPPORTED_BY_GUI    = 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.
READ TABLE FILE_TABLE INDEX 1 into fwa.
FILENAME = fwa-FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
              filename                = filename
              FILETYPE                = 'DAT'
       IMPORTING
            FILELENGTH              =
         TABLES
              data_tab                = itab
         EXCEPTIONS
              file_open_error         = 1
              file_read_error         = 2
              no_batch                = 3
              gui_refuse_filetransfer = 4
              invalid_type            = 5
              OTHERS                  = 6 .
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
Regards,
Balakumar.G
Reward Points if helpful.

Similar Messages

  • Routine sample code for reading 2 fields from existing DSO

    Hi Gurus,
                 I am a monkey when it comes to write ABAP code. I have one DSO-A where we store accounting info of purchading (from DS 2lis_02_acc) and one DSO-B getting data from 2lis_02_scl data source.
    We need to write a rountine to read DSO-A for G/L account and populate DSO-B G/L account field.
    Please provide me the sample code for this.
    Warm Regards,
    Anil

    Hi anil,
    Create a local table this is type of you source,
    Data : LV_table  TYPE  XXXX
    use the select statement to read the table of DSO .You have to use th active table for the dso that you want to read data from.
    Select xxxfieldxxx FROM  /BIC/A..........50
    into lv_table where
    filed name of of scheule line probably order no and item no .
    <soruce-fields>-IOBELN = IOBELN
    and <source-fields>-IOBELP = IOBELP.
    Checke the techinal name i am not sure about it. It will be something like that.
    Cheers mate

  • How to skip one field from the file by using sqlldr

    Hi ,
    i'm using DB 10g R2 on Redhat ,
    my control file hereunder ,
    LOAD DATA
    INTO TABLE reber.AAA_BILL
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    EXCEPTIONS reber.AAA_BILL
    FIELDS TERMINATED BY '|'
    (Streamnumber ,
    MDN ,
    USERNAME ,
    DOMAIN ,
    USERIP ,
    CORRELATION_ID ,
    ACCOUNTREASON ,
    STARTTIME ,
    PRIORTIME ,
    CURTIME ,
    SESSIONTIME  ,
    SESSIONVOLUME ,
    RATEPOLICYIDX ,
    FEE ,
    GROUPID ,
    SERVICEID)and this is one records of the file ,
    222|1|0664363446|12D0DC90||10.15.6.45|007b8aa5|3|20111029204824|20111029204824|20111029211504|1600|0|147|0|4000|10154|really i want to skip the first field in the file which is (222|) and starting from the second field ,
    any help please

    Thank you for you reply ,
    really i know the Filler to skip colomn from the table , is the Filler working also to skip field from the File . i'll read the link to check this

  • Maintaing a default value for a particular field in the selection screen

    Hi all,
    How to maintain a default value for a particular field in the Selection Screen of a Standard report
    Regards
    Ajay

    >
    ajay babu wrote:
    > Hi all,
    >
    > How to maintain a default value for a particular field in the Selection Screen of a Standard report
    >
    > Regards
    > Ajay
    Create a variant for your standard program and assign this variant to the field 'Start with variant' while creating transaction code for the standard program in the transaction 'SE93'.
    Regards
    Rajesh.

  • Kinect Explorer WPF C# read depth data from the file and conversion to skeleton

    Hello,
    I am using Kinect sensor to do some research on biometrics. Since it is impossible to find people to collect some samples, I would like to use samples from the TUM - GAID database, where there exist Color View and Depth View (in .raw format) samples. Therefore,
    I need to read these samples from the file and do a batch processing, instead of performing real-time collecting of samples (where I can take automatically the Skeleton view using the Kinect SDK). So, I need help on
    1. Reading the data from the file (instead of activating the Kinect sensor) and give this data as an input for conversion to a skeleton
    2. Read the .raw files 
    Thank you very much
    Kind regards

    Hiya,
     I doubt this forum, C Sharp, will provide much help. You are asking about the Kinects system not C#
    language. However, you can try this link; http://kinectforwindows.codeplex.com/
    Hope this help. Thanks :)

  • Help is needed in my RMI code to read in data from input file

    Hi All,
    As part of my assignment, I have to develope a client/server application using RMI (not sure why????).
    I am new to java and using after going through numerous examples I have come up a class on the server side
    to read in the stored data. However during the search I can only display one item (2nd last one) not the entire list
    available in the csv file. Any idea how I can fix this? Here is my code..
    package rmiexample;
    import java.rmi.*;
    import java.util.*;
    import java.io.*;
    public class PropertyServer {
    private static final String HOST="localhost";
    public static void main (String[] args) throws Exception {
        File file = new File("c:\\temp\\property.csv");
        try {
                // Following line use Scanner class to read data file content line-by-line.
                Scanner scanner = new Scanner(file);
                int housecount=0;
                String line = scanner.nextLine();
                while (scanner.hasNextLine()) {
                int count=0;
                    // From the above line of code we got a line from the file
                    // content. I am spliting the line using '%' as the delimiting
                    // character. Comma not used as it can be included
                    // in the address of a property
                    String[] houseDetail = line.split("%");
                    String location=houseDetail[0];
                    String hsePrice=houseDetail[1];
                    String bedroom=houseDetail[2];
                    String houseType=houseDetail[3];
                        String address=houseDetail[4];
                        String agency=houseDetail[5];
                    //Converting the price and # of beds to Integer.   
                    double price;
                    int beds;
                    beds=Integer.parseInt(bedroom);
                    price=Integer.parseInt(hsePrice);
                    PropertyDetails[] propertyList = {
                        new PropertyDetails(location,beds,houseType,price)};
                    //I think thisis were I have my problem is....
                    Vector<PropertyDetails> propDetail = new Vector<PropertyDetails>();
                        propDetail.add(propertyList[count]);
                        System.out.println(propertyList[count]);
                        PropertyImpl temp = new PropertyImpl(propDetail);
                        String rmiObjectName = "rmi://" + HOST + "/PropertyDetails";
                        Naming.rebind(rmiObjectName, temp);
                        count++;
                        line = scanner.nextLine();
        }System.out.println("Binding Complete!!");
    catch (FileNotFoundException e) {
                e.printStackTrace();
    }

    Take a look at: http://java.sun.com/j2se/1.3/docs/guide/rmi/getstart.doc.html
    You need start by declaring an interface that extends Remote.

  • Read different language from the file and upload data

    Hi Expert,
    I am loading customer master data through BDC( trx-XD01) by reading a file from PC. The file contains customer data in different language like English, Chinese, and Japanese etc. However, when creating customer master data, only those data in English are able to create, as I am in English log on. The data in other language is showing garbage value. However, when I am logging in with that language (say Chinese) this time I am able to create customer for Chinese data but not for other.
    Can someone one help me to solve this problem – irrespective of language in the file and SAP log on, I should able create customer through my program.
    Thnx ,
    Deba
    Edited by: Debashis Mahunta on Feb 11, 2008 10:55 AM

    Hi Expert,
    I am loading customer master data through BDC( trx-XD01) by reading a file from PC. The file contains customer data in different language like English, Chinese, and Japanese etc. However, when creating customer master data, only those data in English are able to create, as I am in English log on. The data in other language is showing garbage value. However, when I am logging in with that language (say Chinese) this time I am able to create customer for Chinese data but not for other.
    Can someone one help me to solve this problem – irrespective of language in the file and SAP log on, I should able create customer through my program.
    Thnx ,
    Deba
    Edited by: Debashis Mahunta on Feb 11, 2008 10:55 AM

  • Grep for a particular entry in the file name

    Dear all,
    I have a folder with following list of files with names like
    amg-9876544-M37421-3000282.PDF
    amg-9876544-M37408-3000457.PDF
    amg-9876544-M37488-3000260.PDF
    amg-9876544-M37481-3300063.PDF
    amg-9876544-M37454-3000675.PDF
    amg-9876544-M37543-3000672.PDF
    amg-9876544-M37541-3363000.PDF
    amg-9876544-M37528-3000381.PDF
    amg-9876544-M37524-3000432.PDF
    amg-9876544-M37506-3000352.PDF
    amg-9876544-M37500-3021100.PDF
    amg-9876544-M37585-3850050.PDF
    amg-9876544-M37577-3005105.PDF
    amg-9876544-M37565-3000502.PDF
    amg-9876544-M37611-3300527.PDF
    amg-9876544-M37610-3300150.PDF
    amg-9876544-M37607-3300259.PDF
    I want to list all the files that has the entry with 33..for ex..file with name amg-9876544-M37607-3300259.PDF after the -.
    If I give ls -rlt | grep *33* it lists all the file with entry 33 anywhere in it.I want to grep for files with 33 after that "-" in the file name..
    Please suggest
    Kai

    If the only "-33" is the one you are interested in:
    ls -rtl | grep -e -33The "-e" prevents grep(1), et. al., from thinking that "-33" is a command line
    switch.
    Cheers

  • Need to read a field from flat file

    Hi All,
        In flat file i have  one field which may contain 100 enteries separated by delimanator ',' (comma).  There can be 1 , 10 or 100 enteries.   I need to put them in the internal table . Please suggest me .
        I have used the below logic .
    i split the field in 100 variables and then appending the internal table . the problem here is even if there is only one entry , the logic will append 99 blank enteries .  so can any one suggest , is there any other way do it . any Functon Modules available .
    Thanks.

    Hi Chetan,
    If i understand your requirement it is as below,
    Flat file.
    1,2,3,4,5,6,7,8,9,....
    1,2,3,4,5,6,7,8,9,....
    1,,,,,,,,,,,,,,,,,,,,
    Now you read the first line and split into an itab of type string, and you are worried about the third line where not all the fields have values and end up creating blank entries. to fix this, simply
    Sort the Itab, and use delete itab statement with the where clause as where column is ''.
    This should solve it.
    types: begin of t_data,
                line type string,
               end of data.
    data: li_file_line type standard table of t_data.
    split l_file_line at ',' into li_file_line.
    delete li_file_line where line = ''.

  • How to look for a particular field in the segments of IDOC ?

    Hi,
    I am looking at a particular IDOC which I will use to do data trasfer from lgacy to R/3 using BAPI in LSMW. Now I know a field which is required to create a given business transaction when igrating data. But there are 100's of segments on the IDOC.
    Is there a way I can see if the given field is present in any of the IDOC segment ? I don't want to dig though each and everys egment and find it out...
    Regards,
    Rajesh

    Try using WE09..There you have the option of searching by the idoc data..CHeck in the bottom of the selection screen
    Thanks,
    Naren
    Message was edited by: Narendran Muthukumaran

  • Problem With Crystal Reports Reading Date Fields From CSV File

    I have a date field in a CSV file in the format 06/28/09 17:23:55.523. When I use ODBC the configuartion picks it up a character field. I overright the recommendation type by specifing it is a date field but whne I bring the data into crystal reports the dates are blanks. Any suggestions on how to get around this problem. I need to use the date for selection records.
    Phasor

    The question was answered under another thread. I had to use the split commmand to get rid of the fractions of a second

  • Sub: code for accessing  4  webcams from the usb ports

    sir ,
    i want to connect 4 webcams in the system and access these four cams symultaneousely . how can i do that using java...
    by ,johnpaul

    > sir ,
    Are you aware of the fact that there are female developers as well?
    > i want to connect 4 webcams in the system and
    access these four cams symultaneousely . how can i do
    that using java...
    A good place to start is you favorite search engine.
    For example:
    http://www.google.com/search?hl=en&lr=&q=java+webcam&btnG=Search

  • How to Extract particular field from a string ( Mapping)

    how to exteract the particular field from the given string:
    ProcessEmp this element has a below string subfields.
    <ProcessEmp>&lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt;
    &lt;Employee PersonnelNumber="11111" FirstName="String" MiddleName="String" LastName="String" Department="String" Group="" SapUserID="10flname" EmailAddress="[email protected]" DefaultPassword="*" Status="Success" /&gt;</ProcessEmp>
    how to extract only PersonalNumber, department, EmailAddress from above ProcessEmp into 3 diff fields.
    Thanks
    dhanush.

    Hi,
    You are receiving XML message within a field. To access a particular field from that XML message, you could create a User Defined Function, as suggested by many already.
    You could write UDF using some of the String operation functions. This could include following:
    1. If you need to access field Employee PersonnelNumber, you could get last index of that within string using function lastIndexOf(String str). Pass string "Employee PersonnelNumber="" for this function.
    2. This function would return an index of rightmost occurance of this string.
    3. after this you could get the index of next occurance of ", as the value of field is within quotes. You could use function indexOf(int ch, int fromIndex) for getting the same. You would pass Character as " and index as the one received by previous function.
    4. Now you have index for starting and ending point of value string for desired field.
    5. After this you could use substring(int beginIndex, int endIndex) function by passing first and second index values to retrieve the needed string, which contains value of field.
    Hope this would be helful.
    Thanks,
    Bhavish
    Reward points if comments found helpful:-)

  • How to do the paging while reading from the file !!!

    I've able to display the contents of the file in my jsp as a tabular form. I want to apply the paging concept in my jsp page. As i did in my database project there i's sending the next value as a parameter and it works.
    But when i retrieving the value from the file then i'm not able to get particular values anyhow i'm using the concepts of getLineNumber() but unable to get the previous one worked. I want to diplay only the first 20 contents of the file then, by clicking the next button he should be able to view the next 20 contents of the file. Please help me out for this problem. If possible send me the codes too it'll very helpful for me.
    in advance thanks....

    I hope the following code will help u.
    If your bean is:
    public class yourBean
    private int startIndex ;
    private int pageSize ;
    private int endIndex ;
    public void useBean()
    startIndex = 0;
    pageSize = 10;
    endIndex = pageSize;
    public setters and getters for each of the above.
    In servlet :
    doGet/doPost:
    yourBean uBean =
    (yourBean)sess.getAttribute("urBean");
    int sIndex = uBean.getStartIndex();
    int eIndex = uBean.getEndIndex();
    int pSize = uBean.getPageSize();
    if (sIndex = 0)
    //means first time
    dont do anything
    if ((sIndex >0)&&(sIndex <
    uBean.getRecords().size())))
    eIndex = sIndex + pSize - 1;
    sIndex = eIndex;
    //update Indexes to the bean
    uBean.setStartIndex(sIndex);
    uBean.setEndIndex(eIndex);
    sess.setAttribute("urBean",uBean);
    res.sendRedirect("yourJSP.jsp",req,res);
    In yourJSP.jsp:
    <jsp:useBean id="urBean" type="...." scope="session"
    />
    <%
    int sIndex = urBean.getStartIndex();
    int eIndex = urBean.getEndIndex();
    for (int
    i=sIndex;(i<=eIndex)&&(i<urBean.getRecords().size()))
    out.println(....);
    if (eIndex >= urBean.getRecords().size())
    out.println("NExt");
    else
    out.println("<a href=yourServlet>Next</a>");
    if (sIndex <= 0)
    out.println("Previous");
    else
    out.println("<a href=yourServlet>Previous</a>");
    %>

  • How can I input read a line from a file and output it into the screen?

    How can I input read a line from a file and output it into the screen?
    If I have a file contains html code and I only want the URL, for example, www24.brinkster.com how can I read that into the buffer and write the output into the screen that using Java?
    Any help will be appreciate!
    ======START FILE default.html ========
    <html>
    <body>
    <br><br>
    <center>
    <font size=4 face=arial color=#336699>
    <b>Welcome to a DerekTran's Website!</b><br>
    Underconstructions.... <br>
    </font> </center>
    <font size=3 face=arial color=black> <br>
    Hello,<br>
    <br>
    I've been using the PWS to run the website on NT workstation 4.0. It was working
    fine. <br>
    The URL should be as below: <br>
    http://127.0.0.1/index.htm or http://localhost/index.htm
    <p>And suddently, it stops working, it can't find the connection. I tried to figure
    out what's going on, but still <font color="#FF0000">NO CLUES</font>. Does anyone
    know what's going on? Please see the link for more.... I believe that I setup
    everything correctly and the bugs still flying in the server.... <br>
    Thank you for your help.</P>
    </font>
    <p><font size=3 face=arial color=black>PeerWebServer.doc
    <br>
    <p><font size=3 face=arial color=black>CannotFindServer.doc
    <br>
    <p><font size=3 face=arial color=black>HOSTS file is not found
    <br>
    <p><font size=3 face=arial color=black>LMHOSTS file
    <br>
    <p><font size=3 face=arial color=black>How to Setup PWS on NT
    <BR>
    <p><font size=3 face=arial color=black>Issdmin doc</BR>
    Please be patient while the document is download....</font>
    <font size=3 face=arial color=black><br>If you have any ideas please drop me a
    few words at [email protected] </font><br>
    <br>
    <br>
    </p>
    <p><!--#include file="Hits.asp"--> </p>
    </body>
    </html>
    ========= END OF FILE ===============

    Hi!
    This is a possible solution to your problem.
    import java.io.*;
    class AddressExtractor {
         public static void main(String args[]) throws IOException{
              //retrieve the commandline parameters
              String fileName = "default.html";
              if (args.length != 0)      fileName =args[0];
               else {
                   System.out.println("Usage : java AddressExtractor <htmlfile>");
                   System.exit(0);
              BufferedReader in = new BufferedReader(new FileReader(new File(fileName)));
              StreamTokenizer st = new StreamTokenizer(in);
              st.lowerCaseMode(true);
              st.wordChars('/','/'); //include '/' chars as part of token
              st.wordChars(':',':'); //include ':' chars as part of token
              st.quoteChar('\"'); //set the " quote char
              int i;
              while (st.ttype != StreamTokenizer.TT_EOF) {
                   i = st.nextToken();
                   if (st.ttype == StreamTokenizer.TT_WORD) {          
                        if (st.sval.equals("href")) {               
                             i = st.nextToken(); //the next token (assumed) is the  '=' sign
                             i = st.nextToken(); //then after it is the href value.               
                             getURL(st.sval); //retrieve address
              in.close();
         static void getURL(String s) {     
              //Check string if it has http:// and truncate if it does
              if (s.indexOf("http://") >  -1) {
                   s = s.substring(s.indexOf("http://") + 7, s.length());
              //check if not mailto: do not print otherwise
              if (s.indexOf("mailto:") != -1) return;
              //printout anything after http:// and the next '/'
              //if no '/' then print all
                   if (s.indexOf('/') > -1) {
                        System.out.println(s.substring(0, s.indexOf('/')));
                   } else System.out.println(s);
    }Hope this helps. I used static methods instead of encapsulating everyting into a class.

Maybe you are looking for

  • Account on iMac G5 not working correctly?

    Hello all, I recently downloaded a program called "Secrets" on my iMac G5. This program tweaks some simple settings such as changing the dock from the glassy 3D to the 2D black dock. After tweaking a few things to what I thought would help my compute

  • When i try to update i recieve an error Error Code: U43M1D219

    Tried downloading Premier and AE updates today .. keeps saying failed .. Loaded Media Encoder no problem ..

  • How do I restore section of the tools menu in the develop module?

    I seem to have lost the basic section in the tools menu of the develop module of Lightroom 5.7 (latest download).  How do I restore it?

  • Unable to add color over line art.

    I'm using CS2 and have the following issue. I've scanned some line art (white paper, black ink) into the computer and opened it up in PS. Some of the larger areas of black were spotty, so I went over them using PS black. Many layers above the backgro

  • IP Protocol 50

    Does anyone know how to get a Time Capsule running 7.4.2 to forward protocol 50 to an address inside the network? I have already set up dhcp to hand out addresses based on MAC address so the IP changing internally isn't an issue, and I've already set