How to add Freely programmed input help in FPM Search UIBB?

Hi Experts!
We have a requirement to create search UIBB in which the input field should have a freely programmed input help.
I see that WD_VALUE_HELP parameter can be set to the component name and it displays the freely programmed help as well in the application.
However, I am still digging to implement the search help open and close events of the component.
I have used the Freely programed value help standard demo object  " FREE_VALUE_HELP "  which shows the value in the help popup however, the selected value is not returned in the input field.
I am also unable to find any Interface as provided for implementing OVS in search UIBB as well...
Please help.

Hi Aliaksandr,
Thanks for your response.
I have checked this WDA application demo_value_help .... but it is a normal WDA application.
However, I want use freely programmed search help in Search UIBB using FPM.
I found that we can provide the component name used as freely programmed search help in the attribute WD_VALUE_HELP of Interface IF_FPM_GUIBB_SEARCH.
https://help.sap.com/saphelp_nw74/helpdata/en/03/f2474b6d9a49f4b5a3ed6f04decf22/content.htm?frameset=/en/56/d151c3ba7b4b2e82068a084cb991f3/frameset.htm
And it displays the search help as well when I do F4 on the field of Search UIBB. But, we need to provide event handler for events - VH_WINDOW_CLOSED and VH_WINDOW_OPENED of the search help component (Component which is provided in WD_VALUE_HELP) some where in the Feeder class, in order to get the selecteed data from the search help, which I am unable to do.
Do you have any idea of such implementation?
Appreciate your response!

