Buffered Reader, Readline, Change Char

Simple Java Test.
from command line, when i run an appllication this must happen:
First, User enters either (-u, -l, or -t) followed by space
then a string of characters in speech marks.
i.e. -u "this is a simple sentence"
-u means change all the text in speech marks "" to uppercase.
-l means change all the text in speech marks "" to lowercase.
-t means change only the first letter of each word in speech marks "" to uppercase.
Iv got upto this point. Now im stuck. Don't know where to go. I dont want the answer but a little assistance.
import java.io.*;
public class ReadString {
public static void main (String[] args) {
     System.out.println("1. Uppercase (-u)");
     System.out.println("2. Lowercase (-l)");
     System.out.println("3. TitleCase (-t)");
     System.out.println("");
     System.out.println("Enter your action and string i.e. -u ''Hello World'' ");
// Used for listening to input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String Choice = null;
// need to use try/catch with the
// readLine() method
try {
Choice = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error Dont know what your talkin bout!");
System.exit(1);
System.out.println("Result: " + Choice);
Edited by: DollarDollar on Oct 10, 2008 5:57 PM

So basically you haven't done anything after asking for a user input. No one's gonna do the whole thing for you. Post your efforts so far and ask specific questions about your code and where you're stuck and everyone will do their best to point you in the right direction.
Also: When you post code, use the wrap the code in CODE tags. That makes it easy to read. Just mark the code and click the CODE button. Preview the post to make sure it looks good and then post it.

Similar Messages

  • HELP - Buffered Reader

    Below is a portion of my program, its a simple app, that is supposed to read a policy number, and then display the results. I can't get it to read the file, or output onto the app. Any help would be appreciated.
    the file is called loans.txt and a line looks like this...
    12322|Smith, Dennis|456 Westfield Blvd|Westfield, IN 46033|$2,500|1/1/2001|7/11/2005|None
    public void GetFile(){
    //User's entered policy number is stored here
    String Policy_Num_Entered = SearchFor.getText();
    /*If the the policy is found in loans.txt, sucess will be changed to 1,
    otherwise it will stay 0 and be used to output a "I'm Sorry message*/
    int sucess = 0;
    //Try Catch Block
    try{
    BufferedReader br = new BufferedReader(new FileReader(file));
    //Access the first line of loans.txt
    String line = br.readLine();
    //Read the # of lines in loans.txt
    LineNumberReader read = new LineNumberReader(new FileReader(file));
    //Assign the # of lines to count
    int count = read.getLineNumber();
    //Item being looked by the String Tokenizer
    String Item;
    //For loop, looping the # of times a line must be read
    for(int x = 0; x < count; x++){
    //While Line is not empty, proceed
    while ( line != null )
    //Read individual words of the line from loans.txt
    StringTokenizer tokenizer = new StringTokenizer(line, "|");
    Item = tokenizer.nextToken();
    //While the line has more words
    while(tokenizer.hasMoreTokens() )
    //If Word equals "The" add 1 tot he sum
    if(Item == Policy_Num_Entered){
    //Fill in policy Number
    Policy_Number.append(Item);
    Item = tokenizer.nextToken();
    //Fill in First and Last Name
    Name.append(Item);
    //Item = tokenizer.nextToken();
    //Name.append(" " + Item);
    Item = tokenizer.nextToken();
    //Fill in Address
    Address.append(Item);
    Item = tokenizer.nextToken();
    //Address.append(" " + Item);
    //Item = tokenizer.nextToken();
    //Address.append(" " + Item);
    //Item = tokenizer.nextToken();
    //Fill in City, State and Zip Code
    City_St_Zip.append(Item);
    Item = tokenizer.nextToken();
    //City_St_Zip.append(" " + Item);
    //Item = tokenizer.nextToken();
    //City_St_Zip.append(" " + Item);
    //Item = tokenizer.nextToken();
    //Fill in Loan Balance
    LoanBal.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Loan Effective Date
    LoanEffDate.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Maturity Date
    MatDate.append(Item);
    Item = tokenizer.nextToken();
    //Take all the words that are left to fill in Notes
    //while(tokenizer.hasMoreTokens() ){
    Notes.append(" " + Item );
    Item = tokenizer.nextToken();
    //end of while has more tokens
    //Item found so change to 1
    sucess = 1;
    //Break out of the loop
    break;
    }//end of If
    //Grab the next word
    Item = tokenizer.nextToken();
    }//end of while tokenizer
    }//end of while
    //Read the next line
    line = br.readLine();
    }//for loop
    if(sucess == 0)
    JOptionPane.showMessageDialog(Finalapp.this, "I'm sorry the Policy " +
    Policy_Num_Entered + " was not found. Please try "+
    "again.");
    //Close the buffered Reader, and close the .dat file
    br.close();
    }//End of try
    //Catch any errors that may have occured in the reader
    catch(IOException exception)
    exception.printStackTrace();
    }//end of catch
    }//end of GetFile

    Ok I know that my line reader was messing up, so it was never running the loop, my new code reads like this...
    public void GetFile(){
    //User's entered policy number is stored here
    String Policy_Num_Entered = SearchFor.getText();
    /*If the the policy is found in loans.txt, sucess will be changed to 1,
    otherwise it will stay 0 and be used to output a "I'm Sorry message*/
    int sucess = 0;
    //Try Catch Block
    try{
    BufferedReader br = new BufferedReader(new FileReader("loans.txt"));
    /*FileInputStream file = new FileInputStream("c:\\loans.txt");
    BufferedReader br = new BufferedReader( new InputStreamReader( file) );*/
    //Access the first line of loans.txt
    String line = br.readLine();
    //Read the # of lines in loans.txt
    LineNumberReader read = new LineNumberReader(new FileReader("loans.txt"));
    //Assign the # of lines to count
    int count = 7;//read.getLineNumber();
    Policy_Number.append(count + " ");
    //Item being looked by the String Tokenizer
    String Item = null;
    //For loop, looping the # of times a line must be read
    for(int x = 0; x < count; x++){
    //While Line is not empty, proceed
    while ( line != null )
    //Read individual words of the line from loans.txt
    StringTokenizer tokenizer = new StringTokenizer(line, "|");
    Item = tokenizer.nextToken();
    //While the line has more words
    while(tokenizer.hasMoreTokens() )
    //If Word equals "The" add 1 to the sum
    if(Item == Policy_Num_Entered){
    //Fill in policy Number
    Policy_Number.append(Item);
    Item = tokenizer.nextToken();
    //Fill in First and Last Name
    Name.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Address
    Address.append(Item);
    Item = tokenizer.nextToken();
    //Fill in City, State, ZIp Code
    City_St_Zip.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Loan Balance
    LoanBal.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Loan Effective Date
    LoanEffDate.append(Item);
    Item = tokenizer.nextToken();
    //Fill in Maturity Date
    MatDate.append(Item);
    Item = tokenizer.nextToken();
    //Take all the words that are left to fill in Notes
    Notes.append(" " + Item );
    Item = tokenizer.nextToken();
    //Item found so change to 1
    sucess = 1;
    //Break out of the loop
    break;
    }//end of If
    //Grab the next word
    Item = tokenizer.nextToken();
    }//end of while tokenizer
    //Read the next line
    line = br.readLine();
    }//end of while
    }//for loop
    if(sucess == 0)
    JOptionPane.showMessageDialog(Finalapp.this, "I'm sorry the Policy " +
    Policy_Num_Entered + " was not found. Please try "+
    "again.");
    //Close the buffered Reader, and close the .dat file
    br.close();
    }//End of try
    //Catch any errors that may have occured in the reader
    catch(IOException exception)
    exception.printStackTrace();
    }//end of catch
    }//end of GetFile

  • How to changing char. values and create new lines in C_TH_DATA

    Hi experts,
    we need to distribute the cost of some sender costcenters to the corresponding receiver costcenters.
    We have already created a DSO and maintained this with the sender and receiver costcenter. We use this lookup table later in the execute method of our created planning function type to take the sender costcenter and distribute this to the corresponding receiver costcenters.
    I've already implemented an IP planning function based on planning function type for this process.
    At the end when I debug the method I see that this works fine. I give you an example:
    I have in my lookup table the following record:
    sender costcenter           receiver costcenter            distribution percent
    4711                                    4712                                    75
    4711                                    4713                                    25
    Based on those records in the lookup table I've to distribute the cost of sender costcenter to the receiver costcenters.
    Just imagine I would get this record from c_th_data:
    sender costcenter    costelement     value
           4711                 3000111         100
    I have to have the following result after running the exit planning function:
       costcenter    costelement     value
           4711                 3000111         100                   -> without changing
           4711                 8000111        -100
           4712                 8000111           75
           4713                 8000111           25
    When I debug the exit function I see in the execute method that c_th_data will be filled correctly. I see exactly the records that I want to see.
    But once the function is finished I don't see this result. I also checked the conversation
    Changing Char Value in IP C_TH_DATA
    but I can't understand what happens after my coding yet.
    Can anyone help me or give me an advice what could be the problem here?
    Thank you all in advance for your support.
    Kind regards,
    Ali

    Hi Ali,
    The planning function generates the records in delta mode. I am explaining the concept taking your example only:
    Records in cube before running PF:
    sender costcenter           receiver costcenter            distribution percent
    4711                                    4712                                    75
    4711                                    4713                                    25
    sender costcenter    costelement     value
           4711                 3000111         100
           4712                 3000111         100
           4713                 3000111         100
    The records that you need to generate from code(Previous ones need to be changed):
    sender costcenter    costelement     value
           4711                 3000111         000
           4712                 3000111         175
           4713                 3000111         125
    **Please note that you dont need to generate any corrections(delta records), you only need to generate the final values in the records and the PF will generate the delta's on its own. Also in this case you should see 3 Records Read, 0 Deleted, 3 Changed.
    Please let me know if you need any more clarification,
    Thanks,
    Puneet

  • Buffered reader / data inputstream

    I need to find out how to enter array numbers in from the keyboard
    i think it might be by using buffered reader, but i dont know th exact code can
    anybody help me!
    Cheers

    Do you need to keep array of numbers?
    It's simply and not powerfull solution:
    import java.io.*;
    import java.util.Vector;
    public class test
    public static void main (String argv[])
    BufferedReader theIn = new BufferedReader (new InputStreamReader (System.in));
    int nValue;
    int nSumma = 0;
    Vector theItems = new Vector (0, 10);
    while (true)
    try
    nValue = Integer.parseInt (theIn.readLine ());
    nSumma += nValue;
    theItems.addElement (new Integer (nValue));
    catch (Exception e)
    break;
    System.out.println ("Summa: " + nSumma);
    }

  • Buffered Reader from  a JTextArea?

    Hi everyone,
    can anyone please tell me how i can get a buffered reader from a JTextArea? This is what I would like to do where the following gets displayed in the JTextArea
    Please enter your name: (user enters data here)
    Please enter your id number: (user enters id number here)
    I had coded this using the System.in but now trying to convert to a GUI
    Regards,
    M

    Hi there,
    I can't use get text as I will already have the other data that is written in the text area there as well, so it will get all the text. I need to be able to write stuff and then read the next line from what I have written. For example using my the command prompt:
    static BufferedReader br = new BufferedReader(
                                                     new InputStreamReader(System.in));
    System.out.print("Enter choice : ");
                System.out.flush();
                String choiceStr=null;
                try
                    choiceStr = br.readLine();
                } catch (IOException ioe)
                    System.out.println("Error reading choice.");
                    System.exit(1);
                int choice = -1;
                if (choiceStr.length() > 0)
                    choice = Integer.parseInt(choiceStr);
                switch (choice)
                    case 0: ....
                }On screen it would have wrote Enter choice: (user puts "7" )
    when the 7 and then /r is pressed then it will read in the 7 only.
    Thanks, M

  • Buffered Reader IO

    Hi Friends,
    Have a unusual problem.
    I am trying to read a file using buffered reader api as:
    testHandle = new BufferedReader(new FileReader("Test.DAT"));
    but when i do
    while(...){
    String line = testHandle.readLine();
    System.out.println(line);
    the output is :
    My Name is Vishal.
    ello
    When in the file Test.DAT it is :
    # My Name is Vishal.
    Hello
    and if i add * in the Test.DAT file like this
    *# My Name is Vishal.
    Hello
    Then It prints
    # My Name is Vishal.
    ello
    Not able to understand why it is skipping the first letter (zeroth character of every line from the file) .
    Need your help on this.
    Thanks,
    Vishal

    You must be skipping some character(s), which you're not showing in the code snippet you posted. File I/O doesn't just skip over them - so there must be a bug in your code which you have omitted here.

  • Buffered Reader or String Buffer size.

    Hi.
    Is it possible to limit the size of a Buffered Reader input from the keyboard to a specific number? how would one go about it?

    I would like to limit the size of the buffered reader to ensure a minimum or maxim number of input is put in. I tried using the ensureCapacity class but there seems to be a problem in calling the class. the code is below
    import java.io.*;
    import java.awt.*;
    public class getUserString {
         public static void main (String [] args) throws Exception {
              int levl, x, load;
              String s1, s2;
              String input = " ";
              StringBuffer buf = new StringBuffer();
              System.out.println ("Enter a string of at least 4 characters");
              System.out.println ("Please do not enter a character more than once");
              BufferedReader mark = new BufferedReader(new InputStreamReader(System.in));
              mark.ensureCapacity(4);
              try{
                   s1 = mark.readLine();
                   System.out.println ("These are the characters you have entered: " + s1);
              catch(IOException e) {
                    e.printStackTrace();
    }

  • Buffered reader need help

    Hello!
    I'm useless at java and am trying to complete a piece of code i just don't get!
    I'm reading in a text file and don't know how to complete the buffered reader section of it can anyone help!
    p
    the code is as follows.
    // Author:
    // Date:
    // The creation of the League class
    // saved as League.java to hold and manipulate icehockey team data
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    class League
    private static Team teams[]=new Team[6];
    League()
    String tName;
    String tNickname;
    String nPlayed;
    String nWon;
    String nLost;
    String nDrawn;
    try
    FileReader fr=new FileReader("Results.txt");
    //got the following syntax from p436
    BufferedReader br=new BufferedReader(fr);
    //confused!!!!     
    int i=0;
    while()
    // dunno if this is right!
    StringTokenizer st = new StringTokenizer(fr);
    while (st.hasMoreTokens())
    //will this work?
    tName=inputStream.sval;inputStream.nextToken();
    tNickname=inputStream.sval;inputStream.nextToken();
    nPlayed=(int)inputStream.nval;inputStream.nextToken();
    nWon=(int)inputStream.nval;inputStream.nextToken();
    nLost=(int)inputStream.nval;inputStream.nextToken();
    nDrawn=(int)inputStream.nval;inputStream.nextToken();
    //whats this bit about? new team instance to be written!
    //teams=;
    i++;
    fr.close();
    br.close();
    //catch exception thing wrote this dunno if it works or not
    catch (Exception e)
    if (e instanceof FileNotFoundException)
    system.out.println("Filename"+Results.txt+"not found")
         //     public int getSize()
                   //to be written
         //     public Team getTeam(int i)               
                   //to be written

    try somethign along these lines...
        try {
            BufferedReader in = new BufferedReader(new FileReader("infilename"));
            String str;
            while ((str = in.readLine()) != null) {
                process(str);
            in.close();
        } catch (IOException e) {
        }

  • How get output generated as csv file  by reading  by buffered reader and wr

    how get output generated as csv file by reading by buffered reader and writer

    String file_location = "C\temp\csv.txt");
    try {
         URL fileURL = getClass().getResource(file_location);
         if (fileURL != null){
              BufferedReader br = new BufferedReader(new InputStreamReader(fileURL.openStream()));
              String s = br.readLine();
              while (s != null)  {
                   if (!s.equals ("")) {
                        System.out.println(s);
                   s = br.readLine();
              br.close();
         else {
              // error
    catch (IOException ex){ex.printStackTrace();}rykk
    Message was edited by: a dummy
    rykk.

  • URGENT!! - Bug on read (readLine) method?

    Hello to all, I have need of a large aid.
    I need to know if There is the possibility that the method read() or readLine(), than I use for reading data from a socket from a PLC, has a Bug.
    This why, with the socket opened and of the data in arrival from the PLC (than does not give to errors), the method read() raises the "Connection exception reset by peer."
    The Technicians of the PLC say not to have errors but and I am surest of the correct operation of the server socket, also why it has been tested with telnet, hyperterminaly and others client without problems.
    I do not know that what to say and what to try.
    Thanks for every eventual aid.

    I don't think there is a bug with BufferedReader. But instead of using buffered reader, you can try using the socket input stream directly for reading to see if it makes any difference:
    try {
      // if the PLC is a client:
      ServerSocket serverSocket = new ServerSocket(...);
      Socket socket = serverSocket.accept();
      // or if the PLC is a server:
      Socket socket = new Socket(...);
      // and the rest of the code to test with
      InputStream in = socket.getInputStream();
      byte[] buffer = new byte[1024];
      int length;
      while ((length = in.read(buffer)) != -1) {
        System.out.println("Read "+length+" bytes");
      System.out.println("Connection closed");
    } catch (Exception e) {
      e.printStackTrace();
    }See if that little example works.
    Is the PLC i client or server? Is the PLC the first to write something to your java program or do you have to write something to it first (maybe it doesn't understand what you write to it).
    If you use reader/writer classes, there could be problems with the character encoding you use. If you don't specify any with InputStreamReader/OutputStreamWriter, then you will use the default platform encoding. I don't know which character encoding the PLC use, but if the characters are between 0 and 255, and you really want to use reader and writer classes, then use the ISO 8859-1 encoding.

  • Problems with buffered reads, buffers

    I have a few questions and issues that I have not been able to resolve with forum searches, I will try to keep them concise here.  #1 is the most important one to me.
    LabVIEW 7.1, Windows XP.
    Buffered Reads / Lost Data
    When error 10846 (AI Buffered Read, app unable to retrieve data from background acquisition buffer fast enough) occurs, I receive no data from the AI Buffered Read function for a period of time.  The error states data may be lost but it seems like I get NO data.  See the attached VI and JPG for examples.  The bottom graph shows a normal read while the top graph shows one with this problem.  I realize the AI Read error cluster is not handled in the acquisition loop.  From watching the backlog while the program runs, it seems the “dead spots” occur after the backlog reaches the buffer size.  When stopping acquisition, sometimes the error handler outside the loop reports 10846, sometimes it doesn’t (when the dead spots are occurring).  I can exaggerate dead spots with setups as follows:
      Buffer size 5, Scan rate 1000, # Scans to read 100
      Buffer size 10000, Scan rate 5500, # Scans to read 100
    The size of the dead spots and continuous data are proportional to the buffer size.
    Questions....
    1. Shouldn’t the AI Read function wait until it has # scans to read of valid data before returning?  For instance, scan rate of 100 and # scans to read of 1000 slows loop iteration speed to 0.1 Hz.  It seems like it is returning nothing for a period of time after the backlog reaches the buffer size.
    2. Error 10846 refers to the “data acquisition buffer.”  Is this the software buffer?  If so, what would LV refer to the hardware buffer as?
    3. I know the PCI-MIO-16E-1 has a hardware buffer, does this mean I can accurately acquire data over a period of time at a specified frequency (within limitations of the card of course) without having to worry about Windows bogging down due to delayed writes and such?
    4. Will hardware acquisition buffers generate an error if the data in them is lost/overwritten?
    5. I tried loading the acquisition VI (attached) onto a LV computer that has only a new USB-6008 connected but the AI read/config/clear functions were not available on that system.  Does this device not have hardware buffers (either I’m looking in the wrong places to find the answer this question and it uses different VIs OR it doesn’t have them). 
    6. The buffer/scan configuration listed above was used to exaggerate error 10846 and the accompanying dead spots but this problem has been intermittently plaguing a system I have been trying to understand/fix.  I have logged the backlog value as the program runs and see that it increases during certain processor-heavy state machine states and am hoping upgrading from 256MB to 2GB RAM will improve this.  Is there any reason I should not look at this as a solution?  (I am also planning on adding an error handler for AI Read into each acquisition loop so the problem can not continue to go on without detection!!!!!!!!!)
    7. Shouldn’t the AI Clear function report an error from the AI Read error cluster, even if it happened several reads earlier?  It seems like it does not do this; if I put the error handler in the acquisition loop I receive an error as soon as the backlog reaches the buffer size, EVERY time.  I thought I figured this out and changed the acquisition loop tunnels to shift registers... the error is reported each time this way; if AI Read will not acquire data if an error is fed into it in the first place then I guess I understand this one so I’m moving it to the bottom of the list.
    Thank you all for your time, I have been struggling to get up to speed with DAQ and LV and appreciate all the support.  I look forward to giving back to NI’s community in the future. 
    Regards,
    David.

    After all that typing I forgot the attachements, they should be on this post.
    I take it the AI.llb functions are "traditional DAQ."  I've started to experiment with the express VIs with newer hardware that I have been working with (USB-6008, USB-6211).  I will have to look at the DAQmx functions, it seems the express VIs are frowned upon by most.
    I have been working on modifying an older program that uses the traditional DAQ functions.  I will have to get more comfortable with DAQmx before attempting to change it over to them.  The attached example was wrote as I tried to understand what was going on in the program I was modifying.
    I believe the missing error handler on the AI Read function was causing unexpected (i.e. nothing returned) results the next time AI Read was called when the backlog exceeded the buffer value.  Subsequent calls to AI Read worked as expected unless the buffer overflowed again.
    Assuming this is correct the hardware buffer is the only thing I would like to understand better.  If it overflows what error (if any) will be generated in LV? 
    The other questions can be chalked up to the way traditional DAQ functions work and I think I've chased my tail enough to figure that out.
    Thanks,
    David.
    Attachments:
    acquire.jpg ‏25 KB
    acquire.vi ‏293 KB

  • How to read in a char

    Hi,
    I am new to Java..
    How do i read in a char type..
    For reading lines of input that a user types at the console..
    We do for eg, name = console.readLine()
    what wld be the equiv for doing the same for a char ?
    pls help
    thanks

    import java.io.*;
    class ReadChar {
    public static void main (String[] args) throws IOException {
    char c = (char) System.in.read(); // ...

  • Difference between Buffered Read and Read Mode on DataSocket Open

    What are the behavior differences when opening a DataSocket connection with a Buffered Read verses Read?

    Mlenz,
    You can learn about buffering data from our website, or in the LabVIEW help.  By using the Datasocket Buffered Read, you are enabling Client-side Buffering.  If you do not use a Buffered Read, then the LabVIEW does not store the values in a buffer, which are written when the value changes.
    Hope this helps,
    TheDillo

  • Trouble Implementing a Buffered Reader

    Any corrections would be very helpful. Thank you very much in advance for your kind assistance.
    public void selectRestaurant (int args[]) throws IOException{
                    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                    boolean fineDining = true;
                    int nInput;
                    while(fineDining){
                        String inputString = input.readLine();
                        try{
                            nInput = Integer.parseInt(inputString);}
                        catch(NumberFormatException exc) {
                            System.out.println("Invalid entry");
                            nInput = 0;
                        switch(nInput){
                            case 1:
                            weight = weight + 10;
                            break;
                            case 2:
                            weight = weight + 15;
                            break;
                            case 3:
                            weight = weight + 20;
                            break;
                            case 4:
                            weight = weight - 20;
                            break;
                            default:
                            System.out.println("Please select a number between 1 and 4.");
                        }Edited by: 809632 on Nov 11, 2010 4:52 PM

    I have another class called MyInput that reads info from the Buffered Reader that looks like this:
    import java.io.*;
    class MyInput
      public static String readString()
        BufferedReader keyboard
          = new BufferedReader(new InputStreamReader(System.in), 1);
        String string = " ";
        try
          string = keyboard.readLine();
        catch (IOException ex)
          System.out.println(ex);
        return string;
      public static int readInt()
        return Integer.parseInt(readString());
    }But I can't seem to get the two classes to interact with each other. And a buffered reader never actually appears. When I run the method it just looks like I'm entering a parameter. Thank you so much in advance for your help.

  • BAPI to read and change schedule lines in APO

    Hello experts,
    We want to firm schedule lines inside the firm zone of the APO procurement scheduling agreements with a daily job. For this we are trying to use BAPI BAPI_POSRVAPS_GETLIST3 and BAPI_POSRVAPS_SAVEMULTI3. The getlist one does not return schedule lines, it returns purchase orders and purchase requisitions. Are these the right bapis to read and change schedule lines in APO? or is there anyother one we can use?
    Thanks and regards,
    Ergul

    Hi,
             You can use the below code to read the schedule lines.
    Checking a session exists
        CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
          IMPORTING
            ev_simsession = gv_sims
            es_gen_params = gv_params.
    If not create a new session and read it
        IF gv_sims IS INITIAL.
          CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_CREATE'
            IMPORTING
              ev_simsession = gv_sims.
          CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
            IMPORTING
              ev_simsession = gv_sims
              es_gen_params = gv_params.
          g_cre_chk = 'X'.
        ENDIF.
    CALL FUNCTION '/SAPAPO/CMDS_TPSRC_GET'
        EXPORTING
          iv_ebeln                       = p_l_t_acknh_ebeln
          iv_ebelp                       = p_l_t_acknh_ebelp
        TABLES
          et_tpsrc_all                   = lt_tpsrc
        EXCEPTIONS
          matid_not_found                = 1
          locfrom_not_found              = 2
          locto_not_found                = 3
          scheduling_agreement_not_found = 4
          error_selecting_schedagreement = 5
          OTHERS                         = 6.
      IF sy-subrc = 0.
    reading the scheduling agreement records
        READ TABLE lt_tpsrc INTO ls_tpsrc INDEX 1.
        CALL FUNCTION '/SAPAPO/PWB_BZQID_GET_ORDER'
          EXPORTING
            iv_simid               = '000'
            iv_bzqid               = ls_tpsrc-bzqid
          IMPORTING
            ev_ordid               = lv_iordid
          EXCEPTIONS
            lc_connect_failed      = 1
            no_elements            = 2
            unit_conversion_failed = 3
            OTHERS                 = 4.
        IF sy-subrc = 0.
          CALL FUNCTION '/SAPAPO/PWB_GET_RELATED_ORDERS'
            EXPORTING
              iv_ordid             = lv_iordid
              iv_order_type     = '16'
              iv_simid            = '000'
            IMPORTING
              ev_ordid          = lv_eordid
            EXCEPTIONS
              order_not_found   = 1
              lc_connect_failed = 2
              no_elements       = 3
              OTHERS            = 4.
          IF sy-subrc = 0.
            APPEND lv_eordid TO lt_ordid.
            CALL FUNCTION '/SAPAPO/DM_PO_READ'
              EXPORTING
                iv_simsession     = gv_sims
                is_gen_params     = gv_params
                it_ordid          = lt_ordid
              IMPORTING
                et_schedule       = p_lt_sched
              EXCEPTIONS
                lc_connect_failed = 1
                lc_com_error      = 2
                lc_appl_error     = 3
                OTHERS            = 4.
          ENDIF.
        ENDIF.
      ENDIF.
    Use '/SAPAPO/CMDS_SNP_MM_ORD_MODIFY' function module to change the schedule lines (Pass '16' to iv_order_type parameter).
    Let me know if u have any issues.
    Regards,
    Siva.

Maybe you are looking for

  • Wow, why does Creative Cloud suck so bad?   Why are there no FAQs in the Creative Cloud FAQ?

    I am new to Creative Cloud.   I found some PSD event poster templates on line and I would like to be able to download some of these templates to create event posters.   I have modest goals.   1) I found a link on the Adobe site for $9.99 monthly fee

  • Content conversion in File to Proxy in PI 7.1 V

    Hi Experts I am working on a File (Text file) to Proxy scenario in PI 7.1 Version where I receive the text file from the sender and need to convert into xml by using the Content conversion The text file which I receive have multiple Record Structures

  • Is this possible to panel using CS4 like CS5

    Hi gurus. I have used Photoshop CS4. I have created both CS4 & CS5 Extensions Panel using from Adobe Confirator I & II . In Photoshop CS5 Extensions Panel HTML widget shows Image & Text in HTML window. Hence In Photoshop CS4 Extensions Panel HTML wid

  • Unable to uninstall adobe reader 8.16 on windows xp

    I wanted to uninstal adobe reader 8 after finding I could use adobe reader 9, I uninstalled adobe reader and ended up having to restore my system after a server problem with the new software putting adobe 8 back. I tried to uninstall it again after s

  • Environment settings

    Hi,  it seem that when I open a specific project, the previous state is not saved. Not the tabs, bootmarks and other stuff is back as it was used for the first time. It only happens with one project, not the others. Is there something wrong? Thanks,