Double click on JTree!

hi, i have a very nice tree with leafs and nodes, now i want to show a dialog with information every time the user double clicks in a tree leaf... anyone
thanks in advance

no need for help, got it working ...

Similar Messages

  • Double Click On JTree new window is needed

    Hi All,
    If i double click the JTree node , it has to open the new popup window(frame) with the jtree node name.

    This can be done with MouseListener for leaf nodes.There is a conflict with the expand/collapse feature for non-leaf nodes.

  • Double click a node in a jtree

    hi i have a Jtree with usernames has nodes. how do i generate a code that when a user double clicks a username node, the corresponding code will execute along with what node was clicked on.
    for example, a user clicks on username "jonney" and than a new chat window will appear to establish a chat session with jonney.
    at the moment when a user selects a node, you are able to create a new chat session, but i want to change it so that the user has to double click their username not just selecting it. similar to msn mesenger.
    here is the code i have at the moment.
    public void valueChanged(TreeSelectionEvent event)
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)
                           userTree.getLastSelectedPathComponent();
              //get username.
              Object nodeInfo = node.getUserObject();
              String info =nodeInfo.toString();
              if(node.isLeaf())
                    ChatDialog_c chatting = new ChatDialog_c(crnt_user, info);
                    Thread t = new Thread(chatting);
                    chatting.setTitle("I-comm");
                    chatting.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    chatting.setSize(430, 200);
                    chatting.getSize();
                    chatting.setLocation(420,200);
                    chatting.setVisible(true);
                    t.start();
          }

    when you call a method you call it on an object.
    e.g.
    Class instance = new Class();
    instance.method();where Class is a hypathetical class name and instance is a hypathetical variable name of type Class.
    new is a keyword for creating an instance of a Class.
    method is the name of a method in Class which is accessable through instance.
    when you do not put an instance in front of a metho call:
    method();it is the same as:
    this.method();this being the keyword to say "us the current object we are in".
    In the API for MouseEvent it says there is a method getClickCount(). looking back at your code we have a refrence to a MouseEvent being passed as a parameter to the method you are in.
    private void userTreeMouseClicked(java.awt.event.MouseEvent evt) {
                                                              ^from this you should be able to see what you are doing wrong, I could have just told you the line to write in much less time but i think you will gain more this way.

  • JTree Double Click

    Is there any way I can remove the default double click behaviour for a node in a JTree? Currently it expands or collapses the node, but I want it to do something else. I have set a listener up so it can do the new task, but I want to remove the expand/collapse behaviour as well.

    But it isn't....
    With the TreeWillExpandListener I cannot distinguish between the two expansion methods.
    However, I have found another, extremely simple way of doing what I want, using the JTree.setToggleClickCount(int) method. This sets the number of clicks needed to expand the node (but does not affect clicking on the + box). By setting this to a high number, I can prevent double clicks from expanding nodes, thus allowing my own double click listener to do the stuff I need.

  • Disable expand/collapse JTree through double click

    Hi guys,
    In my Tree when you double click a node, a input dialog will pop up. And the node will be expanded or collapsed accordingly. How can I disable expand or collapse the node through double click. So that every time only the input dialog will popup and the tree stays.
    Thanks a lot!

    The JTree class have a method setToggleClickCount(int clickCount) which sets the number of mouse clicks before a node will expand or close. The default is two. You can try to set 0 or for examle 10 and double click will only dialog popup.
    P.S.For the future RTFM and view jdk source code

  • Is it possible to get a double click event from a JTree?

    I have created a JTree that has been added to my listener to see if an item has been single clicked or double clicked, but it only shows items being single clicked even if it's double clicked. My listener checks as follows:
    if(e.getClickCount() == 1)
    JOptionPane.showMessageDialog(null, "Single clicked\n", "One", JOptionPane.PLAIN_MESSAGE);
    else if(e.getClickCount() == 2)
    JOptionPane.showMessageDialog(null, "Double clicked\n", "two", JOptionPane.PLAIN_MESSAGE);
    //Anybody have any suggestions?

    This should help:
    //JTree tree = new JTree();
    tree.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            int selectionRow = tree.getRowForLocation(e.getX(), e.getY());
            if(selectionRow > FIRST_NODE && selectionRow < LAST_NODE)
                if(e.getClickCount() == 1) {
                    //Code here
                else if(e.getClickCount() == 2) {
                    //Code here
    }substituting FIRST_NODE and LAST_NODE as your lower and upper inclusion.

  • Jtree, Double Click to open a file

    Here is what I have so far:
    tree.addMouseListener(new MouseAdapter(){
                public void mouseClicked(MouseEvent evt){
                    if (evt.getClickCount()==2){
                        TreePath tp = tree
                                .getClosestPathForLocation(evt.getX(), evt.getY());
                        File file = (File)tp.getLastPathComponent();
                        // open the file here
                        if(file.isFile() && file.exists()){
                            System.out.format("You double clicked %s", file.toString());
                            //---->What goes here?
            });I've searched the internet and found a few examples that don't work. Anyhow if a person clicks on an image, it should open the image, if they click on a txt document it should open the text document. Any clues on how to implement that would be fantastic.

    Thanks that seems to work. I can open .txt documents without a problem. However images don't open and .html pages open and then immediately close. Any ideas?
    import java.awt.BorderLayout;
    import java.awt.Desktop;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.io.File;
    import java.io.IOException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;.
    tree.addMouseListener(new MouseAdapter(){
                public void mouseClicked(MouseEvent evt){
                    if (evt.getClickCount()==2){
                        TreePath tp = tree
                                .getClosestPathForLocation(evt.getX(), evt.getY());
                        File file = (File)tp.getLastPathComponent();
                        // open the file here
                        if(file.isFile() && file.exists()){
                            System.out.format("You double clicked %s", file.toString());
                            try {
                                Desktop.getDesktop().open(file);
                            } catch (IOException ex) {
                                System.out.println("File Error: Unable to open");
                                Logger.getLogger(FileTree.class.getName()).log(Level.SEVERE, null, ex);
            });

  • Double click in a JTable row

    Hi,
    I have the following problem. I would like to have a JTable with single selection (this is ok so far), but I would like it to have the following behaviour.
    If a row is clicked, it becomes selected. If a selected row is clicked again it becomes deselected.
    Does anyone have any suggestions?
    Thnx,
    G

    I am writing about JTree rather than JTable ... because there are no other replies I figured it's better than nothing ...
    This code does the behavior you describe to a JTree.
    (Code snippet copied from JTree javadoc page and modified by me.)
    java.awt.event.MouseListener ml = new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent e) {
    int selRow = tree.getRowForLocation(e.getX(), e.getY());
    if(selRow != -1) {
    if(e.getClickCount() == 1) {
    System.out.println("SINGLE CLICK");
    else if(e.getClickCount() == 2) {
    System.out.println("DOUBLE CLICK");
    tree.clearSelection();
    tree.addMouseListener(ml);
    I put the print statements in to demonstrate that a double-click event actually is a single-click followed by a double-click. Since you didn't sound like you need to do any custom code for the single-click case, this fact probably doesn't affect you.
    I hope I helped
    Mel

  • How to open a dialog box while double cliking the JTree child node.

    hi
    I am new to Swing technology.I want to open a dialog box while double clicking the child node of a tree.Could anyone please send me some examples.

    mouse listener on the tree, see if the click count is 2 and what node it clicked, open the dialog. MouseEvent can give you the click count and x/y coordinate, JTree can tell you what node is at that coordinate.

  • Double click detection

    Hello,
    I have a JTree and I want to detect mouse double click over some nodes. I am using the following code in my JTree (which implements MouseListener) :
    public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2)          
    // MY ACTION
    the snag is that it also detect double clicks when it does not occured over a node. In that case I would like no action to be launched.
    How can I do it ??
    Thank you.
    Sylvain.

    Hi,
    I achived the following way to get the things working like you would to. Take a look:
    public void mouseClicked(MouseEvent evt) {
      if ( evt.getClickCount() == 2 ) {
       TreeNode node = (TreeNode)ree.getLastSelectedPathComponent();
       if ( node.isLeaf() ) {
        // Go ahead
    I hope this help you.
    Regards,
    Ualter Junior.

  • Double click on field in ALV Report

    hi everyone
    i have written a program which displays data in an alv grid report, now i need to extend my program a bit more.
    when i double click on any field value the corresponding record should be displayed
    can anyone suggest if i need to call any fn module for this, if so wht's the fn module
    if anyone can give an example that would be fine
    Cheers,
    rama

    Hi,
    *& Report  Z_REPORTFROMKNA1ANDT005T
    REPORT  Z_REPORTFROMKNA1ANDT005T
                      LINE-SIZE 180
                      MESSAGE-ID ZZ.
    TABLES:EKKO.
    TYPE-POOLS : SLIS.
          Internal table for ALV
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,     "Field catalog
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,       "WA for Field catalog
           IT_EVENT TYPE SLIS_T_EVENT,               "events
           WA_EVENT TYPE SLIS_ALV_EVENT,             "WA for events
           IT_COMMENT TYPE SLIS_T_LISTHEADER,        "Header details
           WA_COMMENT TYPE SLIS_LISTHEADER,          "WA for header details
           WA_LAYOUT TYPE SLIS_LAYOUT_ALV,           "Layout
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,         "Sort table
           WA_SORT TYPE SLIS_SORTINFO_ALV,           "WA for sort table
           IT_KEYINFO TYPE SLIS_KEYINFO_ALV.         "Pass key value
    DATA : V_REPID LIKE SY-REPID.
    V_REPID = SY-REPID.
    DATA : V_DATE LIKE SY-DATUM.
    color management.
    DATA  : IT_COLOR TYPE TABLE OF LVC_S_SCOL.       "Color management.
          Internal table declearation
    DATA:BEGIN OF IT_EKKO OCCURS 0,
      EBELN LIKE EKKO-EBELN,
      BUKRS  LIKE EKKO-BUKRS,
      AEDAT  LIKE EKKO-AEDAT,
    END OF IT_EKKO.
    DATA : BEGIN OF IT_EKPO OCCURS 0,
      EBELN LIKE EKPO-EBELN,
      EBELP LIKE EKPO-EBELP,
      MATNR LIKE EKPO-MATNR,
      MENGE LIKE EKPO-MENGE,
      MEINS LIKE EKPO-MEINS,
      NETPR LIKE EKPO-NETPR,
      NETWR LIKE EKPO-MENGE,
      chk(1) type c,
    END OF IT_EKPO.
    DATA : BEGIN OF IT_EKBE OCCURS 0,
           EBELN LIKE EKBE-EBELN,
           EBELP LIKE EKBE-EBELP,
           BELNR LIKE EKBE-BELNR,
           MENGE LIKE EKBE-MENGE,
           MATNR LIKE EKBE-MATNR,
      END OF IT_EKBE.
    DATA : BEGIN OF IT_FINAL OCCURS 0,
      EBELN LIKE EKPO-EBELN,
      EBELP LIKE EKPO-EBELP,
      MATNR LIKE EKPO-MATNR,
      MENGE LIKE EKPO-MENGE,
      MEINS LIKE EKPO-MEINS,
      NETPR LIKE EKPO-NETPR,
      NETWR LIKE EKPO-NETWR,
      LINE_COLOR(4) TYPE C,     "Used to store row color attributes
    END OF IT_FINAL.
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
    PARAMETERS : RB1 RADIOBUTTON GROUP G1 MODIF ID Z1,
                 RB2 RADIOBUTTON GROUP G1 MODIF ID Z2,
                 RB3 RADIOBUTTON GROUP G1 MODIF ID Z3.
    SELECTION-SCREEN END OF BLOCK BLK.
    AT SELECTION-SCREEN OUTPUT.
      PERFORM MODIFY_SCREEN.
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM GET_ALV.
    *&      Form  modify_screen
          text
    -->  p1        text
    <--  p2        text
    FORM MODIFY_SCREEN .
    IF RB1 = 'X'.
       LOOP AT SCREEN.
         IF SCREEN-GROUP1 = 'Z1' .
           SCREEN-INVISIBLE = 1.
           SCREEN-ACTIVE = 0.
         ELSE.
           SCREEN-INVISIBLE = 0.
           SCREEN-ACTIVE = 1.
         ENDIF.
         MODIFY SCREEN.
       ENDLOOP.
    ENDIF.
    ENDFORM.                    " modify_screen
    *&      Form  GET_DETAILS
          Get the details
    FORM GET_DETAILS .
      DATA: LD_COLOR(1) TYPE C.
      SELECT EBELN
             BUKRS
             AEDAT
        FROM EKKO
        INTO TABLE IT_EKKO
       WHERE EBELN IN S_EBELN.
      IF SY-SUBRC = 0.
        SORT IT_EKKO BY EBELN.
      ELSE.
        MESSAGE E000 WITH 'DATA NOT FOUND'.
      ENDIF.
      IF NOT IT_EKKO[] IS INITIAL.
        SELECT EBELN
               EBELP
               MATNR
               MENGE
               MEINS
               NETPR
               NETWR
              chk
          FROM EKPO
          INTO TABLE IT_EKPO
           FOR ALL ENTRIES IN IT_EKKO
         WHERE EBELN = IT_EKKO-EBELN.
        IF SY-SUBRC = 0.
          SORT IT_EKPO BY EBELN.
        ENDIF.
      ENDIF.
      LOOP AT IT_EKPO.
        IT_FINAL-EBELN = IT_EKPO-EBELN.
        IT_FINAL-EBELP = IT_EKPO-EBELP.
        IT_FINAL-MATNR = IT_EKPO-MATNR.
        IT_FINAL-MENGE = IT_EKPO-MENGE.
        IT_FINAL-MEINS = IT_EKPO-MEINS.
        IT_FINAL-NETPR = IT_EKPO-NETPR.
        IT_FINAL-NETWR = IT_EKPO-NETWR.
        ON CHANGE OF IT_FINAL-EBELN.
          LD_COLOR = 7.
          CONCATENATE 'C' LD_COLOR '10' INTO IT_FINAL-LINE_COLOR.
        ENDON.
        APPEND IT_FINAL.
        CLEAR IT_FINAL.
      ENDLOOP.
    ENDFORM.                    " GET_DETAILS
    *&      Form  GET_ALV
          text
    FORM GET_ALV .
      PERFORM GENERATE_FIELDCAT.
      PERFORM GENERATE_LAYOUT.
      PERFORM GENERATE_EVENTS.
      PERFORM GENERATE_SORT.
      PERFORM ALV_GRID_DISPLAY.
    ENDFORM.                    " GET_ALV
    *&      Form  GENERATE_FIELDCAT
          Field catalog
    FORM GENERATE_FIELDCAT .
      IF RB1 = 'X' OR RB2 = 'X'.
        WA_FIELDCAT-FIELDNAME = 'EBELN'.
        WA_FIELDCAT-COL_POS = '1'.
        WA_FIELDCAT-JUST = 'R'.
        WA_FIELDCAT-SELTEXT_L = 'PO Number'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        WA_FIELDCAT-DO_SUM = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'EBELP'.
        WA_FIELDCAT-COL_POS = '2'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'Item Number'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        WA_FIELDCAT-edit = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'MATNR'.
        WA_FIELDCAT-COL_POS = '3'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'Material Number'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'MENGE'.
        WA_FIELDCAT-COL_POS = '4'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'PO Quantity'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'MEINS'.
        WA_FIELDCAT-COL_POS = '5'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'Order unit'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'NETPR'.
        WA_FIELDCAT-COL_POS = '6'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'Net price'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = 'NETWR'.
        WA_FIELDCAT-COL_POS = '7'.
        WA_FIELDCAT-JUST = 'C'.
        WA_FIELDCAT-SELTEXT_L = 'Net order value'.
        WA_FIELDCAT-LOWERCASE = 'X'.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
       wa_fieldcat-fieldname = 'CHK'.
       wa_fieldcat-col_pos = '8'.
       wa_fieldcat-just = 'C'.
       wa_fieldcat-seltext_l = 'Check Box'.
       wa_fieldcat-lowercase = 'X'.
       wa_fieldcat-checkbox = 'X'.
       wa_fieldcat-edit = 'X'.
       append wa_fieldcat to it_fieldcat.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
           I_PROGRAM_NAME               = V_REPID
           I_INTERNAL_TABNAME           = 'IT_EKKO'
        I_STRUCTURE_NAME             = I_STRUCTURE_NAME
        I_CLIENT_NEVER_DISPLAY       = 'X'
           I_INCLNAME                   = V_REPID
        I_BYPASSING_BUFFER           = I_BYPASSING_BUFFER
        I_BUFFER_ACTIVE              = I_BUFFER_ACTIVE
          CHANGING
            CT_FIELDCAT                  = IT_FIELDCAT
         EXCEPTIONS
           INCONSISTENT_INTERFACE       = 1
           PROGRAM_ERROR                = 2
           OTHERS                       = 3
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
           I_PROGRAM_NAME               = V_REPID
           I_INTERNAL_TABNAME           = 'IT_EKPO'
      I_STRUCTURE_NAME             = I_STRUCTURE_NAME
      I_CLIENT_NEVER_DISPLAY       = 'X'
           I_INCLNAME                   = V_REPID
      I_BYPASSING_BUFFER           = I_BYPASSING_BUFFER
      I_BUFFER_ACTIVE              = I_BUFFER_ACTIVE
          CHANGING
            CT_FIELDCAT                  = IT_FIELDCAT
         EXCEPTIONS
           INCONSISTENT_INTERFACE       = 1
           PROGRAM_ERROR                = 2
           OTHERS                       = 3
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GENERATE_FIELDCAT
    *&      Form  GENERATE_EVENTS
          Generate Events
    FORM GENERATE_EVENTS .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        IMPORTING
          ET_EVENTS       = IT_EVENT
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT IT_EVENT[] IS INITIAL.
        READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
        IF SY-SUBRC = 0.
          WA_EVENT-FORM = 'TOP_OF_PAGE'.
          MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX.
        ENDIF.
    <b>   READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
        IF SY-SUBRC = 0.
          WA_EVENT-FORM = 'IT_USER_COMMAND'.
          MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX.
        ENDIF.</b>
      ENDIF.
    ENDFORM.                    " GENERATE_EVENTS
    *&      Form  TOP_OF_PAGE
          TOP_OF_PAGE
    FORM TOP_OF_PAGE.
      DATA : V_CONCATE(50) TYPE C.
      DATA : V_SPACE(10) TYPE C.
      CONCATENATE 'VIKRANTH' 'RAJESH' INTO V_CONCATE.
      WA_COMMENT-TYP = 'S'.
      WA_COMMENT-KEY = 'USER :'.
      WA_COMMENT-INFO = V_CONCATE.
      APPEND WA_COMMENT TO IT_COMMENT.
      WA_COMMENT-TYP = 'S'.
      WA_COMMENT-KEY = 'DATE:'.
      WA_COMMENT-INFO = SY-DATUM.
      APPEND WA_COMMENT TO IT_COMMENT.
      WA_COMMENT-TYP = 'S'.
      WA_COMMENT-KEY = 'TIME:'.
      WA_COMMENT-INFO = SY-TIMLO.
      APPEND WA_COMMENT TO IT_COMMENT.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_COMMENT.
      CLEAR IT_COMMENT.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_GRID_DISPLAY
          Grid display
    FORM ALV_GRID_DISPLAY .
      IF RB1 = 'X'.
        PERFORM GRID_DISPLAY.
      ELSEIF RB2 = 'X'.
        PERFORM LIST_DISPLAY.
      ELSE.
        PERFORM HIERSEQ_DISPLAY.
      ENDIF.
    ENDFORM.                    " ALV_GRID_DISPLAY
    *&      Form  GENERATE_LAYOUT
          LAYOUT
    FORM GENERATE_LAYOUT .
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.           "OPTIMIZING FIELD WIDTH
      WA_LAYOUT-ZEBRA = 'X'.                       "PUTTING ZEBRA COLORS
      WA_LAYOUT-TOTALS_TEXT = 'Total'.
      WA_LAYOUT-SUBTOTALS_TEXT = 'SUB TOTAL'.
      WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    ENDFORM.                    " GENERATE_LAYOUT
    *&      Form  GENERATE_SORT
          SORT
    FORM GENERATE_SORT .
      WA_SORT-FIELDNAME = 'EBELN'.
      WA_SORT-SPOS = '1'.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " GENERATE_SORT
    *&      Form  GRID_DISPLAY
          GRID DISPLAY
    FORM GRID_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'IT_USER_COMMAND'
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = 'Purchase Order Details'
      I_GRID_SETTINGS                   = I_GRID_SETTINGS
       IS_LAYOUT                         = WA_LAYOUT
       IT_FIELDCAT                       = IT_FIELDCAT
      IT_EXCLUDING                      = IT_EXCLUDING
      IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
       IT_SORT                           = IT_SORT
      IT_FILTER                         = IT_FILTER
      IS_SEL_HIDE                       = IS_SEL_HIDE
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        = IS_VARIANT
       IT_EVENTS                         = IT_EVENT
      IT_EVENT_EXIT                     = IT_EVENT_EXIT
      IS_PRINT                          = IS_PRINT
      IS_REPREP_ID                      = IS_REPREP_ID
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
      IT_HYPERLINK                      = IT_HYPERLINK
      IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
      IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
      IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB                          = IT_FINAL
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GRID_DISPLAY
    *&      Form  LIST_DISPLAY
          LIST DISPLAY
    FORM LIST_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK              = ' '
        I_BYPASSING_BUFFER             = I_BYPASSING_BUFFER
        I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = V_REPID
        I_CALLBACK_PF_STATUS_SET       = ' '
    <b>     I_CALLBACK_USER_COMMAND        = 'IT_USER_COMMAND'</b>
        I_STRUCTURE_NAME               = I_STRUCTURE_NAME
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
        IT_EXCLUDING                   = IT_EXCLUDING
        IT_SPECIAL_GROUPS              = IT_SPECIAL_GROUPS
         IT_SORT                        = IT_SORT
        IT_FILTER                      = IT_FILTER
        IS_SEL_HIDE                    = IS_SEL_HIDE
        I_DEFAULT                      = 'X'
        I_SAVE                         = ' '
        IS_VARIANT                     = IS_VARIANT
         IT_EVENTS                      = IT_EVENT
        IT_EVENT_EXIT                  = IT_EVENT_EXIT
        IS_PRINT                       = IS_PRINT
        IS_REPREP_ID                   = IS_REPREP_ID
        I_SCREEN_START_COLUMN          = 0
        I_SCREEN_START_LINE            = 0
        I_SCREEN_END_COLUMN            = 0
        I_SCREEN_END_LINE              = 0
        IR_SALV_LIST_ADAPTER           = IR_SALV_LIST_ADAPTER
        IT_EXCEPT_QINFO                = IT_EXCEPT_QINFO
        I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER        = E_EXIT_CAUSED_BY_CALLER
        ES_EXIT_CAUSED_BY_USER         = ES_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB                       = IT_FINAL
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " LIST_DISPLAY
    *&      Form  HIERSEQ_DISPLAY
          HIERSEQ DISPLAY
    FORM HIERSEQ_DISPLAY .
      IT_KEYINFO-HEADER01 = 'EBELN'.
      IT_KEYINFO-ITEM01 = 'EBELN'.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK              = ' '
         I_CALLBACK_PROGRAM             = V_REPID
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   = IT_EXCLUDING
      IT_SPECIAL_GROUPS              = IT_SPECIAL_GROUPS
         IT_SORT                        = IT_SORT
      IT_FILTER                      = IT_FILTER
      IS_SEL_HIDE                    = IS_SEL_HIDE
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     = IS_VARIANT
         IT_EVENTS                      = IT_EVENT
      IT_EVENT_EXIT                  = IT_EVENT_EXIT
          I_TABNAME_HEADER               = 'IT_EKKO'
          I_TABNAME_ITEM                 = 'IT_EKPO'
      I_STRUCTURE_NAME_HEADER        = I_STRUCTURE_NAME_HEADER
      I_STRUCTURE_NAME_ITEM          = I_STRUCTURE_NAME_ITEM
          IS_KEYINFO                     = IT_KEYINFO
      IS_PRINT                       = IS_PRINT
      IS_REPREP_ID                   = IS_REPREP_ID
      I_BYPASSING_BUFFER             = I_BYPASSING_BUFFER
      I_BUFFER_ACTIVE                = I_BUFFER_ACTIVE
      IR_SALV_HIERSEQ_ADAPTER        = IR_SALV_HIERSEQ_ADAPTER
      IT_EXCEPT_QINFO                = IT_EXCEPT_QINFO
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER         = ES_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB_HEADER                = IT_EKKO
          T_OUTTAB_ITEM                  = IT_EKPO
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " HIERSEQ_DISPLAY
    <b>
    *& Form IT_USER_COMMAND
    text
    FORM IT_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.
      FREE IT_FIELDCAT.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_FINAL INDEX RS_SELFIELD-TABINDEX.
          PERFORM GET_EKBE.
          PERFORM GET_FIELD_CATALOG.
          PERFORM GET_LIST.
      ENDCASE.
    ENDFORM.                               "IT_USER_COMMAND</b>
    *&      Form  GET_EKBE
          text
    FORM GET_EKBE .
      IF NOT IT_FINAL[] IS INITIAL.
        SELECT EBELN
               EBELP
               BELNR
               MENGE
               MATNR
          INTO TABLE IT_EKBE
          FROM EKBE
           FOR ALL ENTRIES IN IT_FINAL
         WHERE EBELN = IT_FINAL-EBELN
           AND EBELP = IT_FINAL-EBELP.
      ENDIF.
    ENDFORM.                    " GET_EKBE
    *&      Form  GET_FIELD_CATALOG
          text
    FORM GET_FIELD_CATALOG .
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-COL_POS = '1'.
      WA_FIELDCAT-JUST = 'R'.
      WA_FIELDCAT-SELTEXT_L = 'PO Number'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-COL_POS = '2'.
      WA_FIELDCAT-JUST = 'R'.
      WA_FIELDCAT-SELTEXT_L = 'Item Number'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'BELNR'.
      WA_FIELDCAT-COL_POS = '3'.
      WA_FIELDCAT-JUST = 'R'.
      WA_FIELDCAT-SELTEXT_L = 'Material Document'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-COL_POS = '4'.
      WA_FIELDCAT-JUST = 'R'.
      WA_FIELDCAT-SELTEXT_L = 'Quantity'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-COL_POS = '5'.
      WA_FIELDCAT-JUST = 'R'.
      WA_FIELDCAT-SELTEXT_L = 'Material Number'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
    ENDFORM.                    " GET_FIELD_CATALOG
    *&      Form  get_list
          text
    FORM GET_LIST .
      IF RB1 = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
           I_CALLBACK_PROGRAM                = V_REPID
        I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = ' '
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  = I_STRUCTURE_NAME
        I_BACKGROUND_ID                   = ' '
           I_GRID_TITLE                      = 'SECONDARY LIST'
        I_GRID_SETTINGS                   = I_GRID_SETTINGS
        IS_LAYOUT                         = IS_LAYOUT
           IT_FIELDCAT                       = IT_FIELDCAT
        IT_EXCLUDING                      = IT_EXCLUDING
        IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
        IT_SORT                           = IT_SORT
        IT_FILTER                         = IT_FILTER
        IS_SEL_HIDE                       = IS_SEL_HIDE
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        = IS_VARIANT
        IT_EVENTS                         = IT_EVENTS
        IT_EVENT_EXIT                     = IT_EVENT_EXIT
        IS_PRINT                          = IS_PRINT
        IS_REPREP_ID                      = IS_REPREP_ID
        I_SCREEN_START_COLUMN             = 0
        I_SCREEN_START_LINE               = 0
        I_SCREEN_END_COLUMN               = 0
        I_SCREEN_END_LINE                 = 0
        I_HTML_HEIGHT_TOP                 = 0
        I_HTML_HEIGHT_END                 = 0
        IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
        IT_HYPERLINK                      = IT_HYPERLINK
        IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
        IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
        IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
        ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
          TABLES
            T_OUTTAB                          = IT_EKBE
         EXCEPTIONS
           PROGRAM_ERROR                     = 1
           OTHERS                            = 2
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF RB2 = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             = I_BYPASSING_BUFFER
      I_BUFFER_ACTIVE                = ' '
           I_CALLBACK_PROGRAM             = V_REPID
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               = I_STRUCTURE_NAME
      IS_LAYOUT                      = IS_LAYOUT
           IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   = IT_EXCLUDING
      IT_SPECIAL_GROUPS              = IT_SPECIAL_GROUPS
      IT_SORT                        = IT_SORT
      IT_FILTER                      = IT_FILTER
      IS_SEL_HIDE                    = IS_SEL_HIDE
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     = IS_VARIANT
      IT_EVENTS                      = IT_EVENTS
      IT_EVENT_EXIT                  = IT_EVENT_EXIT
      IS_PRINT                       = IS_PRINT
      IS_REPREP_ID                   = IS_REPREP_ID
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      IR_SALV_LIST_ADAPTER           = IR_SALV_LIST_ADAPTER
      IT_EXCEPT_QINFO                = IT_EXCEPT_QINFO
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER         = ES_EXIT_CAUSED_BY_USER
          TABLES
            T_OUTTAB                       = IT_EKBE
         EXCEPTIONS
           PROGRAM_ERROR                  = 1
           OTHERS                         = 2
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_list
    Thanks
    Vikranth Khimavath
    Message was edited by:
            Khimavath Vikranth

  • Double click and get and store the value in variable.

    Hi,
    My intention is when i double click a particular record on a tabular, i want to capture or store the particular value of record into a variable and call that variable in print/preview button PLSQL code.
    Below i show the screenshot which contain a tabular and print preview button. After populating the data. the user will double click on the agent code LC354 and click the print/preview button it should display report for only the
    agent code of LC354(this is what i want). But normally when i click the print preview button it wil show the report of agent code of LC354 and LC325(this what i dont want).
    http://imageshack.us/photo/my-images/811/printpb.png/
    My problem is how to capture the value((*LC354*)) of particular record after double click the agent code(*LC354*)?
    i tried to store agent code in variable AG_CNT in mouse double click trigger with following plsql code. but it dosent work.
    declare
    AG_CNT varchar2(10);
    begin
    *AG_CNT* :=GET_ITEM_PROPERTY('RFQ_AGENT_DETAILS.AGENT_CODE',CURRENT_RECORD);
    end;after that pass that AG_CNT value in *:AG_CODE*. below code is in print/preview button.
         cursor c1 is select nvl(count(ENQUIRY_NO),0) from scott.EXP_QUOTE_STATUS
         where ltrim(rtrim(upper(job_status))) like 'APPROVED%' and ENQUIRY_NO = :REQ_FOR_QUOT.ENQUIRY_NO
    AND AGENT_CODE=*:AG_CODE* ;how to do this?
    skud.

    Hi skud
    i juast want to store the agent code to variable.if i did get ur point...
    Why don't u just use a simple assign statment for example...
    DECLARE
    V_VALUE  NUMBER;
    BEGIN
    V_VALUE := LC354 ; -- IF it was a value as LC354 static i mean
    -- or u could use any value
    V_VALUE := :ur_form_item_name; --- if it was dynamic
    END;That's it .
    Hope this helps...
    Regards,
    Ammatu Allah.

  • When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder". How can i fix this?

    When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder. How can i fix this problem?

    Anyone can help to advice how to solve this issue ?

  • Double clicking on a region to open it no longer works...

    After installing OS 10.8.2 I have problems with Logic 9.1.8. If I double click on a region in the Arrange window, it used to open on the lower part of the Arrange window so I could edit notes, velocity settings etc. Now, when double-clicking, the lower part opens for very short time (0,1 second) and then disappears. I have deleted prefs files, restarted the iMac etc., but nothing helps. - What should i do? Is there any other way to open a region in the lower part of the Arrange window?
    I just discovered that I have the same problem when double clicking on instruments. They open for a very short while (0,2 sec) and then close. This means that I can't adjust parameters in the pop-up window (instrument, filter etc.). Very strange. I remember I had this problem some weeks ago, but it disappeared. Not now.

    A few ideas..
    Have you checked your mouse/trackpad settings in System Preferences.... in case something got messed up there... as it sounds like an input device issue in some ways
    Also, check Logic Preferences/General/Editing and make sure that Double Clicking a Midi region Opens... is set to Piano Roll (Even if it is.. try unchecking it.. close prefs.. and recheck it again..)
    Finally, you said you had trashed the pref files.. which one(s) did you trash? Did you also trash the CS one too.. as it could be related to a control surface issue.. I mention this because a client of mine had an issue after installing an iPad Controller for Logic...  If you have an iPad/iPhone.. make sure the iPad/iPhone is powered off (Not just asleep) and test after that too...

  • InDesign crashes every time you double click to open an .indd file on Windows system

    InDesign crashes every single time you double click to open an InDesign file and has done so since replacement of the original version of InDesign introduced in the Creative Cloud launch.  Does anyone else have this problem?  I'd say it was unique to my system if I hadn't experienced the issue repeatedly on several different systems now.  You have to relaunch InDesign which then opens the file from recovery, so it saw the file you tried to launch in the first place.  This leads me to believe the problem lies with the file association registry of InDesign inside Windows systems.  I find it unbelievable that this problem still exists and remains unreported and that a solution hasn't been implemented by Adobe to rectify the issue.
    The double click is a fundamental tenant of opening files on a Windows system in the same way a single click is on a Mac.  Does InDesign crash ever time a Mac user clicks to open their files, I think not.
    Anyone got any ideas other than the obvious which is Adobe actually got their figure out and fixed it.
    Cheers,
    Pat Doyle

    Hi Michael,
    I'll give it a go.  Don't really like messing with the registry on Windows boxes.  Yes you can do it, but it can end up being a case of the operation was a success, but the patient died.
    Just was rather hoping someone else had already experienced this problem and posted the registry tweak.  Didn't want spend hours reinventing the wheel.  Not because I'm lazy, but I have so many demands on my time that resolving a minor issue that effects me only seems like it should be pretty low priority.
    The system I'm using is brand new, but the problem seems to have followed me regardless which may indicate that it is seated in my synchronization information somehow.  Really don't know how that could happen as I'm not an Adobe engineer or have the remotest idea where to even start looking.  So I think I'll mark your suggestion as the "Answer" and just learn to live with it.
    Windows eh! Can't live with - can't live without it.  I'm sure Mac can be just as temperamental. Just have to chalk this one up as being just another ghost in the machine.
    Thanks for all the advice you have kindly offered, much appreciated.
    Cheers,
    Pat Doyle

Maybe you are looking for