Similar Messages

  • Help required on Freely Programmed Input help

    Dear all,
    I have developed a component, say comp1, in which i have implemented the interface IWD_VALUE_HELP.
    In the respective view(MAIN) of Comp1 i have a dropdown which contains a list of company codes fetched from T001 table.
    Apart from these two, I have also embedded the Main view into the window WD_VALUE_HELP.
    Now, I have created another component, say Comp2, in which i Used the dynpro component Comp1, and also in the MAIN view of my Comp2. Now in the MAIN view of Comp2 I have created a input field from the node T001 in the context which contains the single attribute BUKRS type String. In the properties of the BUKRS attribute I have also changed the Input help to "Freely Programmed" and linked to the component for the Input help.
    After this, I have created the application for my component Comp2. When i run the application and when i press F4 on the input field i am able to get the window from Comp1 component, and a dropdown with values.
    Now the question is, How can i pass the value selected in that window of Comp1 into the input field of Comp2? we do the same in OVS, when ever a value is selected from the Hitlist, it will be cascaded into the input field, just like that i want to do here.
    Please suggest me how to do this, and also please tell when to go for Freely programmed Input help and its advantages.
    Thank you,
    Shashi.

    You can do as suggested already and use interface nodes and cross component mapping; but that is all really not necessary.  It creates a situation where you calling application is too dependent upon the freely programmed input help.  You want to try to avoid the situation where the calling application needs code or mappings to communicate with the input help.
    That is easy to do because the framework passes all the information you need into the freely programmed input help via the value_help_listener object. 
    Part of the Freeley Programmed Input Help Component should be the component interface IWD_VALUE_HELP.  This comes with a component controller method called SET_VALUE_HELP_LISTENER.  This allows your freely programmed value help to capture this object called listener of type IF_WD_VALUE_HELP_LISTENER. I generally just store it awa into a component controller attribute.
    With this listerner object you have direct access to the context attribute in the calling component. You can query information about the calling UI element and of course set values directly back into it.  The listener is a hugely helpful object and should be the way you interact with the calling component whenever possible.  Here is small example:
      set single attribute
      wd_this->value_help_listener->f4_context_element->set_attribute(
      exporting
        name = wd_this->value_help_listener->f4_attribute_info-name
        value = l_time

  • Freely Programmed Input help

    Hi all,
    I want to use Freely Programmed Input help.any ideas how to use this type of input help.Also suggess about its properties in context.
    Points will be sured.
    Sanket sethi

    Hi,
    see the <a href="http://help.sap.com/saphelp_nw70/helpdata/en/5d/395e4254139041e10000000a1550b0/frameset.htm">documentation</a>
    Regards, Heidi

  • Freely programed input help

    hi all,
    can any buddy tell me how can i use freely programed input help..
    please give steps to create and use it.
    points will be awarded
    thanks
    ashish

    Hi,
    see the <a href="http://help.sap.com/saphelp_nw70/helpdata/en/5d/395e4254139041e10000000a1550b0/frameset.htm">documentation</a>
    Regards, Heidi

  • POWL: Freely Programmed Input help for Selection Criteria possible

    Hi,
    is it possible to add a freely programmed value help to a POWL-selection field? In this case the use of OVS is unsufficient from the user perspective.
    Can anybody guide me?
    Thanks, Elke.

    I dont intend to create another search help component for my 2nd input field because if let say i have 20 input fields that requires search help, does that means I need to create 20 search help components and embed 20 of them into my parent component?
    NO need of creating 20 more search helps if you have these 20 attributes in the result table of the value help.
    just check in the help from where the help is getting called and then pass the value accordingly.
    here is a sample code where i am checking whether the search help is called from ID field or Location field and then passing
    the required info back.
    lo_listener = wd_comp_controller->value_help_listener.
    lv_attrib_name = lo_listener->f4_attribute_info-name.
    IF lv_attrib_name EQ 'ID'.
    lo_listener->f4_context_element->set_attribute( value = lv_id
    name = lv_attrib_name ).
    ENDIF.
    IF lv_attrib_name EQ 'LOCATION'.
    lo_listener->f4_context_element->set_attribute( value = LOC
    name = lv_attrib_name ).
    ENDIF.
    wd_comp_controller->fire_vh_data_selected_evt( ).
    thanks
    sarbjeet singh

  • How to created Freely Programmed F4 help in Select Options

    hi,all
       I have a probelm about how to created a Freely Programmed F4 help in Select Options,and put help value into select options field
      Thanks and Best Regards

    Hi Haung,
    You need to use FREE_HELP not the component name.
    Modify you code as below:
       LT_RANGE_TABLE_V = wd_this->m_handler_V->create_range_table( 'ZCYPHDATE' ).
      wd_this->M_HANDLER_V->add_selection_field(
          i_id                         = 'ZCYPHDATE'
          it_result                    = LT_RANGE_TABLE_V
          i_value_help_type            = if_wd_value_help_handler=>CO_PREFIX_APPLDEV
          i_value_help_id              = 'FREE_HELP'
          i_no_intervals               = abap_false ).
    Hope this helps you.
    Regards,
    Rama

  • Integrate Freely Programmed Value Help in Select option WDR_SELECT_OPTION

    Hello All,
    I have created Freely Programmed Value Help name (ZVALUE_HELP) by using IWD_VALUE_HELP.I have develop an application(ZSELECT_OPTION) which uses the resubale component WDR_SELECT_OPTION for select option.i want search help for one of my select option input field .
    i wrote the following code.
    *initalise the used component
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_ci_serach_help( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      lo_cmp_usage->create_component( ).
    endif.
    * add a new field to the selection
      WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(
      I_ID = 'ZCI_STATUS'
      IT_RESULT = LT_RANGE_TABLE
      I_READ_ONLY = READ_ONLY
      I_OBLIGATORY = ABAP_FALSE
      I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_APPLDEV
      I_VALUE_HELP_ID   = 'ZVALUE_HELP'
    when i execute the select option application n click on search help button i got error "Component usage ZVALUE_HELP does not exist.
    Edited by: Abhilasha Dahare on Aug 3, 2011 11:10 AM

    hi Abhsilasha,
    I think your code is some thing wrong.
    you have to assign free value help like below method.
    in the attribute( the select option field ) properties, you will find input help mode property, in that select 'freely  programmed'.
    then you willl get some more fields, there you have to provide ZVALUE_HELP
    of follow reema suggestion in below link
    How to integrate a Search Help in a dynamically created Select-Option?
    Regards
    Srinivas
    Edited by: sanasrinivas on Aug 3, 2011 12:06 PM
    Edited by: sanasrinivas on Aug 3, 2011 12:10 PM

  • Freely-programmed value help for a single ALV cell

    Greetings everyone,
    I have a freely-programmed value help that works beautifully when attached to the context element of a single field, but now I'm needing to use it in an ALV for a specific cell.  Is there a way to shut off the dropdown for all of the rows (cells) in the column where I don't need it?  Or, is there an appropriate workaround that can deliver the same results?
    I've found several posts that address similar issues, but nothing for this exact problem.
    Thanks,
    Jason Block

    I take it from reading your description what you want is a little more complicated than just controlling the read-only property on the input field. If I read you properly you still want to have all the cells in a column to be open for input, just on some of them you want to disable the value help.  Is that correct?  See these screen shots for clarification:
    If you focus on the the input field in the first row, you get the value help:
    http://www.flickr.com/photos/tjung/2714133068/
    However if you go to the second row and focus on the same input field in this column, you don't get the value help:
    http://www.flickr.com/photos/tjung/2714133094/
    If this is what you want, then buckel up because this was a challenging one.  The problem is that the value help specification is not done at the UI element level, but instead at the context attribute level.  Therefore it can't be as simple as controlling a property on the inputField itself.  What you will need to do is extend the context node that you have bound to the ALV.  You need to add a second version of the attribute that is bound to your input field.  In this second version you can set the value help specification to Disabled:
    http://www.flickr.com/photos/tjung/2713320505
    Notice from the screen shot that I also added another attirbute called CVAR (type STRING).  We will need that later.  It will be used to store which cell variant show be used on a particular row.
    Now we must go to the place in your code where you fill the context node with data.  You will need to copy the data from your primary attribute to your secondary one.  In my case I was copying the values from CARRID to CARRID2.  Of course for update, you would need to merge the data back together before saving it back to the database.  I also set a simple odd/even pattern of controller in the cell variant.  I assume you will have some actual business logic that controls this:
    data odd type boolean value abap_true.
       loop at lt_f_r_sflight[] assigning <ls_f_r_sflight>.
        clear ls_c_r_sflight.
        move-corresponding <ls_f_r_sflight> to ls_c_r_sflight.
        move <ls_f_r_sflight>-carrid to ls_c_r_sflight-carrid2.
        if odd = abap_true.
          odd = abap_false.
        else.
          odd = abap_true.
          ls_c_r_sflight-cvar = 'NOVH'.
        endif.
        insert ls_c_r_sflight into table lt_c_r_sflight[].
      endloop.
      lo_r_sflight->bind_table( lt_c_r_sflight[] ).
    Next is the logic in the initialization of the ALV.  We will need to create two input fields - each bound to the different context attributes. We will make the one the primary cell editor.  The other will become the cell editor of the cell variant.  We then tell the column where it can get its cell variant value from:
    DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      l_table->if_salv_wd_table_settings~set_read_only( abap_false ).
      DATA input1 TYPE REF TO cl_salv_wd_uie_input_field.
      DATA l_column TYPE REF TO cl_salv_wd_column.
      l_column = l_table->if_salv_wd_column_settings~get_column( 'CARRID' ).
      CREATE OBJECT input1
        EXPORTING
          value_fieldname = 'CARRID'.
      l_column->set_cell_editor( input1 ).
      DATA input2 TYPE REF TO cl_salv_wd_uie_input_field.
      CREATE OBJECT input2
        EXPORTING
          value_fieldname = 'CARRID2'.
      DATA l_cv TYPE REF TO cl_salv_wd_cv_standard.
      CREATE OBJECT l_cv.
      l_cv->set_key( 'NOVH' ).
      l_cv->set_editor(  input2 ).
      l_column->add_cell_variant( l_cv ).
      l_column->set_sel_cell_variant_fieldname( 'CVAR' ).

  • Freely programed F4 help

    Hello Experts,
    i want to create a freely programed F4 help for one of the attribute in my context.
    can anyone tell me how to go about it step by step.
    Thanks,
    gunjan

    Hi Gunjan,
    Below are the important points which you need to keep in mind while designing this 2nd component ( say COMP2) :
    1) Your component which gets displayed as the search help must implement the Interface IWD_VALUE_HELP. (For this double click on your Web Dynpro Component & go to the "Implemented Interfaces" tab. Just specify IWD_VALUE_HELP under the "Name" column & press on enter. The "implementation State" would then display a green traffic light for you signifying that the interface has been successfully implemented.)
    2) A window by name WD_VALUE_HELP would have been automatically added to this component when you implement the IWD_VALUE_HELP interface. You need to embed the view which you would like to appear on F4 help under this particular window. (Normally if you had created a MAIN view you would embed this view under the window with the same name as your component. But in this case you need to embed your main view under the window WD_VALUE_HELP )
    Now below are the steps to be followed within your main component (say COMP1) in which you have your input field & up on pressing which you want the Freely Programmed Help to Appear.
    1) You need to declare a component usage of your help component (COMP2) within your main component. (COMP1)
    2) Specify a "Controller Usage" of the Used component within your components view. (Go to the "Properties" tab of your view & click on "Create Controller Usage" button & select the INTERFACECONTROLLER of COMP2)
    3) Now change the "Input Help Mode" of your desired context attribute to "Freely Programmed".
    Regards,
    Uday

  • How to add the IP address helper command to the switch

    Hi
    I am trouble shooting a SF 200-48P and I am a bit lost without a CLI not used to the GUI. What I need to know is how to add the IP address helper command to the switch?
    I have a number of IP phones which are not getting an IP address from DHCP (PCs which are diasy chained off the phones are all working correctly). On the higher end switches I would have added the IP address helper command to the VLAN and that would have sorted it. However I can't seem to figure out how to do this on the small business switch.
    Thanks
    Lorne

    Thanks Rizwan. I was banging my head wishing they weren't small business switches as I felt lost without the command line!
    Lorne Gallagher | McCann FitzGerald Solicitors | Riverside One, Sir John Rogerson's Quay, Dublin 2, Ireland | DDI +353 1 607 1726 | Fax +353 1 829 0010 | www.mccannfitzgerald.ie
    Ireland Law Firm of the Year 2011 | Chambers Europe
    Ireland Law Firm of the Year 2011 | International Financial Law Review

  • Freely Programmed Value Help

    Hi,
          I am just getting an error in Freely Programmed Value Help and i have created two Component and i am just getting an error in first component as  WD_COMP_CONTROLLER->VALUE_HELP_LISTENER->CLOSE_WINDOW( ). is Unknown. I hope you Understand my Question. Please find me a Solution.
    Regards,
    Sadiq.

    Hi Bhaskar,
                   Thanks for your reply as you told that i have Initialized in Attributes as VALUE_HELP_LISTENER, but i can't resolve it.
    Regards,
    Sadiq.

  • How to refresh a program? HELP!!!!!!!!!!!!!!!!!!!!

    Hi
    I used Deitel's code of TicTacToe program that creats a server and have 2 clients playing TicTacToe. When the game is over one of the client has to click on new game and a new game will begin. I don't know how to do this.
    Please Help.
    Here's the code for the server
    import java.awt.BorderLayout;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.io.IOException;
    import java.util.Formatter;
    import java.util.Scanner;
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    import java.util.concurrent.locks.Lock;
    import java.util.concurrent.locks.ReentrantLock;
    import java.util.concurrent.locks.Condition;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.SwingUtilities;
    public class TicTacToeServer extends JFrame
    private String[] board = new String[ 9 ]; // tic-tac-toe board
    private JTextArea outputArea; // for outputting moves
    private Player[] players; // array of Players
    private ServerSocket server; // server socket to connect with clients
    private int currentPlayer; // keeps track of player with current move
    private final static int PLAYER_X = 0; // constant for first player
    private final static int PLAYER_O = 1; // constant for second player
    private final static String[] MARKS = { "X", "O" }; // array of marks
    private ExecutorService runGame; // will run players
    private Lock gameLock; // to lock game for synchronization
    private Condition otherPlayerConnected; // to wait for other player
    private Condition otherPlayerTurn; // to wait for other player's turn
    // set up tic-tac-toe server and GUI that displays messages
    public TicTacToeServer()
    super( "Tic-Tac-Toe Server" ); // set title of window
    // create ExecutorService with a thread for each player
    runGame = Executors.newFixedThreadPool( 2 );
    gameLock = new ReentrantLock(); // create lock for game
    // condition variable for both players being connected
    otherPlayerConnected = gameLock.newCondition();
    // condition variable for the other player's turn
    otherPlayerTurn = gameLock.newCondition();
    for ( int i = 0; i < 9; i++ )
    board[ i ] = new String( "" ); // create tic-tac-toe board
    players = new Player[ 2 ]; // create array of players
    currentPlayer = PLAYER_X; // set current player to first player
    try
    server = new ServerSocket( 12345, 2 ); // set up ServerSocket
    } // end try
    catch ( IOException ioException )
    ioException.printStackTrace();
    System.exit( 1 );
    } // end catch
    outputArea = new JTextArea(); // create JTextArea for output
    add( outputArea, BorderLayout.CENTER );
    outputArea.setText( "Server awaiting connections\n" );
    setSize( 300, 300 ); // set size of window
    setVisible( true ); // show window
    } // end TicTacToeServer constructor
    // wait for two connections so game can be played
    public void execute()
    // wait for each client to connect
    for ( int i = 0; i < players.length; i++ )
    try // wait for connection, create Player, start runnable
    players[ i ] = new Player( server.accept(), i );
    runGame.execute( players[ i ] ); // execute player runnable
    } // end try
    catch ( IOException ioException )
    ioException.printStackTrace();
    System.exit( 1 );
    } // end catch
    } // end for
    gameLock.lock(); // lock game to signal player X's thread
    try
    players[ PLAYER_X ].setSuspended( false ); // resume player X
    otherPlayerConnected.signal(); // wake up player X's thread
    } // end try
    finally
    gameLock.unlock(); // unlock game after signalling player X
    } // end finally
    } // end method execute
    // display message in outputArea
    private void displayMessage( final String messageToDisplay )
    // display message from event-dispatch thread of execution
    SwingUtilities.invokeLater(
    new Runnable()
    public void run() // updates outputArea
    outputArea.append( messageToDisplay ); // add message
    } // end method run
    } // end inner class
    ); // end call to SwingUtilities.invokeLater
    } // end method displayMessage
    // determine if move is valid
    public boolean validateAndMove( int location, int player )
    // while not current player, must wait for turn
    while ( player != currentPlayer )
    gameLock.lock(); // lock game to wait for other player to go
    try
    otherPlayerTurn.await(); // wait for player's turn
    } // end try
    catch ( InterruptedException exception )
    exception.printStackTrace();
    } // end catch
    finally
    gameLock.unlock(); // unlock game after waiting
    } // end finally
    } // end while
    // if location not occupied, make move
    if ( !isOccupied( location ) )
    board[ location ] = MARKS[ currentPlayer ]; // set move on board
    currentPlayer = ( currentPlayer + 1 ) % 2; // change player
    // let new current player know that move occurred
    players[ currentPlayer ].otherPlayerMoved( location );
    gameLock.lock(); // lock game to signal other player to go
    try
    otherPlayerTurn.signal(); // signal other player to continue
    } // end try
    finally
    gameLock.unlock(); // unlock game after signaling
    } // end finally
    return true; // notify player that move was valid
    } // end if
    else // move was not valid
    return false; // notify player that move was invalid
    } // end method validateAndMove
    // determine whether location is occupied
    public boolean isOccupied( int location )
    if ( board[ location ].equals( MARKS[ PLAYER_X ] ) ||
    board [ location ].equals( MARKS[ PLAYER_O ] ) )
    return true; // location is occupied
    else
    return false; // location is not occupied
    } // end method isOccupied
    // place code in this method to determine whether game over
    public boolean isGameOver()
    if( ( !board[ 0 ].equals( "" ) &&
    !board[ 1 ].equals( "" ) &&
    !board[ 2 ].equals( "" ) &&
    !board[ 3 ].equals( "" ) &&
    !board[ 4 ].equals( "" ) &&
    !board[ 5 ].equals( "" ) &&
    !board[ 6 ].equals( "" ) &&
    !board[ 7 ].equals( "" ) &&
    !board[ 8 ].equals( "" ) ) )
    players[0].gameOver("Game Over, no winner");
    players[1].gameOver("Game Over, no winner");
    return true;
    else if( board[ 0 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 1 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 2 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 0 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 1 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 2 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 3 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 4 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 5 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 3 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 4 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 5 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 6 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 7 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 8 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 6 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 7 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 8 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 0 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 3 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 6 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board[ 0 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 3 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 6 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 1 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 4 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 7 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 1 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 4 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 7 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 2 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 5 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 8 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 2 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 5 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 8 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 0 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 4 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 8 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 0 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 4 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 8 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else if( board[ 2 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 4 ].equals( MARKS[ PLAYER_X ] ) &&
    board[ 8 ].equals( MARKS[ PLAYER_X ] ) )
    players[0].gameOver("Player X wins");
    players[1].gameOver("Player X wins");
    return true;
    else if( board [ 2 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 4 ].equals( MARKS[ PLAYER_O ]) &&
    board [ 8 ].equals( MARKS[ PLAYER_O ]) )
    players[0].gameOver("Player O wins");
    players[1].gameOver("Player O wins");
    return true;
    else
    return false; // this is left as an exercise
    } // end method isGameOver
    // private inner class Player manages each Player as a runnable
    private class Player implements Runnable
    private Socket connection; // connection to client
    private Scanner input; // input from client
    private Formatter output; // output to client
    private int playerNumber; // tracks which player this is
    private String mark; // mark for this player
    private boolean suspended = true; // whether thread is suspended
    // set up Player thread
    public Player( Socket socket, int number )
    playerNumber = number; // store this player's number
    mark = MARKS[ playerNumber ]; // specify player's mark
    connection = socket; // store socket for client
    try // obtain streams from Socket
    input = new Scanner( connection.getInputStream() );
    output = new Formatter( connection.getOutputStream() );
    } // end try
    catch ( IOException ioException )
    ioException.printStackTrace();
    System.exit( 1 );
    } // end catch
    } // end Player constructor
    // send message that other player moved
    public void otherPlayerMoved( int location )
    output.format( "Opponent moved\n" );
    output.format( "%d\n", location ); // send location of move
    output.flush(); // flush output
    } // end method otherPlayerMoved
    // control thread's execution
    public void run()
    // send client its mark (X or O), process messages from client
    try
    displayMessage( "Player " + mark + " connected\n" );
    output.format( "%s\n", mark ); // send player's mark
    output.flush(); // flush output
    // if player X, wait for another player to arrive
    if ( playerNumber == PLAYER_X )
    output.format( "%s\n%s", "Player X connected",
    "Waiting for another player\n" );
    output.flush(); // flush output
    gameLock.lock(); // lock game to wait for second player
    try
    while( suspended )
    otherPlayerConnected.await(); // wait for player O
    } // end while
    } // end try
    catch ( InterruptedException exception )
    exception.printStackTrace();
    } // end catch
    finally
    gameLock.unlock(); // unlock game after second player
    } // end finally
    // send message that other player connected
    output.format( "Other player connected. Your move.\n" );
    output.flush(); // flush output
    } // end if
    else
    output.format( "Player O connected, please wait\n" );
    output.flush(); // flush output
    } // end else
    // while game not over
    while ( !isGameOver() )
    int location = 0; // initialize move location
    if ( input.hasNext() )
    location = input.nextInt(); // get move location
    // check for valid move
    if ( validateAndMove( location, playerNumber ) )
    displayMessage( "\nlocation: " + location );
    output.format( "Valid move.\n" ); // notify client
    output.flush(); // flush output
    } // end if
    else // move was invalid
    output.format( "Invalid move, try again\n" );
    output.flush(); // flush output
    } // end else
    } // end while
    } // end try
    finally
    try
    connection.close(); // close connection to client
    } // end try
    catch ( IOException ioException )
    ioException.printStackTrace();
    System.exit( 1 );
    } // end catch
    } // end finally
    } // end method run
    // set whether or not thread is suspended
    public void setSuspended( boolean status )
    suspended = status; // set value of suspended
    } // end method setSuspended
    public void gameOver(String msg)
    if(msg.equals("Game Over, no winner"))
    if ( playerNumber == PLAYER_X )
    output.format( "no winner, you loose\n" );
    output.flush(); // flush output
    } // end if
    else
    output.format( "no winner, you loose\n" );
    output.flush(); // flush output
    } // end else
    gameLock.lock();
    else if(msg.equals("Player X wins"))
    if ( playerNumber == PLAYER_X )
    output.format(msg + "\n" );
    output.flush(); // flush output
    } // end if
    else
    output.format(msg + ", you loose\n" );
    output.flush(); // flush output
    } // end else
    gameLock.lock();
    else if(msg.equals("Player O wins"))
    if ( playerNumber == PLAYER_X )
    //players[1].
    output.format(msg + ", you loose\n" );
    output.flush(); // flush output
    } // end if
    else
    output.format(msg + "\n" );
    output.flush(); // flush output
    } // end else
    gameLock.lock();
    else
    } // end class Player
    } // end class TicTacToeServer
    *****and here's the code for the client
    // Fig. 24.15: TicTacToeClient.java
    // Client that let a user play Tic-Tac-Toe with another across a network.
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.GridLayout;
    import java.awt.event.*;
    import java.net.Socket;
    import java.net.InetAddress;
    import java.io.IOException;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.SwingUtilities;
    import java.util.Formatter;
    import java.util.Scanner;
    import java.util.concurrent.Executors;
    import java.util.concurrent.ExecutorService;
    public class TicTacToeClient extends JFrame implements Runnable
    private JTextField idField; // textfield to display player's mark
    private JTextArea displayArea; // JTextArea to display output
    private JPanel boardPanel; // panel for tic-tac-toe board
    private JPanel panel2; // panel to hold board
    private JButton btnNew;
    private Square board[][]; // tic-tac-toe board
    private Square currentSquare; // current square
    private Socket connection; // connection to server
    private Scanner input; // input from server
    private Formatter output; // output to server
    private String ticTacToeHost; // host name for server
    private String myMark; // this client's mark
    private boolean myTurn; // determines which client's turn it is
    private final String X_MARK = "X"; // mark for first client
    private final String O_MARK = "O"; // mark for second client
    // set up user-interface and board
    public TicTacToeClient( String host )
    ticTacToeHost = host; // set name of server
    displayArea = new JTextArea( 4, 30 ); // set up JTextArea
    displayArea.setEditable( false );
    add( new JScrollPane( displayArea ), BorderLayout.SOUTH );
    boardPanel = new JPanel(); // set up panel for squares in board
    boardPanel.setLayout( new GridLayout( 3, 3, 0, 0 ) );
    board = new Square[ 3 ][ 3 ]; // create board
    // loop over the rows in the board
    for ( int row = 0; row < board.length; row++ )
    // loop over the columns in the board
    for ( int column = 0; column < board[ row ].length; column++ )
    // create square
    board[ row ][ column ] = new Square( " ", row * 3 + column );
    boardPanel.add( board[ row ][ column ] ); // add square
    } // end inner for
    } // end outer for
    idField = new JTextField(); // set up textfield
    idField.setEditable( false );
    add( idField, BorderLayout.NORTH );
    panel2 = new JPanel(); // set up panel to contain boardPanel
    btnNew = new JButton("New Game");
    panel2.add(btnNew, BorderLayout.NORTH);
    panel2.add( boardPanel, BorderLayout.CENTER ); // add board panel
    add( panel2, BorderLayout.CENTER ); // add container panel
    btnNew.setEnabled(false);
    btnNew.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    newGame();
    setSize( 300, 225 ); // set size of window
    setVisible( true ); // show window
    startClient();
    } // end TicTacToeClient constructor
    // start the client thread
    public void startClient()
    try // connect to server, get streams and start outputThread
    // make connection to server
    connection = new Socket(
    InetAddress.getByName( ticTacToeHost ), 12345 );
    // get streams for input and output
    input = new Scanner( connection.getInputStream() );
    output = new Formatter( connection.getOutputStream() );
    } // end try
    catch ( IOException ioException )
    ioException.printStackTrace();
    } // end catch
    // create and start worker thread for this client
    ExecutorService worker = Executors.newFixedThreadPool( 1 );
    worker.execute( this ); // execute client
    } // end method startClient
    // control thread that allows continuous update of displayArea
    public void run()
    myMark = input.nextLine(); // get player's mark (X or O)
    SwingUtilities.invokeLater(
    new Runnable()
    public void run()
    // display player's mark
    idField.setText( "You are player \"" + myMark + "\"" );
    } // end method run
    } // end anonymous inner class
    ); // end call to SwingUtilities.invokeLater
    myTurn = ( myMark.equals( X_MARK ) ); // determine if client's turn
    // receive messages sent to client and output them
    while ( true )
    if ( input.hasNextLine() )
    processMessage( input.nextLine() );
    } // end while
    } // end method run
    // process messages received by client
    private void processMessage( String message )
    // valid move occurred
    if ( message.equals( "Valid move." ) )
    displayMessage( "Valid move, please wait.\n" );
    setMark( currentSquare, myMark ); // set mark in square
    } // end if
    else if ( message.equals( "Invalid move, try again" ) )
    displayMessage( message + "\n" ); // display invalid move
    myTurn = true; // still this client's turn
    } // end else if
    else if ( message.equals( "Opponent moved" ) )
    int location = input.nextInt(); // get move location
    input.nextLine(); // skip newline after int location
    int row = location / 3; // calculate row
    int column = location % 3; // calculate column
    setMark( board[ row ][ column ],
    ( myMark.equals( X_MARK ) ? O_MARK : X_MARK ) ); // mark move
    displayMessage( "Opponent moved. Your turn.\n" );
    myTurn = true; // now this client's turn
    } // end else if
    //Game Over #*********Here**********#
    else if ( message.equals( "no winner, you loose" ) )
    btnNew.setEnabled(true);
    myTurn = false;
    } // end else if
    else if ( message.equals( "Player X wins" ) ||
    message.equals( "Player X wins, you loose" ) )
    btnNew.setEnabled(true);
    myTurn = false;
    } // end else if
    else if ( message.equals( "Player O wins" ) ||
    message.equals( "Player O wins, you loose" ) )
    btnNew.setEnabled(true);
    myTurn = false;
    } // end else if
    else
    displayMessage( message + "\n" ); // display the message
    } // end method processMessage
    //start a new game here
    private void newGame()
    // manipulate outputArea in event-dispatch thread
    private void displayMessage( final String messageToDisplay )
    SwingUtilities.invokeLater(
    new Runnable()
    public void run()
    displayArea.append( messageToDisplay ); // updates output
    } // end method run
    } // end inner class
    ); // end call to SwingUtilities.invokeLater
    } // end method displayMessage
    // utility method to set mark on board in event-dispatch thread
    private void setMark( final Square squareToMark, final String mark )
    SwingUtilities.invokeLater(
    new Runnable()
    public void run()
    squareToMark.setMark( mark ); // set mark in square
    } // end method run
    } // end anonymous inner class
    ); // end call to SwingUtilities.invokeLater
    } // end method setMark
    // send message to server indicating clicked square
    public void sendClickedSquare( int location )
    // if it is my turn
    if ( myTurn )
    output.format( "%d\n", location ); // send location to server
    output.flush();
    myTurn = false; // not my turn anymore
    } // end if
    } // end method sendClickedSquare
    // set current Square
    public void setCurrentSquare( Square square )
    currentSquare = square; // set current square to argument
    } // end method setCurrentSquare
    // private inner class for the squares on the board
    private class Square extends JPanel
    private String mark; // mark to be drawn in this square
    private int location; // location of square
    public Square( String squareMark, int squareLocation )
    mark = squareMark; // set mark for this square
    location = squareLocation; // set location of this square
    addMouseListener(
    new MouseAdapter() {
    public void mouseReleased( MouseEvent e )
    setCurrentSquare( Square.this ); // set current square
    // send location of this square
    sendClickedSquare( getSquareLocation() );
    } // end method mouseReleased
    } // end anonymous inner class
    ); // end call to addMouseListener
    } // end Square constructor
    // return preferred size of Square
    public Dimension getPreferredSize()
    return new Dimension( 30, 30 ); // return preferred size
    } // end method getPreferredSize
    // return minimum size of Square
    public Dimension getMinimumSize()
    return getPreferredSize(); // return preferred size
    } // end method getMinimumSize
    // set mark for Square
    public void setMark( String newMark )
    mark = newMark; // set mark of square
    repaint(); // repaint square
    } // end method setMark
    // return Square location
    public int getSquareLocation()
    return location; // return location of square
    } // end method getSquareLocation
    // draw Square
    public void paintComponent( Graphics g )
    super.paintComponent( g );
    g.drawRect( 0, 0, 29, 29 ); // draw square
    g.drawString( mark, 11, 20 ); // draw mark
    } // end method paintComponent
    } // end inner-class Square
    } // end class TicTacToeClient
    Please any kind of help will be appreciated.
    HELP!!!

    I would be happy to help you, but I've decided not to contribute here anymore because of the poor way in which this site is being administered.
    Others are still helping, but more may leave if things don't improve. May I recommend devshed or javaranch?
    http://www.devshed.com/
    http://www.javaranch.com/
    If you would like to complain to the amdins of this forum, either click the "Report Abuse" link or the "Feedback" link.

  • How to add funded program in report wirter in 4FBUDCON?

    Hi!
    How can I add the period/month and funded program in the report painter 4FBUDCON? I can't find the any characteristics values of them fromt he basic key figure of HSLT?
    Thanks.

    Hi Saurabh,
    You need to create ABAP program in which you check the values for required process chain in
    following table
    RSPCLOGCHAIN (Feilds ANALYZED_STATUS LOG_ID)
    Depend on values you can trigger next process or you can wait unitil this process chain complete.you need to check status from table using ABAP.
    If you are not aware about how to write ABAP program then take help from ABAP Team.
    Regards,
    Ganesh Bothe

  • How to add/delete programs.

    I am a new mac user and I have just gotten a refurb ibook. It already has itunes on it, but I want to install iLife in order to use imovie. But when I use the install CD it says it can't because I already have a newer version of itunes running. I don't plan to use itunes so I don't care if my ilife is an older version. But I cannot find the way to delete the itunes already loaded so the ilife will install. I cannot find the equivilant of add/remove programs from Windows control panel. Can anyone please help? Obviously, I am FAR from being a computer whiz so any help is MUCH appreciated. Thanks

    The other advice posted will help you understand how to install iTunes, but on a Mac, there is no add/remove control panel. The easiest way to get rid of iTunes: open your application folder and drag iTunes to the trash. You can also open the /user/music folder and drag the iTunes folder to the trash. This will get rid of all the music on the computer and the iTunes preference files.
    After you install iLife, you can upgrade to the latest version of iTunes.
    BTW, isn't there an option early in the iLife installation to choose which components you want to install? If so, just uncheck the iTunes option and install the other components.

  • How to add Abap program in process chain to check the another process chain status and do accordingly

    Hello All,
    My requirement is related to process chain 1 . I have one process chain in that i have to  put abap program in middle of that chain . This program will check the status of one another process chain 2 status ( whether it was completed or it is going on). if it is completed then continue the Process chain 1  to further activity else wait to complete Process chain 2 .
    Here i have to use process chain 2 as a parameter.
    Kindly provide me solution .
    Regards
    Saurabh

    Hi Saurabh,
    You need to create ABAP program in which you check the values for required process chain in
    following table
    RSPCLOGCHAIN (Feilds ANALYZED_STATUS LOG_ID)
    Depend on values you can trigger next process or you can wait unitil this process chain complete.you need to check status from table using ABAP.
    If you are not aware about how to write ABAP program then take help from ABAP Team.
    Regards,
    Ganesh Bothe

