Output while reading input in console

im making a little console chat program, and i need to be able to send/receive, but, whenever a user is typing something in, nothing can get outputted. is there a way to do both at one time?

u can go for two threads..one thread which reads the input from the console and write to the socket and another thread which reads from the socket and write to the console..
i can give a simple implementation which is easy to understand and implement..mail me at [email protected]
all the best
sandeep

Similar Messages

  • ProtocolException: Cannot write output after reading input

    If I use the following code
    this.conn is a database connection while urlConn is a HTTPUrlConnection
    if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
                   {     this.conn.commit(); }
                   else
                        System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
                        throw new MppException(urlConn.getResponseMessage());
                   byteStream.writeTo(urlConn.getOutputStream());I get the following exception
    ProtocolException: Cannot write output after reading input
    if However I change the order and instead use
    byteStream.writeTo(urlConn.getOutputStream());
    if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
                   {     this.conn.commit(); }
                   else
                        System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
                        throw new MppException(urlConn.getResponseMessage());
                   It works fine but in that case there might be a deadloack on the server side since both the client and server in that case try to modify tables on the same db.
    any work arounds???????

    HTTP is a request / Responce based protocole where all the data to be send to the server must be included in the request and then the server send all the data as the responce.
    By the time you read the responce the request is already send and the server have finished processing it. So it is not posible to send more data to the same request.

  • Read Input from console !!!

    Im am very new to java and trying to learn java ..
    Now the problem i have is, I have to read input from console without using the BufferReader method..
    Please tell me how to go about it..
    I have a assignment to complete and im not able to figure out the way out.
    Help ..

    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html
    Read first about the System class provided by Java.
    Select the 'in' method of System class and it will take
    you to the InputStream.
    http://java.sun.com/j2se/1.4.1/docs/api/java/io/InputStream.html
    An essay way of reading input is:
    "value?"=System.in.read();
    Try and see if this works. It will not use the
    BufferReader portion, but it gives you another way
    of reading from the console.

  • How to detect line break while reading input ?

    Hi all,
    I am reading the user input from standard input.
    I want to detect the line break. So that I can stop reading input and proceed processing the string.
    Actually I am getting the SQL query as input and after that I am executing the same by passing it to a function.
    Pl. do reply me.
       Scanner scanner = new Scanner(System.in);             
            while(scanner.hasNext())
                 temp=scanner.next();
                  sql=sql.concat(" "+temp);
                 if(scanner.next=="\n")
                            break;
           System.out.println(sql);
           sqlTool.executeSQL(sql);
    The above is not working properly.

    But if new line comes, what will be it's value?Empty lines are discarded by the scanner.
    Kaj

  • Reading inputs in console from user

    I wanted to know if its possible to capture inputs from user in console apps. Can you just do "System.in.read(variablename);" ????

    If you're just starting, I recommend that you learn to use the Scanner class methods. The class documentation has examples. It will read from the console, as well as any other source that exists, and allows much more flexibility. (The class is new whit Java 5.)

  • Error while executing SSIS package - Error: 4014, Severity:20, State: 11. A fatal error occurred while reading the input stream from the network. The session will be terminated (input error: 109, output error: 0)

    Hi,
    We are getting the following error when running our SSIS packages on Microsoft SQL Server 2012 R2 on Windows Server 2008 R2 SP1:
    Error: 4014, Severity:20, State: 11.   A fatal error occurred while reading the input stream from the network. The session will be terminated (input error: 109, output error: 0)
    SQL Server Data Tools and SQL Server Database Engine reside on the same server.
    We tried the following:
    Disabling TCP Chimney Offload
    Installed Windows Server 2008 SP1
    Splitting our SSIS code into multiple steps so it is not all one large continuous operation
    The error occurs during a BulkDataLoad task.
    Other options we are investigating with the engineering team (out-sourced, so delayed responses):
    Firewall configurations (everything is local, so this should not make a difference)
    Disabling the anti-virus scanner
    Are there other things we can try?
    Any insight is greatly appreciated.
    Thanks!

    Hi HenryKwan,
    Based on the current information, the issue can be caused by many reasons. Please refer to the following tips:
    Install the latest hotfix based on your SQL Server version. Ps: there is no SQL Server 2012 R2 version.
    Change the MaxConcurrentExecutables property from -1 to another one based on the MAXDOP. For example, 8.
    Set "RetainSameConnection" Property to FALSE on the all the connection managers.
    Reference:
    https://connect.microsoft.com/SQLServer/feedback/details/774370/ssis-packages-abort-with-unexpected-termination-message
    If the issue is still existed, as Jakub suggested, please provide us more information about this issue.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Keyboard input or Console Output

    I'm self teaching java... I got stuck with one of the exercises that is supposed to demonstrate the basic input and output through entering data on console...
    I went about writing the code as:
    public class Program2 {
    public static void main(final String [ ] args) {
    KeyboardInput in = new KeyboardInput () ;
    System.out.print ("Type your name: ") ;
    It doesn't compile:((((.... it says "KeyboardInput" is not a type...
    I would really appreciate if somebody could respond to this silly problem.

    For keyboard input from console the program would be
    public class Console{
      public static void main(String[] args){
        try{
          BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
          System.out.print("Enter Your Name: ");
          String name = reader.readLine();
          System.out.println("Your Name is "+name);
        }catch(Exception ex){
          ex.printStackTrace();
    }

  • Error 4014 Severity 16 State A fatal error occurred while reading the input streamfrom the network

    We encounter following error intermittently Error 4014 Severity 20 State 16 , A fatal error occurred while reading the input stream from the network
    I have checked the RING_BUFFER_CONNECTIVITY from sys.dm_os_ring_buffers, we are able to find the remote_host IP where connections are being closed/killed, the error being logged in sys.dm_os_ring_buffers, comes from multiple remote_host, we have raised
    to O/s and Networking Team they seem to have no clue, why this error occurs
    Server: Virtual Machine
    Operating System: WINDOW 2008 R2 SP1
    MSSQL 2008 STD ED SP3 10.0.5850.0
    Database mirroring is configured for the application database.
    Antivirus enable on the database server
    How do we find the cause for this error being logged in SQL server logs, is this error due to SQL database mirroring or memory issue?
    What needs to be checked on the O/s and Network, I have been checking on the internet and everywhere it is pointing to NIC drivers or security patches
    Also in the system events following error was being logged, but after restarting the vm service this error has not re-occurred
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the VMTools service
    Kindly suggest on Error 4014 Severity 20 State 16, A fatal error how to resolve
    [email protected]

    Hello,
    Could you try to use Network Monitor or WireShark to examine if the connections resets are coming from a client computer
    or from the host where SQL Server is installed?
    Network Monitor can be downloaded from the following link:
    http://www.microsoft.com/en-us/download/details.aspx?id=4865
    If you use Network Monitor trace you will identify connection resets by looking for “TCP: Flags=,,R.A” at the description column on the Frame Summary. Once you find the flag, the Source column will tell you the identity of the host resetting the connection,
    maybe is not the SQL Server host.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to read char from console

    Hi can any body help me..
    I want to read char from keybord. withought pressing ENTER.
    I am not sure how i can do it. I can't use
    BufferedReader br = new  BufferedReader(new InputStreamReader ( System.in )) ;
    char key ;
    key = (char )br.read() ;
    cuz i have to press ENTER every time to read char.
    Thanks in advance.

    try this,I' have found a part on Internet
    package exercises;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    * questa � la classe d' esempio per leggere l'input dalla console*/
    public class Echo {
    public static void main(String args[]) throws Exception{
    // This is where the magic happens. We have a plain old InputStream
    // and we want to read lines of text from the console.
    // To read lines of text we need a BufferedReader but the BufferedReader
    // only takes Readers as parameters.
    // InputStreamReader adapts the API of Streams to the API of Readers;
    // receives a Stream and creates a Reader, perfect for our purposes.
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String input = "";
    while(true){
    System.out.print("ECHO< ");
    //As easy as that. Just readline, and receive a string with
    //the LF/CR stripped away.
    input = in.readLine();
    //Is a faster alternative to: if (input == null || input.equals(""))
    //The implementation of equals method inside String checks for
    // nulls before making any reference to the object.
    // Also the operator instance of returns false if the left-hand operand is null
    if ("".equals(input)){
    break;
    }else
    // Here you place your command pattern code.
    if ("ok".equals(input)){
    System.out.println("OK command received: do something �");
    //Output in uppercase
    System.out.println("ECHO> " + input.toUpperCase());
    System.out.println("ECHO> bye bye");
    //We exit without closing the Reader, since is standard input,
    // you shouldn't try to do it.
    // For all other streams remember to close before exit.
    }

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Problem reading input stream of urlconnection within portal

    Hi,
    This may be a generic server issue rather than portal but since it's my portal app that's displaying the problem I'll post it here.
    Part of my Portal attempts to POST to a remote server to retrieve some search results.
    In environments A & B (both standalone instances) this works fine.
    In environment C this works on the managed instances in the cluster but not the admin instance.
    In environment D (again standalone) it fails, but if I add a managed instance it works from the managed instance.
    The problem I'm seeing is that I get a stuck thread and the thread dump shows it is blocked attempting to read the resulting input from a urlconnection. (Using a buffered input stream).
    I've copied the code to a standalone class that runs fine from the same server(s). I've pasted this code below, the contents of the test() method were copied directly from my webapp (urls changed here for clarity).
    Does anyone know of any securitymanager issues that may cause this?
    Or anything else for that matter?
    Code sample:
    package src.samples;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    public class POSTTest {
         public static boolean test()
         URL url = null;
         try {
         url = new URL
    ("http://hostx:80/myapp/search.html");
         catch (MalformedURLException e)
         e.printStackTrace();
         return false;
         URLConnection urlConn;
         DataOutputStream printout;
         BufferedReader input;
         urlConn = null;
         try {
         urlConn = url.openConnection();
         catch (IOException e)
         e.printStackTrace();
         return false;
         // Let the run-time system (RTS) know that we want input.
         urlConn.setDoInput (true);
         // Let the RTS know that we want to do output.
         urlConn.setDoOutput (true);
         // No caching, we want the real thing.
         urlConn.setUseCaches (false);
         // Specify the content type.
         urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
         // Send POST output (this is a POST because we write then read as per the JDK Javadoc)
         printout = null;
         String body = "";
         try {
         System.out.println("url=" + url.toString());
         printout = new DataOutputStream (urlConn.getOutputStream ());
         String content = "param1=A&param2=B&param3=C&param4=D&param5=E";
         System.out.println("urlParams= " + content);
         printout.writeBytes (content);
         System.out.println("written parameters");
         printout.flush ();
         System.out.println("flushed parameters");
         printout.close ();
         System.out.println("closed parameter stream");
         // <b>Get response data - this is where it blocks indefinitely</b>
         input = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
         System.out.println("got input");
         String str;
         while (null != ((str = input.readLine()))) {
         body = body + str + "\n";
         System.out.println("read input:");
         System.out.println(body);
         input.close ();
         System.out.println("closed input stream");
         catch (IOException e) {
         System.out.println("IOException caught: read failed");
         e.printStackTrace();
         return false;
         return true;
         * @param args
         public static void main(String[] args) {
              System.out.println("Test result= " + test());

    In your recuperar() method, read the FTP input stream into a byte array. (You can do that by copying it to a ByteArrayOutputStream and then getting the byte array from that object.) Then, return a ByteArrayInputStream based on those bytes. After you call completePendingCommand(), of course.
    That's one way.
    PC&#178;

  • Filtering of data while reading with "RSDRI_INFOPROV_READ" from infocube.

    Hi all,
    I am working with a function module "rsdri_infoprov_read" to read data from multi provider. Here i am facing a problem with the parameter 'i_t_range' - select options, I have filled elements of this parameter, but regardless of my selection it brings some more data from cube. It would be so helpful for me if somebody can can have a look at it. The value apppending to i_t_range is as shown below,
    plant is the selectio screen input.
    LOOP AT s_plant.
          g_s_range-chanm    = 'GCSLOCT'.
          g_s_range-sign      = 'I'.
          g_s_range-compop    = 'EQ'.
          g_s_range-low      = s_plant-low.
          APPEND g_s_range TO g_t_range.
        ENDLOOP.
    material  is the selectio screen input for which product.
    LOOP AT i_t_materials.
          g_s_range-chanm    = 'GCSMATE'.
          g_s_range-sign      = 'I'.
          g_s_range-compop    = 'EQ'.
          g_s_range-low      = i_t_materials-sub_type.
          APPEND g_s_range TO g_t_range.
        ENDLOOP.
    version is the planning book version constant.
          g_s_range-chanm    = 'GCSPLVER'.
          g_s_range-sign      = 'I'.
          g_s_range-compop    = 'EQ'.
          g_s_range-low      = version.
          APPEND g_s_range TO g_t_range.
        ENDLOOP.
    week  is the selectio screen input for period.
      g_s_range-chanm    = '0CALWEEK'.
      g_s_range-sign      = 'I'.
      g_s_range-compop    = 'BT'.
      g_s_range-low      = s_period-low.
      g_s_range-high      = s_period-high.
      APPEND g_s_range TO g_t_range.
    It should fetch data for the plant which i given in s_plant-low(select option) only but it returns other plants too in the output internal table e_t_data.So it effects the perfomance and here i need to fliter the other plants while reading itself.
    This is for plant, but coming to other inputs like material,version and period into the i_t_range table and for which it returns the corrct values only.The problem's with the plant input selection only.
    I hpe you guys can easilyhelp me with this,,
    thanks in advance for all.
    Regards
    ashir ck

    Just as double check, 
    Put in a breakpoint after it gets out of the Loop at S_plant and check what is in table g_t_range.   Maybe something there is a value in there that you are not expecting.
    plant is the selectio screen input.
    LOOP AT s_plant.
    g_s_range-chanm = 'GCSLOCT'.
    g_s_range-sign = 'I'.
    g_s_range-compop = 'EQ'.
    g_s_range-low = s_plant-low.
    APPEND g_s_range TO g_t_range.
    ENDLOOP.
    PUT A BREAKPOINT HERE

  • Problem while reading double data?

    run the program
    then get the output, show below
    have an additional data
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class SimpleInputStream
         private StringTokenizer tk;
         public SimpleInputStream(String fileName) throws IOException
              String content = readFile(fileName);
              tk = new StringTokenizer(content);
         public SimpleInputStream(String fileName, String delim) throws IOException
              String content = readFile(fileName);
              tk = new StringTokenizer(content, delim);
         public static String readFile(String fileName) throws IOException
              BufferedReader reader = new BufferedReader(new FileReader(fileName));
              StringBuffer buffer = new StringBuffer();
              char temp[] = new char[20];
              while ( reader.read(temp) != -1)
                   buffer.append(temp);
              if (reader != null)
                   reader.close();
              return buffer.toString();
         public int readInt() throws NullContentException
              if (!tk.hasMoreTokens())
                   throw new NullContentException("not more element in content");
              return Integer.parseInt(tk.nextToken());                    
         public float readFloat() throws NullContentException
              if (!tk.hasMoreTokens())
                   throw new NullContentException("not more element in content");
              return Float.parseFloat(tk.nextToken());
         //test if any data can be used
         public boolean hasMore()
              return tk != null && tk.hasMoreTokens();
         public double readDouble() throws NullContentException
              if (!tk.hasMoreTokens())
                   throw new NullContentException("not more element in content");
              return Double.parseDouble(tk.nextToken());
         public void close()
              tk = null;
         public static void main(String[] args)
              try {
                   SimpleInputStream input = new SimpleInputStream("resources/c17.txt");
                   while (input.hasMore())
                        System.out.println(input.readDouble());
              } catch (Exception e) {
                   e.printStackTrace();
    class NullContentException extends Exception
         public NullContentException()
              super();
         public NullContentException(String msg)
              super(msg);
    }file "resources/c17.txt"
    17 11 9 20
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    2.24
    2.24
    2.24
    2.24
    2.24
    2.24
    4.64
    4.64
    4.64
    the output:
    17.0
    11.0
    9.0
    20.0
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    1.12
    2.24
    2.24
    2.24
    2.24
    2.24
    2.24
    4.64
    4.64
    4.6424 // here the additional data why???
    4.64

    i alway this class to read int data but when i first try to use it to read double data , it is failed, it always generate many other data

  • Scanning a line for a pattern ( cat ${0} | while read line )

    I am busy to create a dynamicaly menu from items inside the script itself.
    I will create some self reading/scanning code what builds the menu.
    When script get executed, it will look for itself on disk put it in a catalog and scan every line with an 'if' 'elfi' for '[ $choice -eq X ]; then'.
    Then next non empty line for '# title - description of code' part behind that if or elfi line, put that and the choice no. in $menuItemN var what is used to print the menu.
    with
    # start self scanning code
    cat ${0} | while read line
    # end self scanning code
    # create menu
    # the the chosen code between if's
    if [ $choice -eq 1 ] ; then
    # title - Drink coffee
    elfi [ $choice -eq 2 ] ; then
    # title - Eat pizza
    This line of code
    if [[ "$line" = ?(el)if*([[:space:]])*$choice*([[:space:]])-eq* ]] ; then
    reads the if's and elfi's fine, but also f.e the line itself.
    So I want to narrow down things, but I cant figure out how to use [ in a pattern.
    What do I have to put at the XXXXX
    if [[ "$line" = ?(el)if*([[:space:]])XXXX*$choice*([[:space:]])-eq* ]] ; then
    so that that line is only accepting ( one left square bracket and different number of spaces )
    if [ $choice -eq 1 ] ; then
    or
    elif [ $choice -eq 4 ] ; then
    Basically how do I use the left and right bracket in a pattern?

    After a good diner, but not helping with the dishes , this is for now my final.
    I did create it in a way that I only need to add code in the runLoop function. I don't need to alter var's, code or any thing else outside the runLoop. And it works fine.
    #!/bin/sh
    shopt -s extglob ## enable extended globs +(...), *(...), etc...
    declare -a menuArray
    handle_menu()
    ## print menu
    printf "_____________________________________________________________
    for index in {0..99}
    do
    if [[ -n "${menuArray[$index]}" ]]; then
    if [[ "$index" == "$exitChoice" ]]; then
    printf "
    fi
    printf " %3s. %s
    " "$index" "${menuArray[$index]}"
    fi
    done
    printf "_____________________________________________________________
    ## read user input
    read -p " Please choose an option :" choice
    ## user want to quit?
    if [[ $choice -eq $exitChoice ]] ; then
    printf " Bye bye!
    exit 0
    fi
    ## user did choose a wrong number?
    if [[ ! -n "${menuArray[$choice]}" ]]; then
    printf "
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    printf " # # # %s is Not an existing option!
    " "$choice"
    printf " # #
    printf " # # Try again ( %s for exit )
    " "${exitChoice}"
    printf " #
    printf " # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    fi
    build_menu()
    ## Build a menu by reading this script
    exitChoice=99 ## exit option number
    exitStr="Exit" ## exit menu text
    loopChoice=999 ## keeps the runloop rolling
    lineno=0
    while read line
    do
    ((lineno++))
    #echo - $line
    if [[ $line = ?(el)if+([[:space:]])[[+([[:space:]])$choice+([[:space:]])-eq+([[:space:]])?([1-9][0-9 ])*([[:space:]])]]+([[:space:]]);+([[:space:]])then* ]] ; then
    ## line should look like 'if [[ $choice -eq 1 ]] ; then' or 'elif [[ $choice -eq 2 ]] ; then # help'
    ## Between the different elements there has to be 1 or more spaces
    ## There could be a comment behind the statement
    #echo -
    #echo - "before :${line}--"
    line="${line%*([[:space:]])#*}" ## remove comments
    line="${line%%+([[:space:]])}" ## remove trailing spaces
    read title_line
    ((lineno++))
    #echo - "before N:${nline}--"
    title_line="${title_line%%+([[:space:]])}" ## remove trailing spaces
    if [[ "$title_line" = #*([[:space:]])[Tt]itle*([[:space:]])-*([[:space:]])+([[:alnum:]])* ]]; then
    ## line should look like '# Tilte - Description'
    ## Between the different element there has to be 1 or more spaces
    ## The 'T' of 'Title' text must be an upper or lowercase letter
    ## get choice number from line
    line="${line#?(el)if+([[:space:]])[[+([[:space:]])$choice+([[:space:]])-eq+([[:space:]])}"
    #echo - "Tear off beginning:${line}--"
    choiceNo="${line%%+([[:space:]])*}"
    #echo - "Tear off end :${choiceNo}--"
    ## compare if choice number already exists and if exists: Bail out wit error notification
    if [[ "${menuArray[$choiceNo]}" == "" ]]; then
    ## get title
    title_line="${title_line##*([[:space:]])[Tt]itle*([[:space:]])-+([[:space:]])}"
    #echo - "Tear off beginning:${title_line}--"
    title_line="${title_line%%+([[:space:]])}"
    #echo - "Tear off end :${title_line}--"
    ## add to menu
    menuArray[$choiceNo]="${title_line}"
    else
    errLine=$((lineno-1))
    printf "
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    printf " ## # Choice number already exists under name%s
    " "${menuArray[choiceNo]} "
    printf " ## #
    printf " ## # Correct your code ( choice number? ) at line %s
    " "${errLine}"
    printf " # Wil bail out!
    printf " ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    exit 1
    fi
    else ## no title in line
    errLine=$lineno
    printf "
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    printf " ## # Line after 'if' or 'elif' statement has no Title line
    printf " ## #
    printf " ## # Correct your code af line %s
    " "${errLine}"
    printf " # Wil bail out!
    printf " ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    exit 1
    fi ## if Title is there
    fi
    done <${0}
    ## add the exit code and title at the end of the menu array
    menuArray[$exitChoice]=${exitStr}
    start()
    build_menu
    choice=$loopChoice
    # Loop while the variable choice is equal 999 ( defaultChoice )
    while [ $choice -eq ${loopChoice} ]; do
    # print menu + read user input
    handle_menu
    runLoop
    choice=$loopChoice # only bail out on exit code ( at least default value 90 )
    done
    runLoop()
    ## this function should contain the choices with their code.
    ## the choice if statement should look like the following way
    ## 'if [[ $choice -eq 1 ]] ; then'
    ## or/and
    ## 'elif [[ $choice -eq 2 ]] ; then # help'
    ## YES, it should use $choice as a variable!!
    ## With in the next line the title, supplied in the following pattern
    ## '# title - Eat pizza'
    ## No need to put extra code in your code to have this running
    ## -------- insert your code here --------------------------------------------
    if [[ $choice -eq 1 ]] ; then
    # title - Drink coffee
    echo Drink beer
    elif [[ $choice -eq 2 ]] ; then # help
    # title - Eat pizza
    echo Eat pizza
    elif [[ $choice -eq 4 ]] ; then
    # title - Go Home
    echo "Go Home!"
    elif [[ $choice -eq 9 ]] ; then
    # title - Get out
    echo "Get out!"
    elif [[ $choice -eq 44 ]] ; then # ln;ln lknbl bs
    # title - Go to bed
    echo "44 Go sleep!"
    ## -------- insert your code in front of this line ----------------------------
    fi ## keep this as last
    # Start point
    start
    exit 0
    Still one question.
    Is there a kind of way to walk through an array and get directly the existing variables with a index number?
    Now I use
    for index in {0..99}
    do
    if [[ -n "${menuArray[$index]}" ]]; then
    if [[ "$index" == "$exitChoice" ]]; then
    printf "
    fi
    printf " %3s. %s
    " "$index" "${menuArray[$index]}"
    fi
    done
    I don't want a loop ( {0..99} ) and a known last index number ( 99 )
    Is there a way to find out the width om the current shell window?
    Also other hints, remarks are welcome.
    P.s if someone want to see the 'debug echo output', find&replace '#echo -' with 'echo -' and the other way arround

  • Error while reading the PO in the Backend system. Inform system admin

    Hi All,
    We are having a peculiar issue of 'Error while reading the PO in the Backend system. Inform system admin'.
    The P.O is in ordered status in SRM but the same is not getting transferred to backend ECC system.
    No error messages or logs in RZ20, SLG1 any where.
    All programmes like BBP_GET_STATUS_2 and CLEAN_REQREQ_UP are running fine.
    Tried pushing the P.Os manually using function module (BBP_PD_PO_TRANSFER_EXEC_V2) to backend ECC.
    It was working fine till a week ago and suddenly this problem is coming.
    We had implemented few OSS notes suggested by SAP for the issue of 'shopping carts appearing in sourcing cockpit even after P.O creation' in both development and test system.
    Now this issue is coming up in test system where as development system is working fine.
    Please let us know where to look and how to resolve this issue.
    A quick response would be highly appreciated.
    Regards,
    Teja

    I am facing the same issue with one PO in the Production system.
    SRM 5.0 , R/3 4.6C Extended classic scenario.
    I checked the status of other PO's created today. I see them in R/3. There is one PO which was created a week back which shows up as "ordered" in SRM but the PO is missing in R/3. When clicked on the details on the web, system throws the error
    Error while reading the PO in the Backend system. Inform system admin.
    Message no. BBP_CF010
    I checked RZ20, SLG1 no errors were found. I checked RFC connection, it was working fine too.
    I tried pushing the PO using the FM BBP_PD_PO_TRANSFER_EXEC, it did not solve the problem.
    In SRM WEBGUI Process PO - Item data -->follow on documents --> PO status is shown as Archived.
    Any inputs would be greatly appreciated. Please throw some light on this issue.
    Krishna

Maybe you are looking for