Text file on cldc

hallo,
can i create text file with text editor at pc than can be stored and manipulated on mobile phone.
thanks very much

i am assuming you are talking w.r.t j2me context
we have a source folder called src and one resource folder res
as you can see with the demos provided with WTK
you can read any file at runtime
suppose you created a xml file x.xml
then put in res folder
at runtime you can access using
InputStream in =     getClass().getResourceAsStream("/x.xml");

Similar Messages

  • How to download a text file from the server

    hi everyone,
    can anyone tell me how to download and read a text file from the server and saved in into resource folder.
    with regards
    pallavi

    its really easy
    To read from server, use something like:
    HttpConnection connector = null;
    InputStream inp_stream = null;
    OutputStream out_stream = null;
    void CloseConnection()
         if(inp_stream!=null)inp_stream.close();
         inp_stream=null;
         if(out_stream!=null)out_stream.close();
         out_stream=null;
         connector.close();
         connector = null;
    public void getResponse(String URL,String params)
      try
         if(connector==null)connector = (HttpConnection)Connector.open(URL);//URL of your text file / php script
         connector.setRequestMethod(HttpConnection.POST);
         connector.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
         connector.setRequestProperty("content-type", "application/x-www-form-urlencoded");
         //connector.setRequestProperty("charset","windows-1251");
         //*** If you need to send ("arg1=value&arg2=value") arguments to script use this:
         out_stream = connector.openOutputStream();
         byte postmsg[] = params.getBytes();
         out_stream.write(postmsg);
         int rc = connector.getResponseCode();//in any case here connection will be opened & closed
         if (rc != HttpConnection.HTTP_OK)
              CloseConnection();
              throw new IOException("HTTP response code: " + rc);
         inp_stream = connector.openInputStream();
         int pack_len = inp_stream.available();
         byte answ[]=new byte[pack_len];
         inp_stream.read(answ);
         CloseConnection();
         ProcAnswer(answ);//process received data
      catch(Exception ex)
         System.err.println("ERROR IN getResponse(): "+ex);
    } And you can read from resource file like
    public void loadFile(String filename)
        DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/"+filename));
        String str="";
        try
             while (true)
                ch = dis.read();//read character
                if(ch=='\r')continue;//if file made in windows
                if(ch=='\n' || ch==-1)//end of line or end of file
                    if(str.length()==0)continue;//if empty line
                    //do some thing with "str"
                    if(ch==-1)break;//it was last line
                    str="";//next line
                    continue;
                 str+=(char)ch;
           dis.close();
       catch (Exception e)
           System.err.println("ERROR in loadFile() " + e);
    }Welcome! =)
    Edited by: MorskoyZmey on Aug 14, 2008 3:40 AM

  • Binary search in text files

    Hi all,
    I'm thinking about how to implement a binary sort to get,given a key, a value from a text file with a list of words in order. I saw randomaccessfile for j2se and I know that this work it's usually done by seek functions but how to do the seek work without the File class , with only the InputStream and Reader? I'm talking about the j2me midp 2 cldc 1.1 api, is there some methods or class to use for this thing? How could be implemented a binary search in a text file resident in the /res dir or the JAR or which could be the problems that cannot make possible this staff? If there was something like seek one way could be that one of decide a common length of words to read so going to the half of the text file it's possible with simply multiplication, and the do the binary search things.But for now I haven't found any resources or help.
    I hope you can help me to understand, thank you

    Hallo all,
    it is NOT the problem to locate the text I need to find in the fmb, or fmx.
    The problem is that since I want to change not only the text but also some more code around I want to do this in Form Builder - Object Navigator. And I'm not able to discover in which trigger or procedure the text appears.
    I do not want to edit fmx, or fmb in a text editor because I suupose theer are some checksums hidden for the format.
    -duro
    BTW in FMT there is no code seen (only some binary) for v6i as it was in v4.5.

  • How Open And Print Proc C Genrated Text File Based Report ON Browser

    Dear Sir
    I have my old 6i forms from which i runs some Pro*c programmers with the help of HOST() command ,and then that generates a normal text file as a resultant report like file name "kha10"
    which i can easily open with any text client ,,,
    now what i want is that, to open this file on browser like web Report on my forms 10g like report builder 10g
    can anyone help me as it will be a gr8 help otherwise i would have to develop approx 100 reports.....
    any solution or any technique plzz help me

    bro my work is almost done apart from this virtual directory , how to make a virtual directory so that is dosent comes under
    http://........../form/
    i mean where to put my
    <virtual-directory virtual-path="/procrepo" real-path="c:\" />
    as my original file looks like bellow
    <?xml version="1.0"?>
    <!DOCTYPE orion-web-app PUBLIC "-//ORACLE//DTD OC4J Web Application 9.04//EN" "http://xmlns.oracle.com/ias/dtds/orion-web-9_04.dtd">
    <orion-web-app
         deployment-version="10.1.2.0.2"
         jsp-cache-directory="./persistence"
         temporary-directory="./temp"
         servlet-webdir="/servlet/"
    >
    <context-param-mapping name="configFileName">D:\DevSuiteHome_1/forms/server/formsweb.cfg</context-param-mapping>
         <virtual-directory virtual-path="/html" real-path="D:\DevSuiteHome_1/tools/web/html" />
         <virtual-directory virtual-path="/java" real-path="D:\DevSuiteHome_1/forms/java" />
         <virtual-directory virtual-path="/webutil" real-path="D:\DevSuiteHome_1/forms/webutil" />
         <virtual-directory virtual-path="/jinitiator" real-path="D:\DevSuiteHome_1/jinit" />
         <session-tracking cookies="disabled" />
    <!-- Uncomment this element to control web application class loader behavior.
    <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />
    -->
    <security-role-mapping name="administrators">
    </security-role-mapping>
    </orion-web-app>
    plzzzzzzzzzzz help

  • Open and read from text file into a text box for Windows Store

    I wish to open and read from a text file into a text box in C# for the Windows Store using VS Express 2012 for Windows 8.
    Can anyone point me to sample code and tutorials specifically for Windows Store using C#.
    Is it possible to add a Text file in Windows Store. This option only seems to be available in Visual C#.
    Thanks
    Wendel

    This is a simple sample for Read/Load Text file from IsolateStorage and Read file from InstalledLocation (this folder only can be read)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.Storage;
    using System.IO;
    namespace TextFileDemo
    public class TextFileHelper
    async public static Task<bool> SaveTextFileToIsolateStorageAsync(string filename, string data)
    byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(data);
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    var file = await local.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
    try
    using (var s = await file.OpenStreamForWriteAsync())
    s.Write(fileBytes, 0, fileBytes.Length);
    return true;
    catch
    return false;
    async public static Task<string> LoadTextFileFormIsolateStorageAsync(string filename)
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    async public static Task<string> LoadTextFileFormInstalledLocationAsync(string filename)
    StorageFolder local = Windows.ApplicationModel.Package.Current.InstalledLocation;
    string returnvalue = string.Empty;
    try
    var file = await local.OpenStreamForReadAsync(filename);
    using (StreamReader streamReader = new StreamReader(file))
    returnvalue = streamReader.ReadToEnd();
    catch (Exception ex)
    // do somthing when exception
    return returnvalue;
    show how to use it as below
    async private void Button_Click(object sender, RoutedEventArgs e)
    string txt =await TextFileHelper.LoadTextFileFormInstalledLocationAsync("TextFile1.txt");
    Debug.WriteLine(txt);
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • Address book .... importing text file

    I am designing an address book which opens a text file called AddressBook.txt which reads in the information in the following format:
    lastname,firstname,street,city,state,zip,phonenumber,birthday,persontype
    lastname2,firstname2,street2,city2,state2,zip2,phonenumber2,birthday2,persontype2
    etc. (with a maximum entries of 500)
    I am having a problem reading in the information without the commas and wrapping to the next line. I can either use the BufferedReader or Scanner to input the file and as you can see below, my code is not complete yet. I can't figure out how to code the storeAddress() method in order to get the addressBookEntries[] to include the necessary information for outputting, sorting, etc. If I can get the information read into the addressBookEntries[], I think I will probably be able to proceed in the rest of the required tasks (i.e. sorting by last name, searching by last name, etc.)
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    *  @created September 14, 2004
    *  This program uses a JFrame to manipulate data and form an
    *  address book.  The user will be able to load data from a file,
    *  sort it by last name, print the address, phone number, and date
    *  of birth, print the names of people whos birthday are between 2
    *  dates, print the names of people between 2 last names, and/or
    *  print the names of different person types.
    public class AddressBook extends JPanel implements ActionListener{
        JFrame frame;
        final int numButtons = 7;
        JRadioButton[] radioButtons = new JRadioButton[numButtons];
        JButton process = new JButton("Process Request");
        JLabel title;
        JTextArea output = new JTextArea(30,50);
        int MAX_ADDRESS_ENTRIES = 500;
        AddressBookEntry addressBookEntries[] =
            new AddressBookEntry[MAX_ADDRESS_ENTRIES];
        String FILE_NAME="AddressBook.txt";
        public AddressBook(JFrame frame){
            super(new BorderLayout());
            this.frame=frame;
            JPanel choicePanel = createSimpleDialogBox();
            choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
            " to choose from:"));
            title = new JLabel("<html><h2> Thank you for opening the " +
            "Address Book.  " +
            "Please Press the \"Process Request\" " +
            "after making a choice.</h2></html>\n",JLabel.CENTER);
            title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
            output.setEditable(false);
            add(title, BorderLayout.NORTH);
            add(choicePanel, BorderLayout.CENTER);
            add(output, BorderLayout.SOUTH);
            final ButtonGroup group = new ButtonGroup();
            final String saveCommand = "Save";
            final String sortByLN = "Sort by Last Name";
            final String searchLNCommand = "Search By Last Name";
            final String printAPD = "Print address, phone number, and DOB";
            final String printNamesDOB = "Print names of people whose birthday" +
            " falls between 2 dates";
            final String printNamesLN = "Print names of people who fall" +
            " between 2 last names";
            final String printPType = "Print all family members, friends, or" +
            " business associates";
        private JPanel createSimpleDialogBox(){
            radioButtons[0] = new JRadioButton(
              "<html>Save the address file</html>");
            radioButtons[0].setActionCommand(saveCommand);
            radioButtons[1] = new JRadioButton(
              "<html>Sort the address file by last name</html>");
            radioButtons[1].setActionCommand(sortByLN);
            radioButtons[2] = new JRadioButton(
              "<html>Search the address file by last name</html>");
            radioButtons[2].setActionCommand(searchLNCommand);
            radioButtons[3] = new JRadioButton(
              "<html>Print the address, phone number, and DOB of a specified" +
              " person</html>");
            radioButtons[3].setActionCommand(printAPD);
            radioButtons[4] = new JRadioButton(
              "<html>Print the names of people whose birthday falls between" +
              " two dates</html>");
            radioButtons[4].setActionCommand(printNamesDOB);
            radioButtons[5] = new JRadioButton(
              "<html>Print the names of people who fall between two" +
              " specified last names</html>");
            radioButtons[5].setActionCommand(printNamesLN);
            radioButtons[6] = new JRadioButton(
              "<html>Print all family members, friends, <u>OR</u>" +
              " business associates</html>");
            radioButtons[6].setActionCommand(printPType);
            for (int i=0; i<numButtons; i++){
                group.add(radioButtons);
    //set the first button (open file) to be selected
    radioButtons[0].setSelected(true);
    return createPane(radioButtons, process);
    private JPanel createPane(JRadioButton[] radioButtons,
    JButton showButton) {
    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    for (int i = 0; i < numChoices; i++) {
    box.add(radioButtons[i]);
    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.NORTH);
    pane.add(showButton, BorderLayout.SOUTH);
    return pane;
    public void actionPerformed(ActionEvent e) {
    String command = group.getSelection().getActionCommand();
    //else if button pushed is save
    if (command == saveCommand){
    // save file
    //else if button pushed is search by last name
    else if (command == sortByLN){
    // search by last name
    //else if button pushed is sort by last name
    else if (command == searchLNCommand){
    // sort by last name
    // print to screen
    //else if button pushed is display address, ph#, dob
    else if (command == printAPD){
    // display "search by last name" dialog
    // search last names
    // if last name found
    // print data
    // else
    // print error notification "person not found"
    //else if button pushed is list names of people whose
    //bday between 2 days
    else if (command == printNamesDOB){
    // ask for which dates
    // search bday
    // print to screen
    //else if button pushed is print names of people between 2 last names
    else if (command == printNamesDOB){
    // ask for which two last names
    // search last names
    // if people found
    // print to screen
    //else
    //print error notification "no one found"
    //else if button pushed is print all family members, friends
    //or business associates
    else if (command == printPType){
    //ask for what person type
    //search person types
    //if people found
    //print to screen
    //else print "no one found"
    public void storeAddress(File addressFile){
         Scanner sc=null;
    String lname,fname,street,city,state,zip,phone,persontype,bday;
    try {
    // Delimiters specifiy where to parse tokens in a scanner
    sc = new Scanner(addressFile).useDelimiter("\\s*[\\p{,}*\\s+]\\s*");
    catch (FileNotFoundException fnfe) {
         JOptionPane.showMessageDialog(this,"Could not open the file");
    System.exit(-1);
    for(int i=0; i<MAX_ADDRESS_ENTRIES; i++){
         while (sc.hasNext()) {
    lname=(sc.next());
         if (!lname.equals("")){
         addressBookEntries[i].setLName()=lname;
    public class AddressBookEntry{
    private extPerson address;
    private String date;
    private extPerson ExtPerson;
    public class Person{
    protected String lastName, firstName;
    private String address;
    private String city;
    private String state;
    private String zipcode;
    private String homephone;
    private String extPersonType;
    private Date bday;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
    public String toString() {
    return lastName+" "+firstName;
    public void setLName(String last) {
    lastName=last;
    public void setFName(String first){
    firstName=first;
    public String getLastName() {
    return lastName;
    public String getFirstName() {
    return lastName;
    public Person() {
    lastName="";
    firstName="";
    public Person(String first, String last){
    setLName(last);
    setFName(first);
    //Set the address and return it
    public void setAddress( String addr ){
    address = addr;
    public String getAddress(){
    return address;
    //set the city and return it
    public void setCity( String town ){
    city = town;
    public String getCity(){
    return city;
    //set the state and return it
    public void setState( String st )
    state = st;
    public String getState()
    return state;
    //Set the zip code and return it
    public void setZipCode( String zip ){
    zipcode = zip;
    public String getZipCode(){
    return zipcode;
    //Set the home phone and return it
    public void setHomePhone( String homeph ){
    homephone = homeph;
    public String getHomePhone(){
    return homephone;
    //Set the bday and return it
    public Date getBday(){
    return bday;
    public void setBday(Date newBday) {
    bday = newBday;
    dateFormat.format(bday);
    //Set the extPerson type and return it
    public String getPType(){
    return extPersonType;
    public void setPBusiness(){
    extPersonType = "Business Associate";
    public void setPFamily(){
    extPersonType = "Family Member";
    public void setPFriend(){
    extPersonType = "Friend";
    public class extPerson extends Person{
    //new clss People
    public class People {
         int MAX_PEOPLE=500;
         BufferedReader bf;
    public String toString() {
              StringBuffer sb=new StringBuffer();
              for (int i=0; i<nPeople; i++)
              sb=sb.append(group[i]+"\n");
              return sb.toString();
    public void read(){
              String str;
              try {
              bf=new BufferedReader(new FileReader(new File(FILE_NAME)));
              str=bf.readLine();
              while (str!=null) {
              insert(str);
                   str=bf.readLine();
         catch (IOException e) {
              // Will jump to here on an eof condition.
         try {
              bf.close();
         catch (IOException e) {}
         public void save() {
              try {
              PrintWriter pw=new PrintWriter(FILE_NAME);
              for (int i=0; i<nPeople; i++)
              pw.println(group[i]+",");
              pw.close();
         catch (FileNotFoundException fne) {
                   System.out.println("Could not Save "+FILE_NAME);
    public People() {
              group=new extPerson[MAX_PEOPLE];
              nPeople=0;
         public boolean insert(String data) {
              if (nPeople<MAX_PEOPLE) {
              //extPerson guy=new extPerson(data);
              //group[nPeople]=guy;
              nPeople++;
              return true;
         else {
         JOptionPane.showMessageDialog(null,"Error in People" +
    "::insert: Max size reached.");
         return false;
         public void clear() {
              // This loop frees up the memory used by each extPerson
              for (int i=0; i<nPeople; i++)
              group[i]=null;
              nPeople=0;
    extPerson group[];
    int nPeople;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    public static void createAndShowGUI(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Address Book Program");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container c = frame.getContentPane();
    c.add(new AddressBook(frame));
    frame.pack();
    frame.setVisible(true);
    public static void main (String s[]){       
    //Schedule a job for the event-dispatching thread:
    //creating and showign this application's GUI
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();

    Ok, I have changed my code to reflect your suggested changes, but I'm still unsure how to use the findInLine you suggested.... This is all very new to me and I've been looking on the java website for suggestions, but I'm still stumped on how to pull this together. I'm unsure on how to set the lastname,firstname,etc. for retrieval...
    Here's my code:
    //ADDRESS BOOK
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    *  @created September 14, 2004
    *  This program uses a JFrame to manipulate data and form an
    *  address book.  The user will be able to load data from a file,
    *  sort it by last name, print the address, phone number, and date
    *  of birth, print the names of people whos birthday are between 2
    *  dates, print the names of people between 2 last names, and/or
    *  print the names of different person types.
    public class AddressBook extends JPanel implements ActionListener{
        JFrame frame;
        final int numButtons = 7;
        JRadioButton[] radioButtons = new JRadioButton[numButtons];
        JButton process = new JButton("Process Request");
        JLabel title;
        JTextArea output = new JTextArea(30,50);
        int MAX_ADDRESS_ENTRIES = 500;
        AddressBookEntry addressBookEntries[] = new
        AddressBookEntry[MAX_ADDRESS_ENTRIES];
        public AddressBook(JFrame frame){
            super(new BorderLayout());
            this.frame=frame;
            JPanel choicePanel = createSimpleDialogBox();
            choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
            " to choose from:"));
            title = new JLabel("<html><h2> Thank you for opening the " +
            "Address Book.  " +
            "Please Press the \"Process Request\" " +
            "after making a choice.</h2></html>\n",JLabel.CENTER);
            title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
            output.setEditable(false);
            add(title, BorderLayout.NORTH);
            add(choicePanel, BorderLayout.CENTER);
            add(output, BorderLayout.SOUTH);
            final ButtonGroup group = new ButtonGroup();
            final String saveCommand = "Save";
            final String sortByLN = "Sort by Last Name";
            final String searchLNCommand = "Search By Last Name";
            final String printAPD = "Print address, phone number, and DOB";
            final String printNamesDOB = "Print names of people whose birthday" +
            " falls between 2 dates";
            final String printNamesLN = "Print names of people who fall" +
            " between 2 last names";
            final String printPType = "Print all family members, friends, or" +
            " business associates";
        private JPanel createSimpleDialogBox(){
            radioButtons[0] = new JRadioButton(
              "<html>Save the address file</html>");
            radioButtons[0].setActionCommand(saveCommand);
            radioButtons[1] = new JRadioButton(
              "<html>Sort the address file by last name</html>");
            radioButtons[1].setActionCommand(sortByLN);
            radioButtons[2] = new JRadioButton(
              "<html>Search the address file by last name</html>");
            radioButtons[2].setActionCommand(searchLNCommand);
            radioButtons[3] = new JRadioButton(
              "<html>Print the address, phone number, and DOB of a specified" +
              " person</html>");
            radioButtons[3].setActionCommand(printAPD);
            radioButtons[4] = new JRadioButton(
              "<html>Print the names of people whose birthday falls between" +
              " two dates</html>");
            radioButtons[4].setActionCommand(printNamesDOB);
            radioButtons[5] = new JRadioButton(
              "<html>Print the names of people who fall between two" +
              " specified last names</html>");
            radioButtons[5].setActionCommand(printNamesLN);
            radioButtons[6] = new JRadioButton(
              "<html>Print all family members, friends, <u>OR</u>" +
              " business associates</html>");
            radioButtons[6].setActionCommand(printPType);
            for (int i=0; i<numButtons; i++){
                group.add(radioButtons);
    //set the first button (open file) to be selected
    radioButtons[0].setSelected(true);
    return createPane(radioButtons, process);
    private JPanel createPane(JRadioButton[] radioButtons,
    JButton showButton) {
    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    for (int i = 0; i < numChoices; i++) {
    box.add(radioButtons[i]);
    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.NORTH);
    pane.add(showButton, BorderLayout.SOUTH);
    return pane;
    public void actionPerformed(ActionEvent e) {
    String command = group.getSelection().getActionCommand();
    //else if button pushed is save
    if (command == saveCommand){
    // save file
    //else if button pushed is search by last name
    else if (command == sortByLN){
    // search by last name
    //else if button pushed is sort by last name
    else if (command == searchLNCommand){
    // sort by last name
    // print to screen
    //else if button pushed is display address, ph#, dob
    else if (command == printAPD){
    // display "search by last name" dialog
    // search last names
    // if last name found
    // print data
    // else
    // print error notification "person not found"
    //else if button pushed is list names of people whose
    //bday between 2 days
    else if (command == printNamesDOB){
    // ask for which dates
    // search bday
    // print to screen
    //else if button pushed is print names of people between 2 last names
    else if (command == printNamesDOB){
    // ask for which two last names
    // search last names
    // if people found
    // print to screen
    //else
    //print error notification "no one found"
    //else if button pushed is print all family members, friends
    //or business associates
    else if (command == printPType){
    //ask for what person type
    //search person types
    //if people found
    //print to screen
    //else print "no one found"
    public class AddressBookEntry{
    private extPerson address;
    private String date;
    private extPerson ExtPerson;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    public static void createAndShowGUI(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Address Book Program");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container c = frame.getContentPane();
    c.add(new AddressBook(frame));
    frame.pack();
    frame.setVisible(true);
    public static void main (String s[]){       
    //Schedule a job for the event-dispatching thread:
    //creating and showign this application's GUI
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    //PERSON
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    public class Person{
    protected String lastName, firstName;
    private String address;
    private String city;
    private String state;
    private String zipcode;
    private String homephone;
    private String extPersonType;
    private String bday;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
    public void parseString(String s) {
              try {
              lastName = s.substring(0,s.indexOf(","));
              firstName = s.substring(s.indexOf(",")+1);
    address = s.substring(s.indexOf(",")+2);
    city = s.substring(s.indexOf(",")+3);
    state = s.substring(s.indexOf(",")+4);
    zipcode = s.substring(s.indexOf(",")+5);
    homephone = s.substring(s.indexOf(",")+6);
    extPersonType = s.substring(s.indexOf(",")+7);
    bday = s.substring(s.indexOf(",")+8);
    catch(StringIndexOutOfBoundsException sbe) {
              JOptionPane.showMessageDialog(null,"Error " +
    "in Person: Could not parse the line "+s);
    public String toString() {
    return lastName+","+firstName+","+address+","+city+","+
    state+","+zipcode+","+homephone+","+bday+","+extPersonType;
    public void setLName(String last) {
    lastName=last;
    public void setFName(String first){
    firstName=first;
    public String getLastName() {
    return lastName;
    public String getFirstName() {
    return lastName;
    public Person() {
    lastName="";
    firstName="";
    public Person(String first, String last){
    setLName(last);
    setFName(first);
    //Set the address and return it
    public void setAddress( String addr ){
    address = addr;
    public String getAddress(){
    return address;
    //set the city and return it
    public void setCity( String town ){
    city = town;
    public String getCity(){
    return city;
    //set the state and return it
    public void setState( String st )
    state = st;
    public String getState()
    return state;
    //Set the zip code and return it
    public void setZipCode( String zip ){
    zipcode = zip;
    public String getZipCode(){
    return zipcode;
    //Set the home phone and return it
    public void setHomePhone( String homeph ){
    homephone = homeph;
    public String getHomePhone(){
    return homephone;
    //Set the bday and return it
    public String getBday(){
    return bday;
    public void setBday(String newBday) {
    bday = newBday;
    dateFormat.format(bday);
    //Set the extPerson type and return it
    public String getPType(){
    return extPersonType;
    public void setPBusiness(){
    extPersonType = "Business Associate";
    public void setPFamily(){
    extPersonType = "Family Member";
    public void setPFriend(){
    extPersonType = "Friend";
    public Person(String data) {
    parseString(data);
    //EXTPERSON
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    //new clss extPerson
    public class extPerson extends Person {       
         int MAX_PEOPLE=500;
         BufferedReader bf;
    String lname,fname,street,city,state,zip,phone,persontype,bday;
    String FILE_NAME="AddressBook.txt";
    public String toString() {
              StringBuffer sb=new StringBuffer();
              for (int i=0; i<nPeople; i++)
              sb=sb.append(group1[i]+"\n");
              return sb.toString();
         public void save() {
              try {
              PrintWriter pw=new PrintWriter(FILE_NAME);
              for (int i=0; i<nPeople; i++)
              pw.println(group1[i]+",");
              pw.close();
         catch (FileNotFoundException fne) {
                   System.out.println("Could not Save "+FILE_NAME);
    public extPerson() {
              group1=new extPerson[MAX_PEOPLE];
              nPeople=0;
         public boolean insert(String data) {
              if (nPeople<MAX_PEOPLE) {
              Person guy = new Person(data);
              group1[nPeople]=guy;
              nPeople++;
              return true;
         else {
         JOptionPane.showMessageDialog(null,"Error in People" +
    "::insert: Max size reached.");
         return false;
    Person group1[];
    int nPeople;

  • Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1

    hello guys, i'm a newbie here.
    I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
    first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
    By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
    REPORT ZHR_TESTEMAIL .
    TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
    DATA: FOLD_YR(2) TYPE C,
          FOLD_TYPE(3) TYPE C,
          G_HEADER LIKE SOOD2,
          G_FOLMAM LIKE SOFM2,
          METHOD1 LIKE SY-UCOMM,
          G_DOCUMENT LIKE SOOD4,
          G_USER LIKE SOUDNAMEI1,
          FOLD_NUMBER(12) TYPE C,
          G_NEW_PARENT LIKE SOODK,
          G_OWNER LIKE SOUD-USRNAM,
          G_REF_DOCUMENT LIKE SOOD4,
          G_USER_DATA LIKE SOUDATAI1,
          G_AUTHORITY LIKE SOFA-USRACC,
          G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
          G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
          G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
          G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
          G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF G_FILES OCCURS 10 ,
          TEXT(4096) TYPE C,
          END OF G_FILES.
    DATA: BEGIN OF IT_WS_FILE OCCURS 0,
          WS_FILE LIKE RLGRAP-FILENAME,
          END OF IT_WS_FILE.
    DATA: BEGIN OF IT_SAPID OCCURS 0,
          SAPID LIKE USR02-BNAME,
          END OF IT_SAPID.
    DATA: BEGIN OF IT_EMAIL OCCURS 0,
          EMAILADD LIKE PA0105-USRID_LONG,
          END OF IT_EMAIL.
    DATA: BEGIN OF IT_TSP01 OCCURS 0.
            INCLUDE STRUCTURE TSP01.
    DATA: END OF IT_TSP01.
    DATA: BEGIN OF TAB2 OCCURS 50,
          TEXT(200) TYPE C,
          END OF TAB2.
    DATA: V_DOCDATA TYPE SODOCCHGI1,
          V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
          V_OBJHEAD LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJTXT  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJBIN  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJHEX  LIKE SOLIX      OCCURS 0 WITH HEADER LINE,
          IT_RECVRS TYPE SOMLRECI1  OCCURS 0 WITH HEADER LINE,
          IT_CONTNT TYPE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          IT_BODY   LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          V_TLIN    TYPE I,
          V_LINE    TYPE I.
    DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
          TEXTLINE(5000),
          END OF IT_TEXTLINE.
    DATA: FYL LIKE RLGRAP-FILENAME,
          GV_SUBNO LIKE SOSU-SUBNO,
          GV_EMAIL LIKE PA0105-USRID_LONG,
          GV_NEXTDAY LIKE SY-DATUM,
          YEAR(4) TYPE C,
          RECFLAG TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUBJ(254) TYPE C OBLIGATORY,            "Subject
                DESC(254) TYPE C.                       "Message
    SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
    SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM2.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT2 RADIOBUTTON GROUP A.                  "Server
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT3 RADIOBUTTON GROUP A.                  "Spool
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
    PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER.            "Spool Number
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PARAM3.
    SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
    SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PROC.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
      DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
      CLEAR: WS_FILE_TEMP.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = 'WS_FILE'
           IMPORTING
                FILE_NAME     = WS_FILE_TEMP.
      WS_FILE-LOW = WS_FILE_TEMP.
    AT SELECTION-SCREEN.
      SELECT SAPNAM FROM SOUC
          INTO TABLE IT_SAPID
          WHERE SAPNAM IN SAPID
            AND DELETED = ''.
      GV_NEXTDAY = SY-DATUM + 1.
      LOOP AT EMAILADD.
        IT_EMAIL-EMAILADD = EMAILADD-LOW.
        APPEND IT_EMAIL.
        CLEAR: IT_EMAIL.
      ENDLOOP.
      IF NOT BPROC IS INITIAL.
        CLEAR: RBUT1, RBUT3.
        RBUT2 = 'X'.
      ELSE.
        CLEAR: RBUT2.
      ENDIF.
      IF NOT RBUT3 IS INITIAL.
        REFRESH: WS_FILE.
      ENDIF.
      IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
        MESSAGE E000(ZZ) WITH TEXT-201.
      ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
        CLEAR IT_SAPID.
        READ TABLE IT_SAPID.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          MESSAGE E000(ZZ) WITH TEXT-202.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
        CLEAR: IT_SAPID, IT_EMAIL.
        READ TABLE IT_SAPID.
        READ TABLE IT_EMAIL.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
                          WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
                          WITH SUB_ESC EQ 'U'
                          WITH EDAT EQ SY-DATUM
                          WITH BDAT EQ SY-DATUM
                         WITH BDAT EQ GV_NEXTDAY
                         WITH EDAT EQ '99991231'
                          WITH BTIM EQ SY-UZEIT
                          WITH ETIM EQ '240000'
                          WITH FORW_ALL EQ 'X'
                          WITH PSTHR2 EQ ''
                          AND RETURN.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
        RECFLAG = 'X'.
      ENDIF.
    START-OF-SELECTION.
        PERFORM B_SENDMAIL.
    FORM B_SENDMAIL.
      YEAR = SY-DATUM+0(4).
      LOOP AT WS_FILE.
        CLEAR: FYL.
        FYL = WS_FILE-LOW.
        REFRESH: TAB2.
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME = FYL
                  FILETYPE = 'BIN'
             TABLES
                  DATA_TAB = TAB2.
        IT_TEXTLINE[] = TAB2[].
    DOCUMENT_DATA (SUBJECT OF MAIL)
        V_DOCDATA-OBJ_NAME   = DESC.
        V_DOCDATA-OBJ_DESCR  = SUBJ.
        V_DOCDATA-OBJ_LANGU  = SY-LANGU.
        V_DOCDATA-SENSITIVTY = 'C'.
        V_DOCDATA-OBJ_PRIO   = '1'.
    BODY OF MAIL
        IT_BODY-LINE = 'Collection Report'.
        APPEND IT_BODY.
    CONTENTS_TXT (Attachments)
        IT_CONTNT[] = IT_TEXTLINE[].
        DESCRIBE TABLE IT_CONTNT LINES V_LINE.
        READ TABLE IT_CONTNT INDEX V_LINE.
    PACKING_LIST
        V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
        V_OBJPACK-TRANSF_BIN = 'X'.
        V_OBJPACK-HEAD_START = 1.
        V_OBJPACK-HEAD_NUM   = 0.
        V_OBJPACK-BODY_START = 1.
        V_OBJPACK-BODY_NUM   = V_LINE.
        V_OBJPACK-DOC_TYPE   = 'TXT'.
        V_OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
        V_OBJPACK-OBJ_DESCR  = 'Attached Document'.
        APPEND V_OBJPACK.
        CLEAR  V_OBJPACK.
    RECEIVERS of mail
        IF RECFLAG IS INITIAL.
          LOOP AT IT_SAPID.
            IT_RECVRS-RECEIVER   = IT_SAPID-SAPID.
            IT_RECVRS-REC_TYPE   = 'B'.
            IT_RECVRS-COM_TYPE   = ''.
            IT_RECVRS-EXPRESS    = 'X'.
            IT_RECVRS-NO_FORWARD = ''.
            IT_RECVRS-NO_PRINT   = ''.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ELSE.
          LOOP AT EMAILADD.
            IT_RECVRS-RECEIVER   = EMAILADD-LOW.
            IT_RECVRS-REC_TYPE   = 'U'.
            IT_RECVRS-COM_TYPE   = 'INT'.
            IT_RECVRS-EXPRESS    = 'X'.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ENDIF.
    OBJECT_HEADER (Filename)
        CONCATENATE 'Collection Report' '_'
                     SY-DATUM+4(4) YEAR '.TXT'
                     INTO V_OBJHEAD-LINE.
       V_OBJHEAD-LINE = FYL+16(25).
        APPEND V_OBJHEAD.
        CLEAR V_OBJHEAD.
    Function Module For Sending Mail with Attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  DOCUMENT_DATA              = V_DOCDATA
             TABLES
                  PACKING_LIST               = V_OBJPACK
                  OBJECT_HEADER              = V_OBJHEAD
                  CONTENTS_HEX               = IT_CONTNT
                  CONTENTS_TXT               = IT_BODY
                  RECEIVERS                  = IT_RECVRS
             EXCEPTIONS
                  TOO_MANY_RECEIVERS         = 1
                  DOCUMENT_NOT_SENT          = 2
                  DOCUMENT_TYPE_NOT_EXIST    = 3
                  OPERATION_NO_AUTHORIZATION = 4
                  PARAMETER_ERROR            = 5
                  X_ERROR                    = 6
                  ENQUEUE_ERROR              = 7
                  OTHERS                     = 8.
        IF SY-SUBRC = 0.
          MESSAGE S000(ZZ) WITH TEXT-005.
        ELSE.
          MESSAGE S000(ZZ) WITH TEXT-006.
        ENDIF.
      ENDLOOP.
    end of my code *
    please help me guys... when i run this program,    DOCUMENT_NOT_SENT is what i always get.. 
    waiting for ur reply... thank you vey much and godbless.

    Hi,
    Try this sample code.
    FORM SEND_TO_EMAIL USING zFName.
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA: ctmp(50) TYPE C.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'JOURNAL'.
      CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      DOC_CHNG-OBJ_DESCR = cTmp.
      OBJTXT = 'SAP Payroll Journal'.
      APPEND OBJTXT.
      CONCATENATE 'For Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      CONCATENATE 'Attached File :' zFname INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      OBJTXT = 'Please find the attachment.'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      <b>LOOP AT xMail.
        CONDENSE xMail-aline.
        OBJBIN = xMail-aline.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.</b>
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = zFname. APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      OBJPACK-OBJ_NAME = 'DATA'.
      OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      LOOP AT PENERIMA.
        CONDENSE PENERIMA-PNRM.
        RECLIST-RECEIVER = PENERIMA-PNRM.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
      ENDLOOP.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = ' '
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
      CASE SY-SUBRC.
        WHEN 0.
          WRITE: / 'Result of the send process:'.
          LOOP AT RECLIST.
            WRITE: / RECLIST-RECEIVER(48), ':'.
            IF RECLIST-RETRN_CODE = 0.
              WRITE / 'The document was sent'.
            ELSE.
              WRITE / 'The document could not be sent'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receiver'.
        WHEN 2.
          WRITE: / 'Document could not be sent to any recipient'.
        WHEN 4.
          WRITE: / 'No send authorization'.
        WHEN OTHERS.
          WRITE: / 'Error occurred while sending'.
      ENDCASE.
    ENDFORM.

  • How to input data into an arraylist from a text file?

    I am trying to take data from a text file and put that data into an arraylist. First here is the text file:
    [item1, 10, 125.0, item2, 10, 12.0, item3, 20, 158.0]
    3
    4530.0
    [item5, 65, 555.5, item4, 29, 689.0]
    2
    56088.5
    [item7, 84, 34.5, item6, 103, 0.5, item8, 85, 1.36]
    3
    3065.1The text between the [ ] is the output from my arraylists. I have three arraylists. The first [ ] belongs to arraylist A, the second to arraylist B, and the third to arraylist C. The format of the arraylists is this:
    <item name>,<# in stock>,<value of one item>
    The first number below the arraylists in the text file represents the number of items in the list. The second number below the arraylists represents the total value of the items in the arraylists.
    Here is the class file I have (yes, it does everything):
    import java.io.*;
    import java.util.Scanner;
    import java.util.ArrayList;
    public class Inventory extends Object
         public int toAdd = 0;
         private boolean done = false;               //Are we done yet?
         public String strItemName;                    //The name of the item type.
         public int intNumInStock;                    //The number in stock of that type.      
         public double dblValueOfOneItem;          //The value of one item.
        public String strNumberInStock;               
        public double dblTotalValueA;               //The total value of warehouse A.
        public double dblTotalValueB;               //The total value of warehouse B.
        public double dblTotalValueC;               //The total value of warehouse C.
        public int intWarehouseAItemCount;          //Counter for items in warehouse A.
        public int intWarehouseBItemCount;          //Counter for items in warehouse B.
        public int intWarehouseCItemCount;          //Counter for items in warehouse C.
         ArrayList warehouseAList = new ArrayList();     //Create the Warehouse A ArrayList.                                   
         ArrayList warehouseBList = new ArrayList(); //Create the Warehouse B arrayList.
         ArrayList warehouseCList = new ArrayList(); //Create the Warehouse C arrayList.
         /** Construct a new Inventory object. */
         public Inventory()
              super();
         /**Add items to the Warehouse A ArrayList.*/
         private void createWareHouseA()
              System.out.println("!" + toAdd + " item types will be added to warehouse A.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseAList :  " +
                                                                warehouseAList.size());
              //Add items to the array List
              warehouseAList.add(this.strItemName);
              warehouseAList.add(this.strNumberInStock);
              warehouseAList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseAList.size());
         /**Add items to the Warehouse B ArrayList.*/
         private void createWareHouseB()
              System.out.println("!" + toAdd + " item types will be added to warehouse B.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseBList :  " +
                                                                warehouseBList.size());
              //Add items to the array List
              warehouseBList.add(this.strItemName);
              warehouseBList.add(this.strNumberInStock);
              warehouseBList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseBList.size());
         /**Add items to the Warehouse C ArrayList.*/
         private void createWareHouseC()
              System.out.println("!" + toAdd + " item types will be added to warehouse C.");
              //Cast
              String strNumInStock = Integer.toString(intNumInStock);
              String strValueOfOneItem = Double.toString(dblValueOfOneItem);
              this.strNumberInStock = strNumInStock;
              System.out.println("!Initial size of warehouseCList :  " +
                                                                warehouseCList.size());
              //Add items to the array List
              warehouseCList.add(this.strItemName);
              warehouseCList.add(this.strNumberInStock);
              warehouseCList.add(this.dblValueOfOneItem);
              System.out.println("!size of arrayList after additions " + warehouseCList.size());
         /**Interpret the commands entered by the user.*/
         public void cmdInterpreter()
              this.displayHelp();
              Scanner cin = new Scanner(System.in);
              while (!this.done)
                   System.out.print(">");
                   //"line" equals the next line of input.
                   String line = cin.nextLine();
                   this.executeCmd(line);
         /**Execute one line entered by the user.
          * @param cmdLN; The command entered by the user to execute. */
          private void executeCmd(String cmdLN)
               Scanner line = new Scanner(cmdLN);
               if (line.hasNext())
                    String cmd = line.next();
                    //What to do when users enter the various commands below.
                    if (cmd.equals("help"))
                         this.displayHelp();
                    else if (cmd.equals("Q!"))
                         this.done = true;
                    else if (cmd.equals("F") && line.hasNext())
                         this.inputFromFile(line.next());
                    else if (cmd.equals("K") && line.hasNext())
                         int numItemsToAdd = Integer.valueOf( line.next() ).intValue();
                         this.toAdd = numItemsToAdd;
                         this.inputFromKeyboard(numItemsToAdd);
          /**What to do if input comes from a file.
           *     @param inputFile; The name of the input file to process.*/
          private void inputFromFile(String inputFile)
               Scanner cin = new Scanner(System.in);
               System.out.println("!Using input file " + inputFile + ".");
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               System.out.println("!Using output file " + outputFile + ".");
              try
                   BufferedReader in = new BufferedReader(new FileReader(inputFile));
                   //Scanner in = new Scanner(new File(inputFile));
                   //Initialize the String variables.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   String line7 = null;
                   String line8 = null;
                   String line9 = null;
                   System.out.println(in.equals(",") + " see?");
                   //System.out.println((char)(char)in.read() + " experiment");
                   /**This loop assigns values to the string variables based on the
                    * values on each line in the input file. */
                   while(in.readLine() != null)
                        line1 = in.readLine();
                        line2 = in.readLine();
                        line3 = in.readLine();
                        line4 = in.readLine();
                        line5 = in.readLine();
                        line6 = in.readLine();
                        line7 = in.readLine();
                        line8 = in.readLine();
                        line9 = in.readLine();
                   //Print the contents of each line in the input file.
                   System.out.println("!value of line 1: " + line1);
                   System.out.println("!value of line 2: " + line2);
                   System.out.println("!value of line 3: " + line3);
                   System.out.println("!value of line 4: " + line4);
                   System.out.println("!value of line 5: " + line5);
                   System.out.println("!value of line 6: " + line6);
                   System.out.println("!value of line 7: " + line7);
                   System.out.println("!value of line 8: " + line8);
                   System.out.println("!value of line 9: " + line9);
                /**Add items to the warehouses.*/
                   warehouseAList.add(line1);
                   warehouseBList.add(line4);
                   warehouseCList.add(line7);
                /**Add the item count and total value for warehouse A.*/
                   int intLine2 = Integer.valueOf(line2).intValue();
                   this.intWarehouseAItemCount = intLine2;
                   double dblLine3 = Double.valueOf(line3).doubleValue();
                   this.dblTotalValueA = dblLine3;
                /**Add the item count and total value for warehouse B.*/
                   int intLine5 = Integer.valueOf(line5).intValue();
                   this.intWarehouseBItemCount = intLine5;
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   this.dblTotalValueB = dblLine6;
                /**Add the item count and total value for warehouse C.*/
                  int intLine8 = Integer.valueOf(line8).intValue();
                  this.intWarehouseCItemCount = intLine8;
                  double dblLine9 = Double.valueOf(line9).doubleValue();
                  this.dblTotalValueC = dblLine9;
                /**Ask the user how many items to add or delete from inventory.*/
                  System.out.print("Enter the number to add to inventory for " +
                                                               warehouseAList.get(0) + ":");
                  String toAddOrDel = cin.next();
                /**Print the contents of all the warehouses. */
                   System.out.println(" ");
                   //Print the contents of warehouse A.
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse A:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse A.
                   System.out.println(warehouseAList);
                   //Print the total amount of items in warehouse A.
                   System.out.println("Total items: " + this.intWarehouseAItemCount);
                   //Print the total value of the items in warehouse A.
                   System.out.println("Total value: " + this.dblTotalValueA);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse B:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse B.
                   System.out.println("!warehouseB: " + warehouseBList);
                   //Print the total amount of items in warehouse B.
                   System.out.println("Total items: " + this.intWarehouseBItemCount);
                   //Print the total value of the items in warehouse B.
                   System.out.println("Total value: " + this.dblTotalValueB);
                   System.out.println("!--------------------------------");
                   System.out.println("!----------Warehouse C:----------");
                   System.out.println("!--------------------------------");
                   //Print the item list for warehouse C.
                   System.out.println("!warehouseC: " + warehouseCList);
                   //Print the total amount of items in warehouse C.
                   System.out.println("Total items: " + this.intWarehouseCItemCount);
                   //Print the total value of the items in warehouse C.
                   System.out.println("Total value: " + this.dblTotalValueC);
                   in.close();
              catch (FileNotFoundException e)
                   System.out.println("!Error: Unable to open file for reading.");
              catch (EOFException e)
                   System.out.println("!Error: EOF encountered, file may be corrupted.");
              catch (IOException e)
                   System.out.println("!Error: Cannot read from file.");
          /**What to do if input comes from the keyboard.
           *     @param numItems; The total number of items that will be added to the
           *                      Warehouse(s). */
          public void inputFromKeyboard(int numItems)
               System.out.println("!You will be adding " + numItems + " items to " +
                                             "inventory from the keyboard. ");
               this.toAdd = numItems;
               Scanner cin = new Scanner(System.in);
               //Prompt user for name of output file.
               System.out.print("!Enter the name of the output file: ");
               String outputFile = cin.next();
               /**This loop asks the user for information about the item(s) and inputs
                 *them into the appropriate array.*/
               int count = 0;
               while (numItems > count)
                    //Item name.
                    System.out.print("!Item name: ");
                    String addItemName = cin.next();
                    //Number in stock.
                    System.out.print("!Number in stock: ");
                    String addNumInStock = cin.next();
                    //Initial warehouse.
                    System.out.print("!Initial warehouse(A,B,C): ");
                    String addInitWarehouse = cin.next();
                    //Value of one item.
                    System.out.print("!Value of one item: ");
                    String addValueOfOneItem = cin.next();
                    //Add or delete from inventory
                    System.out.print("!Enter amount to add or delete from inventory: ");
                    String strAddOrDelete = cin.next();
                    System.out.println("!Amount to add or delete: " + strAddOrDelete);
                    //Cast
                    int intAddNumInStock = Integer.valueOf(addNumInStock).intValue();
                    double doubleAddValueOfOneItem = Double.valueOf(addValueOfOneItem).doubleValue();
                    int intAddOrDelete = Integer.valueOf(strAddOrDelete).intValue();
                    /**Add intAddNumInStock with intAddOrDelete to determine the amount
                     * to add or delete from inventory (If a user wishes to remove items
                     * from inventory simply add negative values). */
                    intAddNumInStock = intAddNumInStock + intAddOrDelete;
                    System.out.println("!Inventory after modifications: " + strAddOrDelete);
                    this.strItemName = addItemName;
                    this.intNumInStock = intAddNumInStock;
                    this.dblValueOfOneItem = doubleAddValueOfOneItem;
                    //Put items into warehouse A if appropriate.
                    if (intAddNumInStock < 25)
                        //Increment the warehouse A item count.
                        this.intWarehouseAItemCount = this.intWarehouseAItemCount + 1;
                        //Calculate the total value of warehouse A.
                        this.dblTotalValueA = this.dblTotalValueA + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse A array list.
                        this.createWareHouseA();
                    //Put items into warehouse B if appropriate.
                    if (intAddNumInStock >= 25)
                        if (intAddNumInStock < 75)
                             //Increment the warehouse B item count.
                             this.intWarehouseBItemCount = this.intWarehouseBItemCount + 1;
                             //Calculate the total value of warehouse B.
                             this.dblTotalValueB = this.dblTotalValueB + intAddNumInStock * doubleAddValueOfOneItem;
                             //Create the warehouse B array list.
                             this.createWareHouseB();
                    //Put items into warehouse C if appropriate.
                    if (intAddNumInStock >= 75)
                        //Increment the warehouse C item count.
                        this.intWarehouseCItemCount = this.intWarehouseCItemCount + 1;
                        //Calculate the total value of warehouse C.
                        this.dblTotalValueC = this.dblTotalValueC + intAddNumInStock * doubleAddValueOfOneItem;
                        //Create the warehouse C array list.
                        this.createWareHouseC();
                     //display helpful information.      
                    System.out.println("!--------------------------------");
                    System.out.println("!" + addItemName + " is the item name.");
                    System.out.println("!" + addNumInStock + " is the number in stock.");
                    System.out.println("!" + addInitWarehouse + " is the initial warehouse.");
                    System.out.println("!" + addValueOfOneItem + " is the value of one item.");
                    System.out.println("!--------------------------------------------------");
                   //Increment the counters.
                    count++;
               /**Create and write to the output file. */
               try
                     //Use the output file specified by the user.
                    PrintWriter out = new PrintWriter(outputFile);
                 /**Write warehouse A details.*/
                      //Blank the first line.
                      out.println(" ");
                    //Write the array list for warehouse A.
                    out.println(warehouseAList);
                    //Write the amount of items in warehouse A.
                    out.println(intWarehouseAItemCount);
                    //Write the total value for warehouse A.
                    out.println(dblTotalValueA);
                 /**Write warehosue B details.*/
                   //Write the array list for warehouse B.
                    out.println(warehouseBList);
                    //Write the amount of items in warehouse B.
                    out.println(intWarehouseBItemCount);
                    //Write the total value for warehouse B.
                    out.println(dblTotalValueB);
                 /**Write warehouse C details.*/
                      //Write the array list for warehouse C.
                    out.println(warehouseCList);
                    //Write the amount of items in warehouse C.
                    out.println(intWarehouseCItemCount);
                    //Write the total value for warehouse C.
                    out.println(dblTotalValueC);
                    //Close the output file.
                    out.close();     
                catch (FileNotFoundException e)
                   System.out.println("Error: Unable to open file for reading.");
               catch (IOException e)
                   System.out.println("Error: Cannot read from file.");
               /**View the contents and the value of each warehouse.*/
               System.out.println("!---------------Inventory Summary------------------");
               System.out.println("!--------------------------------------------------");
               System.out.println("!--------------------LEGEND:-----------------------");
               System.out.println("!<item type>, <amount in stock>,<value of one item>");
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse A:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse A.
               System.out.println(warehouseAList);
               //Total items in warehouse A.
               System.out.println("Total items: " + intWarehouseAItemCount);
               //Display total value of warehouse A.
               System.out.println("Total value: " + "$" + dblTotalValueA);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse B:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse B.
               System.out.println(warehouseBList);
               //Total items in warehouse B.
               System.out.println("Total items: " + intWarehouseBItemCount);
               //Display total value of warehouse B.
               System.out.println("Total value: " + "$" + dblTotalValueB);
               System.out.println("!--------------------------------------------------");
               System.out.println("!------------------Warehouse C:--------------------");
               System.out.println("!--------------------------------------------------");
               //Display Items in warehouse C.
               System.out.println(warehouseCList);
               //Total items in warehouse C.
               System.out.println("Total items: " + intWarehouseCItemCount);
               //Display total value of warehouse C.
               System.out.println("Total value: " + "$" + dblTotalValueC);
         /**Display a help message.*/
         private void displayHelp()
              System.out.println("!--------------------------------");
              System.out.println("! General Help:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'help' display this help message.");
              System.out.println("!'Q!' quit this program.");
              System.out.println("!--------------------------------");
              System.out.println("! Input File Specific Commands:");
              System.out.println("!--------------------------------");
              System.out.println("! ");
              System.out.println("!'F' <name> type F followed by the name of the " +
                                       "file to be used for input.");
              System.out.println("!---------------------------------------");
              System.out.println("! Input From Keyboard Specific Commands:");
              System.out.println("!---------------------------------------");
              System.out.println("! ");
              System.out.println("!'K' <number> type K followed by the number of " +
                                        "items that will be added. ");
              System.out.println("! ");
    }Program file:
    public class InventoryProg
         public static void main(String[] args)
              //Create a new Inventory object.
              Inventory test = new Inventory();
              //Execute the command interpreter.
              test.cmdInterpreter();
    }Right now I am stuck on this and I cannot progress any further until I figure out how to input the data in the text file back into a arraylist.
    Thanks in advance.

    Thanks but I figured it out. Heres a sample of the code i used to solve my problem:
    try
                           //Warehouse A BufferedReader.
                   BufferedReader inA = new BufferedReader(new FileReader(inputFileWarehouseA));
                   //Warehouse B BufferedReader.
                   BufferedReader inB = new BufferedReader(new FileReader(inputFileWarehouseB));
                   //Warehouse C BufferedReader.
                   BufferedReader inC = new BufferedReader(new FileReader(inputFileWarehouseC));
                   //Warehouse details BufferedReader.
                   BufferedReader inDetails = new BufferedReader(new FileReader(inputFileDetails));
                   //Will hold values in warehouse arraylists.
                   String lineA = null;
                   String lineB = null;
                   String lineC = null;
                   //Will hold the details of each warehouse.
                   String line1 = null;
                   String line2 = null;
                   String line3 = null;
                   String line4 = null;
                   String line5 = null;
                   String line6 = null;
                   //Get the item count and total value for each warehouse.
                   while(inDetails.readLine() != null)
                        line1 = inDetails.readLine();
                        line2 = inDetails.readLine();
                        line3 = inDetails.readLine();
                        line4 = inDetails.readLine();
                        line5 = inDetails.readLine();
                        line6 = inDetails.readLine();
               /**Assign the item count and total value to warehouse A.*/
                  //Cast.
                   int intLine1 = Integer.valueOf(line1).intValue();
                   double dblLine2 = Double.valueOf(line2).doubleValue();
                   //Assign the values.
                   this.intWarehouseAItemCount = intLine1;
                   this.dblTotalValueA = dblLine2;
                /**Assign the item count and total value to warehouse B.*/
                     //Cast.
                   int intLine3 = Integer.valueOf(line3).intValue();
                   double dblLine4 = Double.valueOf(line4).doubleValue();
                     //Assign the values.
                   this.intWarehouseBItemCount = intLine3;
                   this.dblTotalValueB = dblLine4;
                /**Assign the item count and total value to warehouse C.*/
                     //Cast.
                     int intLine5 = Integer.valueOf(line5).intValue();
                   double dblLine6 = Double.valueOf(line6).doubleValue();
                   //Assign the values.
                   this.intWarehouseCItemCount = intLine5;
                   this.dblTotalValueC = dblLine6;
                /**Put the items back into the warehouses arraylists. */
                   //Add items to warehouse A.
                   while((lineA = inA.readLine()) != null)
                        warehouseAList.add(lineA);
                   //Add items to warehouse B.
                   while((lineB = inB.readLine()) != null)
                        warehouseBList.add(lineB);
                   //Add items to warehouse C.
                   while((lineC = inC.readLine()) != null)
                        warehouseCList.add(lineC);
                   }(this isn't the whole try statement its pretty long)

  • How to add header and fooder in text file

    Hi,
    i have created simple application for generate report from database into text file.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.
    the below text are needs to be print in the header
    name of the table :
    Recorder type :
    file creation time:
    the below text are needs to be print in the footer
    Recorder Number:
    Record Type;
    the actual code is
                           pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig  FROM employee where id=300");
                               rs = pst.executeQuery();
                            while (rs.next()) {
                                 request = rs.getString("REQUEST");
                                    domain_name = rs.getString("DOMAIN_NAME");
                                    dateofconfig = rs.getString("dateofConfig");
                                    System.out.println(request + " " + domain_name + " " + dateofconfig);
                                   data.add(request + " " + domain_name + " " + dateofconfig);
                            System.out.println("before calling method");
                            writeToFile(data, "c:/Employee.txt");
                            System.out.println("file created successfull");
                            rs.close();
                            pst.close();
           private static void writeToFile(List list, String path) {
                    BufferedWriter out = null;
                    try {
                            File file = new File(path);
                            out = new BufferedWriter(new FileWriter(file, true));
                            for (Object obj : list) {
                                String s=  obj.toString(); 
                                 out.write(s);
                                    out.newLine();
                            out.close();
                    } catch (IOException e) {
    }Thanks
    Jasmin
    Edited by: user13836688 on Mar 21, 2011 4:06 AM
    Edited by: user13836688 on Mar 21, 2011 4:07 AM
    Edited by: user13836688 on Mar 21, 2011 4:08 AM

    user13836688 wrote:
    i have created simple application for generate report from database into text file.First off, when posting code, use &#91;code]...&#91;/code]. or '' tags, not '<code>'.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
    Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to load Test data from a Text file in ECATT

    Hi,
    I have created a test configuration with a test script, system data container, and test data container.
    I have done the recording of a transaction and created the script. Parameterization is done for the script and have imported those parameters from script in to the data container.
    I am trying to load a the data from a text file on the local work-station. The data is not being read.
    Please explain this in detail (step by step) as I am very new to ECATT.
    I am trying this on SAP ECC 6.0 IDES server.
    Thanks in Advance
    Vikas Patil

    Please explain this in detail (step by step) as I am very new to ECATT.
    Thanks in Advance
    Vikas Patil

  • Error while sending a text file to client as attachment

    I want to download a file on clicking a button. Here is my button code
    <input type="button" onClick="showdownloadwindow()" value="Download My file">
    The java script showdownloadwindow() should invoke a jsp that has code to construct the text file to be downloaded
    Here is the javascript function
    <script>
         function showdownloadwindow()
              var url = 'http://<%=request.getServerName()%>'+':'+<%=request.getServerPort()%>+'/downloadtextfile.jsp';     
              window.open(url,"","");
    </script>
    the downloadtextfile.jsp looks something like this
    <%
              response.setContentType("text/plain");
              response.setHeader("Content-disposition","attachment; filename=myfile.txt" );
              BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
              String temp="Put some text string for now";
              bos.write(temp.getBytes());
              bos.flush();
              bos.close();
              response.flushBuffer();
    %>
    i have two problems
    1. when the button "Download My file" is clicked a separate window is opened and then the save file dialog box appears. How can I change my code
    so that it only shows download window only ( not another browser window)
    2. myfile.txt contains some error in addition to the temp string
    Here is the error from myfile.txt
    <BR><H3>Original Exception: </H3>
    <B>Error Message: </B>SRVE0199E: OutputStream already obtained<BR>
    <B>Error Code: </B>500<BR>
    <B>Target Servlet: </B>/downloadtextfile.jsp<BR>
    <B>Error Stack: </B><BR>
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    <BR>    
         at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter&#40;SRTServletResponse.java:467&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.initOut&#40;JspWriterImpl.java:170&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer&#40;JspWriterImpl.java:163&#41;
    <BR>    
         at org.apache.jasper.runtime.PageContextImpl.release&#40;PageContextImpl.java:217&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext&#40;JspFactoryImpl.java:149&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext&#40;JspFactoryImpl.java:117&#41;
    <BR>    
         at com.ibm._jsp._downloadtextfile._jspService&#40;_downloadtextfile.java:93&#41;
    <BR>    
         at com.ibm.ws.jsp.runtime.HttpJspBase.service&#40;HttpJspBase.java:88&#41;
    <BR>    

    > Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
    > Can someone tell me why this error is happening? 
    Maybe your source file is empty?
    This is exact what the error message says.

  • Help needed in reading text file to database table

    Hello experts,
    i have to insert the values from the column of this text file and insert them in my database table.
    I have done a few file to table insertions but i'm having some trouble with this one.
    Any suggestions plz
    thanks
    liab_report      1.00                                                                                                                              Page: 1
    CDC:00537 / Mon Jun-21-2010                           LIABILITY REPORT                               Mon Jun-21-2010 22:06:26
    DRAW    1; SET    1;  November 7, 2009
                         TOTAL       PAID ON         TOTAL    EXPIRED ON         TOTAL    FRAC   OUTSTANDING
                       WINNERS      06/21/10          PAID      06/21/10       EXPIRED   ROUND
      DIVISION          AMOUNT        AMOUNT        AMOUNT        AMOUNT        AMOUNT  AMOUNT        AMOUNT
        Div1              0.00          0.00          0.00          0.00          0.00    0.00          0.00
        Div2         701040.00          0.00     660146.00          0.00      40894.00    0.00          0.00
        Div3        1444128.00          0.00    1330056.00          0.00     114072.00    0.00          0.00
        Div4        4711900.00          0.00    3889700.00          0.00     822200.00    0.00          0.00
                    6857068.00          0.00    5879902.00          0.00     977166.00    0.00          0.00
    DRAW    2; SET    1;  November 14, 2009
                         TOTAL       PAID ON         TOTAL    EXPIRED ON         TOTAL    FRAC   OUTSTANDING
                       WINNERS      06/21/10          PAID      06/21/10       EXPIRED   ROUND
      DIVISION          AMOUNT        AMOUNT        AMOUNT        AMOUNT        AMOUNT  AMOUNT        AMOUNT
        Div1              0.00          0.00          0.00          0.00          0.00    0.00          0.00
        Div2         817817.00          0.00     817817.00          0.00          0.00    0.00          0.00
        Div3        1687405.00          0.00    1611742.00          0.00      75663.00    0.00          0.00
        Div4        3402100.00          0.00    3034200.00          0.00     367900.00    0.00          0.00
                    5907322.00          0.00    5463759.00          0.00     443563.00    0.00          0.00
    DRAW    3; SET    1;  November 21, 2009
                         TOTAL       PAID ON         TOTAL    EXPIRED ON         TOTAL    FRAC   OUTSTANDING
                       WINNERS      06/21/10          PAID      06/21/10       EXPIRED   ROUND
      DIVISION          AMOUNT        AMOUNT        AMOUNT        AMOUNT        AMOUNT  AMOUNT        AMOUNT
        Div1              0.00          0.00          0.00          0.00          0.00    0.00          0.00
        Div2         779933.00          0.00     769804.00          0.00      10129.00    0.00          0.00
        Div3        1605548.00          0.00    1525104.00          0.00      80444.00    0.00          0.00
        Div4        4891700.00          0.00    4256800.00          0.00     634000.00    0.00        900.00
                    7277181.00          0.00    6551708.00          0.00     724573.00    0.00        900.00

    Plz clarify whether u want to load text file as a file into database or value of this text file into database. If values are to be loaded from this text file, U can better format the text file and use SQL loader to load the file into database. By formatting the database, i mean remove the unnecessary headings and characters, kee only the values to be loaded idelimited by ' '(space) or ','(comma). Create a control file and load it into the target table.

  • Is there a way to automatically add the filename in the page header when batch printing text files directly from finder?

    hello, i have 80 text files (docx). the finder preview works great and i can open them in pages.
    I need to batch print them from finder:
    I select all the documents > drag on printer's icon> printer puts them in queue ( after an on the fly pdf conversion)  ad starts printing.
    BUT
    i need the filename printed on each page  ( in hearder or footer) , not only the regular text content.
    Do you know if there is a workaround?
    thank you
    Tullio

    If that section has an ID or NAME attribute then you can add that to the URL (#anchor) that you want to reload.
    See View > Page Source
    https://support.mozilla.com/en-US/questions/774792#answer-128100

  • 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?

  • Issue when exporting data to text file in BI Publisher 10.1.3.4

    We are trying to export over 900,000 records to a text file from BI Publisher. The reports keep on running while scheduling. But if we reduce the record limit to 200,000 it works fine. Please help us to resolve this issue. Its really urgent.

    How are you doing it? With a template? Need more info to be able to help
    Tim

Maybe you are looking for

  • Receiving transaction Process Error

    Hi All, I am getting below error while running the "Receiving Transaction Processor" concurrent program. Error : RCV_TP_ACCT_PERIOD_CLOSED I verified PO, Inv and GL periods and all are open. Please help me to resolve the issue. Regards, Sreehari.

  • Derivation Of partner profit center in COPA (Direct Posting from FI)

    When posting from SD partner profit center is derived and transfered to COPA, so eliminations can take place. When ever we made posting from SD, Partner profit center is coming from derivation rule which is exclusively for sales and maintained in tra

  • BDT custom SFCs not shown on screen

    We have to set up some custom SFC categories, and I have to create new screens for them so that they are included in claims. According to OSS Note 704333, the following needs to be done (this is copied directly from the note): Enter a new category in

  • AppleScript  and QuickTime frame sequences

    Hi all. I've got some movies with foreign subtitles I want to convert to English. However, when I open them with QT Pro and choose the 'Movie Properties' window I see the subtitles are stored as images in a separate VobSub video track (not text). Big

  • Extraction tar.gz archives without leaving a .tar archive behind

    Hello! When I double-click on a .tar-gz-archive in the Finder, It extracts two things: a tar-archive and the actual content of the file. In 99% of the cases I don't want an additional tar file eating my disk space - is there any way to tell "BomArchi