Maybe you are looking for

  • Credit memo with freight on returns PO using MRRL

    We are trying to achieve the below solution for a returns PO, created 2 condition types, assigned to the pricing procedure to achieve the GR posting. When we use MRRL to create a credit memo for both the material and the freight. the system creates a

  • [SOLVED] drm:radeon delays xorg start for 30 secs

    Does anyone knows about a reason why starting the X.org server could take over 30 seconds? Jun 19 15:15:59 Arch kernel: [drm] Initialized drm 1.1.0 20060810 Jun 19 15:15:59 Arch kernel: [drm] radeon kernel modesetting enabled. Jun 19 15:15:59 Arch ke

  • Image size and resolution....just when I thought I understood!

    I couldn't find this question anywhere else, but I can't be the only one who's come across this: I have an image in a folder...finder/explorer tells me that it's 638px X 479px, and 234KB. I open it in Photoshop and go to Image Size. PS says it is ind

  • Adobe Reader 9.2 for mac install failed

    On Mac OS X 10.6.2 I can not use command "/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer InstallMe.pkg" to install the pkg. It error as follow. The command can working on Tiger and Leopard. J-Ansons-Mac-mini:/ root# /System/Libra

  • Mysql update form  a form in jsp page

    <?xml version="1.0" encoding ="iso-8859-1"?> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %> <%@ tagl